user429400
user429400

Reputation: 3325

WPF - can't display page content

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

Answers (1)

brunnerh
brunnerh

Reputation: 184376

Path=MyPage.TT looks for a property called TT, TT in all likelihood is not a property.

Upvotes: 1

Related Questions