Binding String Property in Code-Behind TextBlock Binding String Property in Code-Behind TextBlock wpf wpf

Binding String Property in Code-Behind TextBlock


Use BindingOperations

Binding binding = new Binding();binding.Path = new PropertyPath("SomeText");binding.Source = sourceObject;  // view model?BindingOperations.SetBinding(theTextBlock, TextBlock.TextProperty, binding);