Silverlight DataGrid set cell IsReadOnly programatically
- by Brandon Montgomery
I am binding a data grid to a collection of Task objects. A particular column needs some special rules pertaining to editing:
<!--Percent Complete-->
<data:DataGridTextColumn Header="%"
ElementStyle="{StaticResource RightAlignStyle}"
Binding="{Binding PercentComplete, Mode=TwoWay, Converter={StaticResource PercentConverter}}" />
What I want to do is set the IsReadOnly property only for each task's percent complete cell based on a property on the actual Task object. I've tried this:
<!--Percent Complete-->
<data:DataGridTextColumn Header="%"
ElementStyle="{StaticResource RightAlignStyle}"
Binding="{Binding PercentComplete, Mode=TwoWay, Converter={StaticResource PercentConverter}}"
IsReadOnly={Binding IsNotLocalID} />
but apparently you can't bind to the IsReadOnly property on a data grid column. What is the best way do to do what I am trying to do?