Wednesday, October 31, 2012

how to set column datagrid values to read only or not editable

how to set column datagrid values to read only or not editable

i have data grid with text boxes data is getting from edmx. i want set the some datagerid columns to readonly not for all..is it possible ...make sure textboxes code written in datatemplate.

thanks

SHANKAR

Answers & Comments...

Answer: 1

Columns have a "IsReadOnly" property on the columns that you can set to "True"...

<sdk:DataGrid ItemsSource="{Binding ...}" AutoGenerateColumns="False">     <sdk:DataGrid.Columns>        <sdk:DataGridTextColumn Header="Property1" IsReadOnly="True" Binding="{Binding Property1}" />        <sdk:DataGridTemplateColumn Header="Property1" IsReadOnly="True">           <sdk:DataGridTemplateColumn.CellTemplate>              <DataTemplate>                 <TextBlock Text="{Binding Property1}" />              </DataTemplate>           </sdk:DataGridTemplateColumn.CellTemplate>        </sdk:DataGridTemplateColumn>     </sdk:DataGrid.Columns>  </sdk:DataGrid>  

 



Answer: 2

Thanks for giving your valuable reply..issue has been fixed....Thanks again





No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog