wpf

WPF: Trigger on DependencyProperty.UnsetValue

in an answer to this question the following statement was made "In theory it might be possible to .... trigger on {x:Static DependencyProperty.UnsetValue}, which would be much cleaner, but this doesn't appear to work in practice." Has anybody had any luck in doing this? ...

WPF Cursor Blink rate

I have noticed that the cursor blinks really slowly in my WPF apps. This is much much slower then in the rest of windows. I'm seeing it working at about half the rate. If I adjust the blink rate in the control panel it does speed up the WPF blink rate, but only proportionally, it is still twice as slow as what is shown in the control pa...

Setting ItemTemplate based on CheckBox value

I have a DataTemplate which contains a CheckBox and ListBox. When the CheckBox is checked, I want to change the ItemTemplate property on the ListBox to change the appearance of each item. Right now, it looks like this: <DataTemplate DataType={x:Type MyViewModel}> <DockPanel> <CheckBox DockPanel.Dock="Bottom" ...

Common WPF pitfalls

I want to gather a list of WPF pitfalls. Issues with WPF that are not that well known and either have some serious design consequences or some major inconveniences. One topic per answer. List: WPF doesn't call your dependency property getters and setters. Mouse.GetPosition() does not always return a correct value. WPF and Winforms ca...

How to Redraw or Refresh a screen

I am working on a wpf application. Here I need to use System.Windows.Forms.FolderBrowserDialog in my Wpf application. System.Windows.Forms.FolderBrowserDialog openFolderBrowser = new System.Windows.Forms.FolderBrowserDialog(); openFolderBrowser.Description = "Select Resource Path:"; openFolderBrowser.RootFolder ...

Reuse controls inside a usercontrol

I have a UserControl UserControl1 and a button inside the UserControl1. And I have a UserControl1ViewModel that has an ICommand property for the button. Using this command I need to call a method outside(from other VMs or VM of the MainWindow) the VM. What is the best practice for this? ...

how to create a 2D grid of images in wpf that is scrollable vertically and horizontally?

I want to create a grid of images with say 10 images in a row, 10 in the next row and so on.. Also I want to use virtualizing stack panel to render only visible images. Whenever I try to use a listbox in a stackpanel I get either a horizontal or vertical alignment. How should I go about it? ...

Resize Clipping Path on window resize in WPF

Hello, I was wondering how to resize a Clipping path dynamically when resizing the window. Right now I'm taking a rectangle in Expression Blend that resizes with the window. Applying this rectangle to a circle as a clipping path makes the rectangle fixed, and it won't resize anymore. I've seen different ways of making clipping paths in...

WPF how to fill combobox in data grid

public class DA_ActivityType { public int Id { get; set; } public string Name { get; set; } } public static List GetActivitytypes() { DataContext dbo = new DataContext(); IEnumerable activityTypes = from actType in dbo.ActivityTypes ...

WPF touch and slide/drag animation

I'm trying to create a pretty simple WPF interface, and from what I know this should be mostly possible using pure XAML. What I know I have a pretty basic understanding of WPF so far, however I have a decent grasp on XAML. I know or can work out how to put content in these panels. This isn't the topic of this question. What I don't ...

C# WPF XAML binding to DataTable

I have the following tables: Company {CompanyID, CompanyName} Deal {CompanyID, Value} And I have a listbox: <ListBox Name="Deals" Height="100" Width="420" Margin="0,20,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Visibility="Visible" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding}" Sel...

Detection of browser version in WPF

Is it possible to find out in what browser version a browser hosted application (XBAP) runs (eg. IE6, IE7 or IE8)? I want to find out the browser version from within the XBAP. ...

How to set Win32 window as owner of WPF window?

I want to use WPF windows in a legacy win32 application. I'd like to behave them in a similar way, like the WPF window always being displayed on top of the win32 window. For this I'd like to set the owner of the WPF window to the win32 windows, but I got no idea how to achieve this. Any help here? Since the answer is hidden behind so...

What is the WPF equivilant for the FlowLayoutPanel?

I am working on a WPF application (a one note clone which is called "note your life") where you can dynamically assign Tags to an entry (just as in virtually any web 2.0 app these days). for this I had in my windows forms prototype a FlowLayoutPanel that did the job very well. I want to have the tags float to the next line if there isn't...

WPF - data binding trigger before content changed

How do i create trigger, which fires BEFORE binding changes value? How to do this for datatemplate? <ContentControl Content="{Binding Path=ActiveView}" Margin="0,95,0,0"> <ContentControl.Triggers> <--some triger to fire, when ActiveView is changing or has changed ?!?!? --> </ContentControl.Triggers> public Object...

How to draw N first elements?

Hello all, There is a canvas element with 10 children (polygons). There is a number in my code from 1 to 10. I'd like to draw the first N elements from the children elements, base on my number. It would be the best solution to do this from XAML with a minimum code-behind like this: ... MyCanvas.N = 5; ... ...

WPF MVVM Picklist Example

Hi, I am looking for a way of easily maintaining a list of Users belonging to a particular Group. I have thought about using a Picklist, where I have 2 listboxs, the first contains a list of Users the second a list of Users belonging to the Group. There will be buttons to allow the adding and removing of selected Users from the Group. As...

WPF: HierarchicalDataTemplate ItemsPanel

I have a TreeView which uses a custom ItemsPanel to show the first level of items in a StackPanel, but I need to show subitems in a StackPanel too. The problem is, the second level of items are shown in a WrapPanel, and as HierarchicalDataTemplate doesn't have an itemsPanel property I'm not sure how to do this. This is my xaml: <TreeVie...

Event for ListView Column Width

I have a ListView in WPF.I wanted to capture the resized width of the GridViewColumn and save that back to the Settings. I even tried using DragDelta but that only captures the event when the GridViewColumn started moving. It doesnt capture the event on completion "EventCompleted " Is there any way I can capture this event ? ...

Windows Forms User Controls in WPF app.

Could someone post a link to simple tutorial, which describe how to use User Controls, created in Win Forms in WPF aplication's? Sank's a lot. ...