Add PreparingCellForEdit example to open CalendarDropDown on 2nd click

This commit is contained in:
michael-hawker 2021-09-02 16:27:14 -07:00
Родитель 99d587f939
Коммит e89cac670b
1 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -41,6 +41,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
dataGrid.Sorting += DataGrid_Sorting;
dataGrid.LoadingRowGroup += DataGrid_LoadingRowGroup;
dataGrid.ItemsSource = await viewModel.GetDataAsync();
dataGrid.PreparingCellForEdit += DataGrid_PreparingCellForEdit;
var comboBoxColumn = dataGrid.Columns.FirstOrDefault(x => x.Tag?.Equals("Mountain") == true) as DataGridComboBoxColumn;
if (comboBoxColumn != null)
@ -111,6 +112,15 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
}
}
private void DataGrid_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
{
if (e.Column is DataGridTemplateColumn column && (string)column?.Tag == "First_ascent" &&
e.EditingElement is CalendarDatePicker calendar)
{
calendar.IsCalendarOpen = true;
}
}
private void DataGrid_LoadingRowGroup(object sender, DataGridRowGroupHeaderEventArgs e)
{
ICollectionViewGroup group = e.RowGroupHeader.CollectionViewGroup;