6
如何使一列在只讀數據網格中可編輯?如何在只讀數據網格中編輯一列?
<DataGrid x:Name="dgLoadDtl" Height="315" Width="710" Grid.Row="0"
HorizontalAlignment="Left" VerticalAlignment="Bottom"
Style="{DynamicResource StyleDatagrid}"
IsReadOnly="true">
<DataGrid.Columns>
<DataGridTextColumn Foreground="Black" Width="60" Header="Sctn" Binding="{Binding Sctn, Mode=TwoWay}" IsReadOnly="false" />
<DataGridTextColumn Foreground="Black" Width="140" Header="CustName" Binding="{Binding CustName, Mode=TwoWay}" />
<DataGridTextColumn Foreground="Black" Width="140" Header="Address" Binding="{Binding Address1, Mode=TwoWay}" />
<DataGridTextColumn Foreground="Black" Width="50" Header="Bulk or Bag" Binding="{Binding BulkorBag, Mode=TwoWay}" />
<DataGridTextColumn Foreground="Black" Width="80" Header="ProdCode" Binding="{Binding ProdCode, Mode=TwoWay}" />
<DataGridTextColumn Foreground="Black" Width="80" Header="MedCode" Binding="{Binding MedCode, Mode=TwoWay}" />
您必須刪除'IsReadyOnly =「真正的」'從主'DataGrid'並對被只讀你要添加的每個列'IsReadOnly =「true」''比如' ' –
2013-02-11 16:17:33
/\不起作用。 – Kirka121 2014-03-10 15:12:20
檢查了這一點: http://stackoverflow.com/questions/4471934/can-i-specify-which-columns-are-editable-in-a-wpf-datagrid – 2014-06-28 12:22:19