Disabling a CellEditingTemplate programmatically in in a Silverlight DataGrid
Posted
by bplus
on Stack Overflow
See other posts from Stack Overflow
or by bplus
Published on 2010-06-01T08:47:42Z
Indexed on
2010/06/01
8:53 UTC
Read the original article
Hit count: 303
I have a Silverlight Datagrid, I'd like to make certain cells readonly programmatically. Specifically I have a CellEditingTemplate, I'd like to turn the cell editing off or on depending on the value of CategoryTypeName (see the xmal below).
<local:DataGridTemplateColumn Header="Category" >
<local:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding CategoryTypeName}"/>
</DataTemplate>
</local:DataGridTemplateColumn.CellTemplate>
<local:DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<ComboBox
Width="90"
x:Name="CategoryCombo"
ItemsSource="{Binding CategoryTypes}"
DisplayMemberPath="Name"
SelectionChanged="CategoryCombo_SelectionChanged"
/>
</DataTemplate>
</local:DataGridTemplateColumn.CellEditingTemplate>
</local:DataGridTemplateColumn>
Is there a way to do this?
Any help would be very much appreciated.
Thanks in advance.
© Stack Overflow or respective owner