标签:des style blog http io color os ar for
<Window x:Class="demo.DataGridRowDetails" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="DataGridRowDetails" Height="300" Width="400"> <Grid> <!--设置行细节显示RowDetailsVisibilityMode="VisibleWhenSelected"--> <DataGrid x:Name="gridProducts" Margin="5" AutoGenerateColumns="False" > <!--行细节,当鼠标单击表格里的行时,自动显示RowDetailsTemplate里面的内容--> <DataGrid.RowDetailsTemplate> <DataTemplate> <Border Margin="10" Padding="10" BorderBrush="SteelBlue" BorderThickness="3" CornerRadius="5"> <TextBlock Text="{Binding Description}" TextWrapping="Wrap" FontSize="13" MaxWidth="300" TextAlignment="Left"></TextBlock> </Border> </DataTemplate> </DataGrid.RowDetailsTemplate> <DataGrid.Columns> <DataGridTextColumn Header="Product" Width="175" Binding="{Binding ModelName}"></DataGridTextColumn> <DataGridTextColumn Header="Price" Binding="{Binding UnitCost,StringFormat={}{0:C}}"></DataGridTextColumn> <DataGridTextColumn Header="Model Number" Binding="{Binding ModelNumber}"></DataGridTextColumn> </DataGrid.Columns> </DataGrid> </Grid> </Window>
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; namespace demo { /// <summary> /// DataGridRowDetails.xaml 的交互逻辑 /// </summary> public partial class DataGridRowDetails : Window { public DataGridRowDetails() { InitializeComponent(); //App.StoreDb.GetProduct返回ICollection<Product> gridProducts.ItemsSource = App.StoreDb.GetProducts(); } } }
标签:des style blog http io color os ar for
原文地址:http://www.cnblogs.com/xiepengtest/p/4068361.html