In Wpf DataGrid, I would like to make few cells readonly based on some other factors. Finally I get a Dictionary which has 1,2 which is Row 1 column 2 should be read only. How to achieve this in code.
EDIT: The below is the datagrid. I would like to make second row, first column cell value 2,00 to be readonly in code-behind. I cant bind any value in the template, because I am not uisng cell value for cell readable.
I prefer better option would be while loading the row, uisng rowIndex and col index point the cell, then apply style as "IsEnabled=FAlse".Is it possible?????????
grd_elements.Rows not available for me. Only grd_elements.Items(0) always refer to the class, am binding the rows dynamically and grd_elements.Items(0).cells(1).visibility=Visibility.Collapsed throw an error say the property of the class not found.
Private Sub Grd_elements_LoadingRow(sender As Object, e As DataGridRowEventArgs) Handles grd_elements.LoadingRow
Dim oDatagridRow As cls_PmZeile = CType(e.Row.Item, cls_PmZeile)
For Each column As DataGridColumn In grd_elements.Columns
If column.DisplayIndex = 0 Then Continue For
grd_elements.Columns(column.DisplayIndex).GetCellContent(e.Row).Visibility = Visibility.Collapsed
Next
error cant find the object instance in the above code:(
Target is, to loop through the datagridRow while loading each row in loading row event, and set the cell Visibility as Collapsed.