向右或向左滑动时如何执行功能? Xamarin Android 同步融合
How to execute a function when sliding right or left? Xamarin Android Syncfusion
今天下载了syncfusion工具,在滑动的时候成功的使用了data grid属性,现在想知道左右滑动时如何执行一个函数,有大佬能给我一个吗例如?
这是我的代码
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.CompartirVale);
btnDel = FindViewById<Button>(Resource.Id.btnDelShared);
btnAl = FindViewById<Button>(Resource.Id.btnAlShared);
btnBuscarRelacionPago = FindViewById<Button>(Resource.Id.btnBuscarValeShared);
//
RelativeLayout layout = (RelativeLayout)FindViewById(Resource.Id.RelativeCompartirVale);
imgPDF = FindViewById<ImageView>(Resource.Id.imgPDFShared);
imgwhats = FindViewById<ImageView>(Resource.Id.imgWhatsApp);
dataGrid = new SfDataGrid(BaseContext);
layout.AddView(dataGrid);
this.dataGrid.AllowSwiping = true;
OrderInfoRepository viewModel = new OrderInfoRepository();
dataGrid.ItemsSource = viewModel.OrderInfoCollection;
ActionBar.SetDisplayHomeAsUpEnabled(true);
//
SwipeView leftSwipeView = new SwipeView(BaseContext);
SwipeView rightSwipeView = new SwipeView(BaseContext);
LinearLayout editView = new LinearLayout(BaseContext);
LinearLayout deleteView = new LinearLayout(BaseContext);
ImageView editImage = new ImageView(BaseContext);
editImage.SetImageResource(Resource.Drawable.whatsapp);
editImage.SetBackgroundColor(Color.ParseColor("#FFFFFF"));
ImageView deleteImage = new ImageView(BaseContext);
deleteImage.SetImageResource(Resource.Drawable.gmail);
deleteImage.SetBackgroundColor(Color.ParseColor("#FFFFFF"));
editView.AddView(editImage, ViewGroup.LayoutParams.MatchParent, (int)dataGrid.RowHeight);
//editView.AddView(edit, ViewGroup.LayoutParams.MatchParent, (int)dataGrid.RowHeight);
deleteView.AddView(deleteImage, ViewGroup.LayoutParams.MatchParent, (int)dataGrid.RowHeight);
//deleteView.AddView(delete, ViewGroup.LayoutParams.MatchParent, (int)dataGrid.RowHeight);
leftSwipeView.AddView(editView, dataGrid.MaxSwipeOffset, (int)dataGrid.RowHeight);
rightSwipeView.AddView(deleteView, dataGrid.MaxSwipeOffset, (int)dataGrid.RowHeight);
dataGrid.LeftSwipeView = leftSwipeView;
dataGrid.RightSwipeView = rightSwipeView;
//
}
当我向右或向左滑动线条时执行什么事件?
在SfDataGrid中,滑动时会引发三个事件。如果您开始滑动过程,则会引发 SwipeStarted 事件。如果滑动正在进行中,则会引发滑动事件。如果滑动操作结束,则会引发 SwipeEnded 事件。请参考下面的代码片段,
dataGrid.SwipeStarted += DataGrid_SwipeStarted;
dataGrid.Swiping += DataGrid_Swiping;
dataGrid.SwipeEnded += DataGrid_SwipeEnded;
//Swipe ended event will fire once you the swiping process is ended
private void DataGrid_SwipeEnded(object sender, SwipeEndedEventArgs e)
{
}
//Swiping event will fire when the swiping process is in progress
private void DataGrid_Swiping(object sender, SwipingEventArgs e)
{
}
//Swipe started event will fire once you started the swiping process
private void DataGrid_SwipeStarted(object sender, SwipeStartedEventArgs e)
{
}
请参考下面的UG link了解更多关于SfDataGrid滑动功能和它的事件,
UG link: https://help.syncfusion.com/xamarin-android/sfdatagrid/swiping
此外,我们还准备了一个使用滑动功能的示例,您可以从下面下载相同的link,
示例 link:http://www.syncfusion.com/downloads/support/forum/132930/ze/Sample1951506069
此致,
迪瓦卡
今天下载了syncfusion工具,在滑动的时候成功的使用了data grid属性,现在想知道左右滑动时如何执行一个函数,有大佬能给我一个吗例如?
这是我的代码
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.CompartirVale);
btnDel = FindViewById<Button>(Resource.Id.btnDelShared);
btnAl = FindViewById<Button>(Resource.Id.btnAlShared);
btnBuscarRelacionPago = FindViewById<Button>(Resource.Id.btnBuscarValeShared);
//
RelativeLayout layout = (RelativeLayout)FindViewById(Resource.Id.RelativeCompartirVale);
imgPDF = FindViewById<ImageView>(Resource.Id.imgPDFShared);
imgwhats = FindViewById<ImageView>(Resource.Id.imgWhatsApp);
dataGrid = new SfDataGrid(BaseContext);
layout.AddView(dataGrid);
this.dataGrid.AllowSwiping = true;
OrderInfoRepository viewModel = new OrderInfoRepository();
dataGrid.ItemsSource = viewModel.OrderInfoCollection;
ActionBar.SetDisplayHomeAsUpEnabled(true);
//
SwipeView leftSwipeView = new SwipeView(BaseContext);
SwipeView rightSwipeView = new SwipeView(BaseContext);
LinearLayout editView = new LinearLayout(BaseContext);
LinearLayout deleteView = new LinearLayout(BaseContext);
ImageView editImage = new ImageView(BaseContext);
editImage.SetImageResource(Resource.Drawable.whatsapp);
editImage.SetBackgroundColor(Color.ParseColor("#FFFFFF"));
ImageView deleteImage = new ImageView(BaseContext);
deleteImage.SetImageResource(Resource.Drawable.gmail);
deleteImage.SetBackgroundColor(Color.ParseColor("#FFFFFF"));
editView.AddView(editImage, ViewGroup.LayoutParams.MatchParent, (int)dataGrid.RowHeight);
//editView.AddView(edit, ViewGroup.LayoutParams.MatchParent, (int)dataGrid.RowHeight);
deleteView.AddView(deleteImage, ViewGroup.LayoutParams.MatchParent, (int)dataGrid.RowHeight);
//deleteView.AddView(delete, ViewGroup.LayoutParams.MatchParent, (int)dataGrid.RowHeight);
leftSwipeView.AddView(editView, dataGrid.MaxSwipeOffset, (int)dataGrid.RowHeight);
rightSwipeView.AddView(deleteView, dataGrid.MaxSwipeOffset, (int)dataGrid.RowHeight);
dataGrid.LeftSwipeView = leftSwipeView;
dataGrid.RightSwipeView = rightSwipeView;
//
}
当我向右或向左滑动线条时执行什么事件?
在SfDataGrid中,滑动时会引发三个事件。如果您开始滑动过程,则会引发 SwipeStarted 事件。如果滑动正在进行中,则会引发滑动事件。如果滑动操作结束,则会引发 SwipeEnded 事件。请参考下面的代码片段,
dataGrid.SwipeStarted += DataGrid_SwipeStarted;
dataGrid.Swiping += DataGrid_Swiping;
dataGrid.SwipeEnded += DataGrid_SwipeEnded;
//Swipe ended event will fire once you the swiping process is ended
private void DataGrid_SwipeEnded(object sender, SwipeEndedEventArgs e)
{
}
//Swiping event will fire when the swiping process is in progress
private void DataGrid_Swiping(object sender, SwipingEventArgs e)
{
}
//Swipe started event will fire once you started the swiping process
private void DataGrid_SwipeStarted(object sender, SwipeStartedEventArgs e)
{
}
请参考下面的UG link了解更多关于SfDataGrid滑动功能和它的事件, UG link: https://help.syncfusion.com/xamarin-android/sfdatagrid/swiping
此外,我们还准备了一个使用滑动功能的示例,您可以从下面下载相同的link, 示例 link:http://www.syncfusion.com/downloads/support/forum/132930/ze/Sample1951506069
此致, 迪瓦卡