xaml Data Binding Binding string to Text property


To change UI content in runtime, you can use Binding. When binded property is changed from the code, it will be displayed to the UI.

<TextBlock Text="{Binding Title}"/>

To notify UI about changes, property must raise PropertyChanged event from INotifyPropertyChanged interface or you can use Dependency Property.

The Binding is working if the property "Title" is in the xaml.cs file or in the Datacontext class from the XAML.

The Datacontext can be set up in the XAML directly

<Window x:Class="Application.MainWindow"