cs代码:
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
ContentGrid.DataContext = this;
this.Path = "数据绑定";
}
public string Path { get; set; }
}
XAML代码:
<Grid x:Name="ContentGrid">
<TextBlock Text="{Binding Path}"></TextBlock>
</Grid>
wpf中如何在xaml中绑定cs中类的属性,布布扣,bubuko.com
原文地址:http://www.cnblogs.com/wangjixianyun/p/3763011.html