【发布时间】:2010-08-18 13:37:54
【问题描述】:
我无法在 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);
}
}
在 XAML 中不绑定:
<TextBlock x:Name="txtInfoTime" Text="{Binding Path=Time, Source=Info}" />
Path 和 Source 是一样的,我的错在哪里?
谢谢罗伯
【问题讨论】: