0
点赞
收藏
分享

微信扫一扫

ContentControl 的使用

<Window x:Class="WPFDemo.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WPFDemo"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Window.Resources>
          <DataTemplate  DataType="{x:Type local:A}">
                <TextBlock>A11111111111</TextBlock>
          </DataTemplate>
          <DataTemplate DataType="{x:Type local:B}">
                <TextBlock>B22222222222</TextBlock>
          </DataTemplate>
    </Window.Resources>
      <Grid>
            <ContentControl Margin="0,0,0,0" Content="{Binding Path=PModel}"></ContentControl>
            <ContentControl Margin="0,200,0,0" Content="{Binding Path=PModel}"></ContentControl>
      </Grid>
</Window>

 

 

ContentControl 的使用_xml

 



举报

相关推荐

0 条评论