Reputation: 3325
I'm trying to display a wpf page inside a wpf window (to reproduce some bug in an isolated environment) and I'm unable to see the page inside the window.
My code is quite simple:
MainWindow.xaml:
<ContentPresenter
Content="{Binding ElementName=Root, Path=MyPage}"
ContentTemplate="{Binding ElementName=Root, Path=MyPage.TT}"
/>
MainWindow.xaml.cs:
public MainWindow()
{
InitializeComponent();
this.MyPage = new Page1();
}
Page1.xaml:
<DataTemplate x:Name="TT">
<Grid>
<TextBlock Text="doodle dood doodle da"></TextBlock>
</Grid>
</DataTemplate>
Any Idea why MainWindow appears empty?
Thanks, Li
Upvotes: 1
Views: 778
Reputation: 184376
Path=MyPage.TT
looks for a property called TT
, TT
in all likelihood is not a property.
Upvotes: 1