Make DataGrid cells read-only *sometimes*

Jun 27, 2011 at 4:52 PM
Edited Jun 27, 2011 at 4:56 PM

So obviously setting the IsReadOnly property to True on a DataGridTextColumn means that column cannot be edited. Setting it to False means it can be edited. Is there a way to change this for each row? My object has properties named Length and FixedLength. my DataGrid has a column that binds to the Length property. I want to bind the read only property to FixedLength but when i do:
<wt:DataGridTextColumn Header="Length" Binding="{Binding Length}" IsReadOnly="{Binding FixedLength}"/>
<wt:DataGridTextColumn Header="Precision" Binding="{Binding Precision}" IsReadOnly="True"/>
<wt:DataGridTextColumn Header="Scale" Binding="{Binding Scale}" IsReadOnly="False"/>

The Precision column is never editable, the Scale column is always editable, and the Length column is always editable no matter what the value of FixedLength is. The binding is good, the correct values appear in all 3 columns. Is there a way to do this?

Jun 27, 2011 at 7:20 PM

Is FixedLength a Boolean?