zoukankan      html  css  js  c++  java
  • dataTemplate 之 ContentTemplate 的使用

    <Window x:Class="WpfApplication1.Window38"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:WpfApplication1"
    Title="Window38" Height="227" Width="269">
    <Window.Resources>
    <!--数据对象-->
    <local:Student38 x:Key="stu" Id="1" Skill="WPF" Name="Timothy" HasJob="True"></local:Student38>
    <!--DataTemplate-->
    <DataTemplate x:Key="dtStu">
    <Border BorderBrush="Orange" BorderThickness="2" CornerRadius="5">
    <StackPanel>
    <TextBlock Text="{Binding Id}" Margin="5"></TextBlock>
    <TextBlock x:Name="txtBlockName" Text="{Binding Name}" Margin="5"></TextBlock>
    <TextBlock Text="{Binding Skill}" Margin="5"></TextBlock>
    </StackPanel>
    </Border>
    </DataTemplate>
    </Window.Resources>
    <!--主窗体布局-->
    <StackPanel>
    <ContentPresenter x:Name="cp" Content="{StaticResource stu}" ContentTemplate="{StaticResource dtStu}" Margin="5">

    </ContentPresenter>
    <Button Content="Find" Margin="5,0" Click="Button_Click">

    </Button>
    </StackPanel>
    </Window>

    -----------------------------------------------------------------------------------------------------

  • 相关阅读:
    大数据组件
    k8s 证书过期时间调整
    k8s Metrics Server 获取资源指标与 hpa 部署
    k8s修改集群coredns
    k8s 版本升级
    k8s node节点剔除与增加
    etcd 单节点部署、备份与恢复
    k8s 连接ceph集群
    efk收集k8s 容器日志安装记录
    prometheus 监控k8s 安装测试记录
  • 原文地址:https://www.cnblogs.com/bruce1992/p/14152437.html
Copyright © 2011-2022 走看看