The power of WPF binding really shines when you use design time data to have a live preview of the aspect of your UI without the need to press F5 to load actual data. Design time data is a cool feature you can have with little effort, suppose you have a simple windows and you [...]

Continue reading about Design time data in WPF and Blend with little effort

In WPF there is no PropertyViewer control, but if your need is simply to show a read-only list of all properties of an object, for dump purpose, you can obtain this with few lines of code. First of all write a special IValueConverter. 1: [ValueConversion(typeof(Object), typeof(ObservableCollection<PropertyInfo>))] 2: public class PropertyViewerConverter : IValueConverter 3: { 4: [...]

Continue reading about Write a PropertyViewer like control in WPF

The problem is really simple, but sometimes I see people tend to forget a little bit how the DataContext works in WPF and being stuck in wandering why a command is not invoked when a button inside a DataTemplate is pressed. Suppose you have a ListView bounds to a list of items called SingleResult, for [...]

Continue reading about Quick reminder on How-To map items of a list view to a VM command

I have an application that is built with a Metro-Like UI, so each windows has no border and can be resized with the ResizeMode equal to CanResizeWithGrip. Figure 1: The windows can be resized by a little grip on the bottom right border of the window I created another view, use a similar layout from [...]

Continue reading about CanResizeWithGrip seems does not work in WPF

Manipulate a FlowDocument in WPF
on June 20th, 2011
On category: WPF

Sample Code is Here. This is the scenario: I have a FlowDocument in a FlowDocumentScrollViewer as in Figure 1. Figure 1: Initial scenario, a simple flow document. My goal is to be able to highlight some words in the document and show some detailed info about highlighted word to the user. It turns out after [...]

Continue reading about Manipulate a FlowDocument in WPF