/// <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中类的属性
最新推荐文章于 2024-07-10 21:43:22 发布