Read-only DataGrid

Oct 28, 2008 at 2:34 PM
(it is probably not a proper forum)

I am trying to have read-only DataGrid and use the following in the parent control and to my disappointment, it does not work. I tried all target types from DataGridColumn to DataGridTextColumn. What is wrong here? 


<Style TargetType="{x:Type toolkit:DataGridColumn}">



        <Setter Property="IsReadOnly" Value="true"/>





Oct 29, 2008 at 4:32 PM
Unfortunately styling (both implicit as well as explicit) doesn't work for columns because DataGridColumn doesn't derive from FrameworkElement (it derives from a DependencyObject).

Hence you have to set the value of the property directly on the column definitions, like....

<DataGridTextColumn IsReadOnly="True" .... />