Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
145761 | Jul 7,2019 11:48 PM UTC | Jul 12,2019 01:38 PM UTC | Xamarin.Forms | 5 |
![]() |
Tags: SfDataGrid |
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.
}
}
}
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.