windows-community-toolkitwinuidatagridcomboboxcolumn

What is the equivalent of a WPF EventSetter in WinUI3?


I want to catch the DataGridComboBoxcolumn SelectionChanged event in WinUI3 (Community Toolkit DataGrid).

In WPF, there is a solution like below by using EventSetter. But I cannot find an alternative in WinUI3.

<DataGridComboBoxColumn x:Name="Whatever">                    
     <DataGridComboBoxColumn.EditingElementStyle>
          <Style TargetType="{x:Type ComboBox}">
               <EventSetter Event="SelectionChanged" Handler="SomeSelectionChanged" />
          </Style>
     </DataGridComboBoxColumn.EditingElementStyle>           
</DataGridComboBoxColumn>

[WPF EventSetter] WPF datagrid combobox column: how to manage event of selection changed?

I want to know how to do something like WPF EventSetter in WinUI3.


Solution

  • I am afraid there is no equivalent of a WPF EventSetter in WinUI.

    But you could replace the DataGridComboBoxColumn with a DataGridTemplateColumn and explicitly add a ComboBox with an event handler to its CellEditingTemplate.