I'm trying to understand why something does work. If you create a new
WPF Applicatin project, WpfApplication6, and set the following:
MainWindow.xaml:
<Window x:Class="WpfApplication6.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:app="clr-namespace:WpfApplication6"
Title="Window1" Height="300" Width="300">
<Window.Resources>
<ObjectDataProvider
x:Key="ObjData"
IsInitialLoadEnabled="True"
ObjectType="{x:Type app:DummyClass}"
IsAsynchronous="True"
/>
</Window.Resources>
<StackPanel>
<app:UserControl1 Dummy="{Binding Source={StaticResource ObjData},
Path=Data, BindsDirectlyToSource=True}" />
</StackPanel>
</Window>
Add a UserControl named UserControl1:
<UserControl x:Class="WpfApplication6.UserControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:app="clr-namespace:WpfApplication6"
><x:Code>
<![CDATA[
public static readonly DependencyProperty DummyProperty =
DependencyProperty.Register( "Dummy", typeof( DummyClass ),
typeof( UserControl1 ) );
public DummyClass Dummy {
get { return (DummyClass)GetValue( DummyProperty ); }
set { SetValue( DummyProperty, value ); }
}
]]>
</x:Code>
<TextBlock Text="{Binding RelativeSource={RelativeSource
FindAncestor, AncestorType={x:Type app:UserControl1}},
Path=Dummy.MyProperty}" />
</UserControl>
And a class, DummyClass:
public class DummyClass {
public string MyProperty { get { return "My Text!"; } }
}
And run the program... the text is never displayed. If the
DataProvider is set not to be asyncronous, it works... but shouldn't
the property Data being changed when IsAsync = true cause the binding
to refresh?
Thanks
Andy