(隔離された環境でバグを再現するために) wpf ウィンドウ内に wpf ページを表示しようとしていますが、ウィンドウ内にページが表示されません。
私のコードは非常に単純です:
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>
MainWindow が空に見える理由はありますか?
ありがとう、リー