1. Use tag extension to assign values to attributes of an object.
CodeAs follows:
Textblock 1 < Window. Resources >
2 < SYS: String X: Key = " Hellostring " > Hellostring </ SYS: String >
3
4 </ Window. Resources >
5 < Grid >
6 < Textblock height = " 20 " Width = " 300 " Text = " {Staticresource resourcekey = hellostring} " />
7
8 </ Grid >
3. dynamically bind the extension tag
The textbox value changes as the slider slides.
The Code is as follows:
Binding 1 < Grid >
2 < Grid. rowdefinitions >
3 < Rowdefinition height = " 33 " > </ Rowdefinition >
4 < Rowdefinition height = " 4 " > </ Rowdefinition >
5 < Rowdefinition height = " 30 " > </ Rowdefinition >
6 </ Grid. rowdefinitions >
7 < Textbox X: Name = " TB " Text = " {Binding elementname = SLD, Path = value} " > </ Textbox >
8 < Slider X: Name = " SLD " Grid. Row = " 2 " Value = " 50 " Maximum = " 100 " Minimum = " 0 " > </ Slider >
9 </ Grid >
Reference: WPF extension labels