<datagrid:SfDataGrid x:Name="dataGrid" Padding="0,20" GridTapped="Handle_GridTapped" HorizontalOptions="CenterAndExpand" AutoGenerateColumns="false" SelectionMode="Single" BackgroundColor="Transparent" QueryRowStyle="DataGrid_QueryRowStyle">
datagrid:SfDataGrid>
dataGrid.CurrentCellActivating += DataGrid_CurrentCellActivating;
private void DataGrid_CurrentCellActivating(object sender, CurrentCellActivatingEventArgs e) {
if (e.CurrentRowColumnIndex.RowIndex == 1)
{
e.Cancel = true;
}
} |
private void DataGrid_GridTapped(object sender, GridTappedEventArgs e)
{
if ((e.RowData as OrderInfo).Gender != "Female")
{
// here you can write business logic
}
}
private void DataGrid_CurrentCellActivating(object sender, CurrentCellActivatingEventArgs e)
{
int rowIndex = this.dataGrid.ResolveToRecordIndex(e.CurrentRowColumnIndex.RowIndex);
……
else
{
//for non grouping cases
var record = this.dataGrid.View.Records[rowIndex];
if ((record.Data as OrderInfo).Gender == "Female")
{
e.Cancel = true;
}
} ….. } |
private void DataGrid_GridTapped(object sender, GridTappedEventArgs e)
{
if ((e.RowData as OrderInfo).Gender != "Female")
{
// here you can write bussiness logic
}
}
private void DataGrid_CurrentCellActivating(object sender, CurrentCellActivatingEventArgs e) {
int rowIndex = this.dataGrid.ResolveToRecordIndex(e.CurrentRowColumnIndex.RowIndex);
if (dataGrid.GroupColumnDescriptions.Count > 0)
{
// For grouping cases
var record = this.dataGrid.View.TopLevelGroup.DisplayElements[rowIndex];
if (record is RecordEntry)
{
var recordEntry = record as RecordEntry;
var data = recordEntry.Data;
if ((data as OrderInfo).Gender == "Female")
{
e.Cancel = true;
}
}
} … } |