Example one: Realization in the form of resources
Namespace data binding 1{public class Student {public int Id {get; set;} public string Name {get; set;} public int Age {get; set;}} }
<Windowx:class= "Data binding 1." MainWindow "xmlns= "Http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x= "Http://schemas.microsoft.com/winfx/2006/xaml"xmlns:local= "Clr-namespace: Data binding 1"Title= "MainWindow"Height= " the"Width= "525"> <StackPanelBackground= "LightBlue"> <Stackpanel.datacontext> <local:studentId= "6" Age= "$"Name= "Time"/> </Stackpanel.datacontext> <Grid> <StackPanel> <TextBoxText="{Binding Path=id}"Margin= "5"Background= "Red" /> <TextBoxText="{Binding Path=name}"Margin= "5"Background= "Red" /> <TextBoxText="{Binding Path=age}"Margin= "5"Background= "Red" /> </StackPanel> </Grid> </StackPanel></Window>
WPF DEMO17 Data Binding