WPF中datagrid自定义固定图片列

 1 <Window x:Class="WpfApplication4.MainWindow"
 2         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 3         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 4         Title="MainWindow" Height="350" Width="525">
 5     <Grid>
 6         <DataGrid Name="dgStaff" AutoGenerateColumns="False">
 7             <DataGrid.Columns>
 8                 <DataGridTemplateColumn Header="图片">
 9                     <DataGridTemplateColumn.CellTemplate>
10                         <DataTemplate>
11                             <Image Source="small-logo-chn.png" Height="35" Width="35" />
12                         </DataTemplate>
13                     </DataGridTemplateColumn.CellTemplate>
14                 </DataGridTemplateColumn>                
15                 <DataGridTextColumn Header="姓名" Binding="{Binding name}"  />
16             </DataGrid.Columns>
17         </DataGrid>
18     </Grid>
19 </Window>
posted @ 2012-08-17 11:25  慧实  阅读(2507)  评论(0编辑  收藏  举报