private void DataGridPedidos_Sorting(object sender, Microsoft.Toolkit.Uwp.UI.Controls.DataGridColumnEventArgs e) { if (e.Column.SortDirection == null || e.Column.SortDirection == Microsoft.Toolkit.Uwp.UI.Controls.DataGridSortDirection.Ascending) { //Use the Tag property to pass the bound column name for the sorting implementation if (e.Column.Tag.ToString() == "Range") { //Implement ascending sort on the column "Range" using LINQ dataGridPedidos.ItemsSource = new ObservableCollection <Product>(from item in pedidos orderby item.ProductID ascending select item); } } }
private void UserListView_Sorting(object sender, Microsoft.Toolkit.Uwp.UI.Controls.DataGridColumnEventArgs e) { if (order.Equals("ASC")) { Debug.WriteLine(order); mainPage.UserList = mainPage.UserList.OrderBy(o => o.FirstName).ToList(); UserListView.ItemsSource = mainPage.UserList; order = "DESC"; } else { Debug.WriteLine(order); mainPage.UserList = mainPage.UserList.OrderByDescending(o => o.FirstName).ToList(); UserListView.ItemsSource = mainPage.UserList; order = "ASC"; } }
private async void DataGrid_Sorting(object sender, Microsoft.Toolkit.Uwp.UI.Controls.DataGridColumnEventArgs e) { await OperateBinding((vm) => { if (vm.Item == null) { return(Task.CompletedTask); } if (vm.Item.Order == null) { vm.Item.Order = new ViewModels.FileItemViewModel.OrderStatus().GetShiftedBasicOrder(e.Column.Tag as string); } else { vm.Item.Order = vm.Item.Order.GetShiftedBasicOrder(e.Column.Tag as string); } return(Task.CompletedTask); }); }
private async void dataGrid3_Sorting(object sender, Microsoft.Toolkit.Uwp.UI.Controls.DataGridColumnEventArgs e) { MessageDialog messageDialog = new MessageDialog("fff"); await messageDialog.ShowAsync(); }