我无法在XAML中使用此绑定。
在C#中进行绑定的工作原理是:
public partial class myControl : UserControl
{
// get singleton instance
InfoPool Info = InfoPool.Info;
public myControl()
{
InitializeComponent();
// Test Binding
Binding bind = new Binding();
bind.Source = this.Info;
bind.Path = new PropertyPath("Time");
txtInfoTime.SetBinding(TextBlock.TextProperty, bind);
}
}
Run Code Online (Sandbox Code Playgroud)
在XAML中绑定不是:
<TextBlock x:Name="txtInfoTime" Text="{Binding Path=Time, Source=Info}" />
Run Code Online (Sandbox Code Playgroud)
路径和源相同,所以我的错误在哪里?
Thx罗布