public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
private void DataGrid_QueryRowDragging(object sender, QueryRowDraggingEventArgs e)
{
if (e.Reason == QueryRowDraggingReason.DragEnded)
{
if(e.RowData is Group)
{
var rowDragView = dataGrid.GetType().GetProperty("RowDragView", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(dataGrid) as Syncfusion.SfDataGrid.XForms.BorderView;
var Label= ((rowDragView.Content as Grid).Children[0]);
var text = Label.GetType().GetProperty("Text").GetValue(Label).ToString();
if(text != "Cancel drop")
{
//// Customize based on the requirement.
}
}
}
}
}
|
public int LastIndex
{
get
{
return (dataGrid.GroupColumnDescriptions.Count > 0
? this.dataGrid.View.TopLevelGroup.DisplayElements.Count
: this.dataGrid.View.Records.Count);
}
}
private void DataGrid_QueryRowDragging(object sender, QueryRowDraggingEventArgs e)
{
if (e.Reason == QueryRowDraggingReason.Dragging)
{
var totalHeight = dataGrid.RowColumnIndexToPoint(newRowColumnIndex(this.LastIndex, 0)).Y + this.dataGrid.RowHeight;
if (Math.Ceiling(e.Position.Y + (dataGrid.RowHeight * 0.45))
> totalHeight && e.To == LastIndex)
{
// Will hit if RowDragView move below the last row.
}
}
}
|