How do you do this in C #?
<TextBlock Text={Binding MyProperty}/>
Suppose the DataContext is set to the Type MyClass class
You can call FrameworkElement.SetBinding () to create data binding with C #.
Assuming your TextBlock is called _textBlock :
TextBlock
_textBlock
var binding = new Binding("MyProperty"); BindingOperations.SetBinding(_textBlock, TextBlock.TextProperty, binding);
Plain:
<TextBlock x:Name="txt"/> // C# txt.SetBinding(TextBox.TextProperty, "MyProperty");
Create a Binding object and pass it to SetBinding if you want more control over the binding.
Source: https://habr.com/ru/post/1286082/More articles:Saving global data for ASP.net webpage - memory-managementWhy can't I force SSL for Sql Server Reporting Services? - .netEntity Framework Download Layered Associations - c #why '<' is shown as <- javaJavaFX component that emulates JTable - javaHTML tags separated by tinyMCE - javascriptRun IE from a C ++ program - c ++tsql concat string with choice and order does not work with function in order by condition? - sqlFinding PI numbers using Monte Carlo method - pythonHow to implement a linked list in C? - cAll Articles