i can’t get this binding working in XAML.
Binding in c# works:
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);
}
}
Binding in XAML not:
<TextBlock x:Name="txtInfoTime" Text="{Binding Path=Time, Source=Info}" />
Path and Source are the same, so where is my mistake?
Thx Rob
You need to set the DataContext.
You can just add:
after
And change XAML to: