-1
我想不出什么我做错了,为什么我的文字显示不出来数据绑定到一个窗口“的财产不工作
<Window x:Class="Test"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Test" Height="300" Width="300" x:Name="TheWindow">
<TextBlock Text="{Binding ElementName=TheWindow,Path=TestObject, Mode=OneTime}" FontSize="12"></TextBlock>
,窗口后面的代码:
public partial class Test : Window
{
public Test()
{
InitializeComponent();
}
public const string TestObject = "I just want to be shown";
}
}