Question

I am working with XamDataGrid where in i have to disable the Row:0 Cell:1 enabled all the times. to achieve this i Set AllowEdit for the field to false and then dynamically onClick of the cell for selection: i am trying to get rowindex and cell index and see if they are for first row i set enable. But that enables entire column all rows which i dont want.

DataRecord selectedRecord = (DataRecord)frameSpacingDataGrid.ActiveRecord;
        Cell selectedCell = frameSpacingDataGrid.ActiveCell;
        CellCollection cellCollection = selectedRecord.Cells;
        int indxSelectedCell = cellCollection.IndexOf(selectedCell);
        var rowIndex = selectedRecord.Index;
        if (rowIndex == 0 && indxSelectedCell == 0)
        {
            selectedCell.DataPresenter.IsEnabled= true;
        }     

Above code is written in SelectedItemsChanged event.

Also, when user deletes rows: new row:0 and cell:0 should be editable. How do i achieve this Via Triggers/XAML/ Codebehind.

Was it helpful?

Solution

I have found a work around as stated here: What i did is to set cancel for the edit event. But surely this is not a proper solution.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top