2012-04-17 56 views

回答

4
<DataGrid ... 
    <DataGrid.CellStyle> 
     <Style TargetType="DataGridCell"> 
      <Setter Property="Width" Value="100"/> 
      <Setter Property="Height" Value="50"/> 
     </Style> 
    </DataGrid.CellStyle> 
1

尝试这样:

<!--you can set Name and ItemsSource to other values, this is just a sample--> 
    <DataGrid x:Name="dataGrid" ItemsSource="{Binding}"> 
     <DataGrid.CellStyle> 
      <Style TargetType="DataGridCell"> 
       <Setter Property="Width" Value="100"/> 
       <Setter Property="Height" Value="50"/> 
      </Style> 
     </DataGrid.CellStyle> 
    </DataGrid> 
1

你试过设置columnWidth和rowHeight?

<DataGrid ColumnWidth="100" RowHeight="50"/> 

造型的DataGrid的更多信息,可以在 Styling Microsoft’s WPF datagrid找到。

+0

请更正您断开的链接。 – LPL 2012-04-17 19:39:22

相关问题