diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/DataGrid/DataGridPage.xaml.cs b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/DataGrid/DataGridPage.xaml.cs index 122526b47..1b2c55a48 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/DataGrid/DataGridPage.xaml.cs +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/DataGrid/DataGridPage.xaml.cs @@ -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;