wpf

What is the best approach to create MDI pop-up windows in WPF?

I need to create a prototype to test the ability of WPF to do the following: one base window as the application's base within this window user can click (e.g. on "add customer") and a new window pops up the pop-up window is bright the main window in the background is dimmed if the user clicks on the main window main window becomes b...

NullReferenceException calling RegisterName() from control in DataTemplate

I've created a custom WPF control that performs some animations on dynamically created objects. I use SetTargetName() to set animation target. (I know about SetTarget() but I need to support .NET 3.5 without SP1.) Obviously before that I need to register object names with RegisterName(). Everything works fine when my control is placed no...

Mousewheel Delta value always 120

Hello all, I am creating an application in WPF that uses the mousewheel to zoom in/out an image. The amount of zooming is based on the amount of mouse wheel turning. The problem is that the Delta value is always 120, as explained in MSDN. So, even if I turn the wheel 1 notch or 5 notches it will always be 120. Do you know a way around ...

Replacing desktop wallpaper / draw on the desktop

I'd like to do some custom drawing to my windows desktop such that it appears to replace the desktop background (wallpaper). My first try was to get a DC for the desktop's listview and draw to it: IntPtr desktopDC = GetWindowDC(desktopListView); Graphics g = Graphics.FromHwnd(desktopDC); <-- fails on out of memory error I then tried t...

How to keep datasource updated in all WPF user controls?

I have WPF application with one main window. In this window there are a series of buttons which form a menu and a space where user controls are loaded at runtime. However, if the user changes data (stored in XML file) in one user control and then switches to another user control, the user does not see the updated data in the new user c...

In WPF/Silverlight: Is it possible to bind a DataTable or an XML file to a ListView?

Is it possible in WPF to bind a data matrix (data table or an XML file) to a ListView? Given the following XML dataset: <data> <cols> <col name="FirstName" /> <col name="LastName" /> <col name="Age" /> </cols> <rows> <row> <col>Huey</col> <col>Freeman</col> <col>10</col> </row> <row> ...

A Security (encryption) Dilemma

I have an internal WPF client application that accesses a database. The application is a central resource for a Support team and as such includes Remote Access/Login information for clients. At the moment this database is not available via a web interface etc, but one day is likely to. The remote access information includes the usernam...

WPF TextBox not accepting Input when in ElementHost in Window Forms

We are developing a UI Control in WPF to be consumed within an existing Windows Forms / MFC application engine (Rhino 3D). The application engine exposes the ability create a "Dockbar" which essentially lets you put Windows Forms controls inside a child window which can dock to the Engines Interface. I am attempting to put a simple WPF...

Automatically capitalize all input in WPF

Is there a way to automatically capitalize all input thoughtout a WPF app? ...

What are some techniques for migrating a large MFC application to WPF/.NET?

I am currently working on a very large legacy MFC MDI application. It has a large number of UI elements - dockable toolbars, custom tree controls, context menus, etc. It is an image processing application so the main views render themselves using DirectX and OpenGL. The product is about 10 years old and one of the priorities here is t...

Triggers collection members must be of type EventTrigger

I've created a UserControl, similar to the following: <UserControl> <StackPanel Orientation="Vertical"> <StackPanel x:Name="Launch" Orientation="Horizontal" Visibility="Collapsed"> <!-- Children here --> </StackPanel> <ToggleButton x:Name="ToggleLaunch" IsChecked="False" Content="Launch" /> ...

WPF to WCF Permission issue

I have created a WPF browser application that I wish to connect to a WCF service. The service is in the same solution as the WPF application. It is the default service that Visual Studio creates with a method called GetData (int) I am attempting to call this service with the following code: var client = new Service1.Service1Client();...

C# - Loading a large file into a WPF RichTextBox?

I need to load a ~ 10MB range text file into a WPF RichTextBox, but my current code is freezing up the UI. I tried making a background worker do the loading, but that doesnt seem to work too well either. Here's my loading code. Is there any way to improve its performance? Thanks. //works well for small files only private void L...

How do I store some object globally?

I'm new to WPF and used to ASP.NET. I have a WPF app that will require a login screen. Throught the rest of the app I want to be able to access a "Session" object that will contain some credentials information. How do I store that so that any view in my app can access that object? ...

WPF Textblock, linebreak in Text attribute

Is there a way to have \n make a linebreak in a TextBLock? <TextBlock Text="line1\nLine2" /> Or is there a better way to force a middle line break, inside the Text="" attribute? <linebreak /> ????? This doesn't work for me, it needs to be the value of the Text="" attribute, because the text string is being set from an outside sourc...

How can I animate the height of a ListView when adding items via ItemsSource?

I have a ListView that is set up with a MinHeight and a MaxHeight. The final height is determined by the number of items inside the list. At the moment, when a list is added to the ItemsSource property of the ListView, the height jumps to the final height. Is there a way to animate this change in height, so that it's smooth? ...

Using MS ReportViewer in WPF

I'm about to start using the MS ReportViewer in a WPF application by placing the ReportViewer in a WindowsFormsHost. Is this the correct approach? What is the best way of designing the reports as you cannot use the ReportViewer at design time in a WindowsFormsHost. Is it best to create an RDL report in SQL Server and then convert it to...

Bind the height of a grid row to it's contents in WPF

I have a grid with a few rows. In the top row, I have an ItemsControl that is bound dynamically to a collection and uses a DataTemplateSelector and ItemsPanelTemplate (with a single horizontally arranged WrapPanel). Here's a stripped-down version of what I have so far: <Grid> <Grid.RowDefinitions> <RowDefinition Height="40...

How to remove the left-hand blue line on custom selected styled Listbox items?

I found this code which replaces the default select style with a custom style for the select ListBoxItem in a ListBox. However, there is still a little blue line on the left from the default style which I can't remove with any padding or margin changes. How can I remove that blue line and completely determine the style of the selected L...

How to change input method in WPF ?

I want to change the input method for text box in my WPF application. Can anyone please help ...