In WPF, if I want to reference the whole object (not a specific property) in a binding, I can write any of the following:
{Binding Path=.}{Binding .}{Binding}
Like so:
<ItemsControl ItemsSource="{Binding Widgets}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<controls:WidgetControl Widget="{Binding}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
However in WinRT I have not been able to get this to work:
<GridView ItemsSource="{Binding Source={StaticResource Widgets}}">
<GridView.ItemTemplate>
<DataTemplate>
<controls:WidgetControl Widget="{Binding}"/>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
It fails with a very vague exception:
The text associated with this error code could not be found.
Failed to assign to property 'XX.WidgetControl.Widget'. [Line: XX Position: XX]
The ItemsSource binding works because the DataContext of each controls:WidgetControl gets set to a Widget. And I know the obvious answer to this is just to wait for the DataContext to be set and cast that to a Widget inside my widget control. But I'm asking on principle: Why doesn't self-binding work in WinRT... or is there a notation to make it work?