WPF vs Silverlight [duplicate]

That’s an extremely broad question. My company recently wrote a whitepaper outlining the differences between the two technologies, and it’s around 70 pages. Unfortunately, it’s not published yet, or I’d give you the link. EDIT: As promised, here’s the link to the whitepaper on Codeplex: http://wpfslguidance.codeplex.com/ However, I’ll try to summarize. WPF is a thick … Read more

This type of CollectionView does not support changes to its SourceCollection from a thread different from the Dispatcher thread [duplicate]

Since your ObservableCollection is created on UI thread, you can only modify it from UI thread and not from other threads. This is termed as thread affinity. If you ever need to update objects created on UI thread from different thread, simply put the delegate on UI Dispatcher and that will do work for you … Read more

How to automatically select all text on focus in WPF TextBox?

We have it so the first click selects all, and another click goes to cursor (our application is designed for use on tablets with pens). You might find it useful. public class ClickSelectTextBox : TextBox { public ClickSelectTextBox() { AddHandler(PreviewMouseLeftButtonDownEvent, new MouseButtonEventHandler(SelectivelyIgnoreMouseButton), true); AddHandler(GotKeyboardFocusEvent, new RoutedEventHandler(SelectAllText), true); AddHandler(MouseDoubleClickEvent, new RoutedEventHandler(SelectAllText), true); } private static void … Read more

Difference between SelectedItem, SelectedValue and SelectedValuePath

Their names can be a bit confusing :). Here’s a summary: The SelectedItem property returns the entire object that your list is bound to. So say you’ve bound a list to a collection of Category objects (with each Category object having Name and ID properties). eg. ObservableCollection<Category>. The SelectedItem property will return you the currently … Read more