DataGrid 控件中显示和配置行详细信息

1. 创建定义行详细信息部分的外观的一个 DataTemplate。

2. 将 DataTemplate 放入 <DataGrid.RowDetailsTemplate> 标记。

 
 
 
  
< sdk:DataGrid x:Name = " dataGrid1 " Height = " 400 " IsReadOnly = " True " >
< sdk:DataGrid.RowDetailsTemplate >
<!-- Begin row details section. -->
< DataTemplate >
< Border BorderBrush = " Black " BorderThickness = " 1 " Background = " Tan " >
< StackPanel Orientation = " Horizontal " >
< StackPanel >
< StackPanel Orientation = " Horizontal " >
<!-- Controls are bound to Task properties. -->
< TextBlock FontSize = " 16 " Foreground = " MidnightBlue " Text = " {Binding Name} "
Margin
= " 0,0,10,0 " VerticalAlignment = " Bottom " />
< TextBlock FontSize = " 12 " Text = " Due Date: " VerticalAlignment = " Bottom " />
< sdk:DatePicker SelectedDate = " {Binding DueDate, Mode=TwoWay} " VerticalAlignment = " Bottom " />
< TextBlock FontSize = " 12 " Text = " Complete: " VerticalAlignment = " Bottom " />
< CheckBox IsChecked = " {Binding Complete, Mode=TwoWay} "
VerticalAlignment
= " Center " />
</ StackPanel >
< TextBlock FontSize = " 12 " Text = " Notes: " />
< TextBox FontSize = " 12 " Text = " {Binding Notes, Mode=TwoWay} "
Width
= " 420 " TextWrapping = " Wrap " />
</ StackPanel >
</ StackPanel >
</ Border >
</ DataTemplate >
<!-- End row details section. -->
</ sdk:DataGrid.RowDetailsTemplate >
</ sdk:DataGrid >
3. 将 DataTemplate 绑定到 DataGrid 的 RowDetailsTemplate 属性。
 
  
< data:DataGrid RowDetailsTemplate = " {StaticResource templateReference} " />

转载于:https://www.cnblogs.com/landexia/archive/2011/03/14/1984126.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值