Category / Section
How to bind header property to child of WPF DockingManager from code behind?
1 min read
You can bind the Header property of WPF DockingManager child from a variety of data sources in the form of common language runtime (CLR) objects and XML. Here, you have bound the Header Property of DockingManager child from TextBox TextProperty. The same has been explained in the following code,
MainWindow.Xaml
<Grid> <Grid.RowDefinitions> <RowDefinition Height="40"></RowDefinition> <RowDefinition></RowDefinition> </Grid.RowDefinitions> <TextBox Name="test1" Text="test" Grid.Row="0" Width="100"/> <syncfusion:DockingManager x:Name="DockingMgr" Loaded="DockingMgr_Loaded" Grid.Row="1"> <ContentControl x:Name="contentcontrol"></ContentControl> </syncfusion:DockingManager> </Grid>
C#
private void DockingMgr_Loaded(object sender, RoutedEventArgs e) { Binding binding = new Binding(); binding.Source = test1; binding.Mode = BindingMode.TwoWay; binding.Path = new PropertyPath(TextBox.TextProperty); contentcontrol.SetBinding(DockingManager.HeaderProperty, binding); }