Binding in XAML

You can use XAML and Binding in XAML without Console Framework, in standalone application. To do this use need:

Examples of usage

Simple two-way binding (TwoWay mode is default mode for objects implementing INotifyPropertyChanged):

<TextBox Text="{Binding Path=Title}"/>

Binding for data flow from source to target only. DataContext object is always Source, so next markup demonstrates data flow from dataContext to StatusBar:

<StatusBar Title="{Binding Path=GroupBoxTitle, Mode=OneWay}"/>

If you need data to bind only one time in initialization, you can use OneTime mode - it works in same direction as OneWay works, but fires only when data binding is being set up:

<GroupBox Title="{Binding Path=GroupBoxTitle, Mode=OneTime}"/>

Also, when setting up a data binding, you can set converter to be used when data flows between Source and Target. Data binding converters differs from XAML converters used to assign values to properties. Data binding converters is designed for data binding exspecially and should implement IBindingConverter interface. Example:

<StatusBar Title="{Binding Path=StatusCode, Mode=OneWay, Converter={Ref converter}}"/>

If you want to use XAML converter in bindings, you can write adapter for it, or add custom property to BindingMarkupExtension. May be, it will be implemented out of the box in future versions.