Ghost1372

everything can be handy

EnumValuesExtension

Assuming we had an Animal enum type and we wanted the user to pick one of the available names, here is the XAML syntax that allows us to create a ComboBox and display all Animal values, directly from XAML and with no code-behind:

1
2
3
4
5
6
<ComboBox
xmlns:wuc="using:WinUICommunity"
xmlns:enums="using:MyApplication.Enums"
ItemsSource="{wuc:EnumValues Type=enums:Animal}"
SelectedIndex="0"/>

WinUICommunity

Demo

you can run demo and see this feature.

0%