Editable rows based on a flag binding in sfDataGrid

I want to make few rows editable based on a flag in the model class binding in the collection. what property in the grid control should I bind it with using DataTrigger?

I tried this but does work.

<Style TargetType="syncfusion:GridCell">
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding Path=IsEnableEdit}" Value="True">
                                            <Setter Property="InputMethod.IsInputMethodEnabled" Value="True"/>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>

1 Reply

JG Jai Ganesh S Syncfusion Team August 1, 2018 01:59 AM UTC

Hi Joseph, 
 
You can achieve your requirement to edit the rows based on the property in underling collection by using CurrentCellBeginEdit event like below, 
 
this.AssociatedObject.CurrentCellBeginEdit += AssociatedObject_CurrentCellBeginEdit; 
 
private void AssociatedObject_CurrentCellBeginEdit(object sender, CurrentCellBeginEditEventArgs e) 
{ 
    var rowIndex = e.RowColumnIndex.RowIndex; 
    var recordIndex = this.AssociatedObject.ResolveToRecordIndex(rowIndex); 
 
    var record = this.AssociatedObject.View.GetRecordAt(recordIndex).Data as OrderInfo; 
 
    if (!record.IsEditing) 
        e.Cancel = true; 
} 
 
 
Regards, 
Jai Ganesh S 


Loader.
Up arrow icon