Pan & Zoom Image

After using samples from this question I’ve made complete version of pan & zoom app with proper zooming relative to mouse pointer. All pan & zoom code has been moved to separate class called ZoomBorder. ZoomBorder.cs using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; namespace PanAndZoom { public class ZoomBorder : Border { … Read more

Binding ConverterParameter

The ConverterParameter property can not be bound because it is not a dependency property. Since Binding is not derived from DependencyObject none of its properties can be dependency properties. As a consequence, a Binding can never be the target object of another Binding. There is however an alternative solution. You could use a MultiBinding with … Read more

How do I bind a WPF DataGrid to a variable number of columns?

Here’s a workaround for Binding Columns in the DataGrid. Since the Columns property is ReadOnly, like everyone noticed, I made an Attached Property called BindableColumns which updates the Columns in the DataGrid everytime the collection changes through the CollectionChanged event. If we have this Collection of DataGridColumn’s public ObservableCollection<DataGridColumn> ColumnCollection { get; private set; } … Read more

Binding to static property

If the binding needs to be two-way, you must supply a path. There’s a trick to do two-way binding on a static property, provided the class is not static : declare a dummy instance of the class in the resources, and use it as the source of the binding. <Window.Resources> <local:VersionManager x:Key=”versionManager”/> </Window.Resources> … <TextBox … Read more