I’m trying to initiate an action based on a selection in a ComboBox I created in WPF. I’m pretty new to WPF and C#. My ComboBox has
<ComboBox x:Name="SampleComboBox" Width="100" ItemsSource="{Binding Path=NameList}" />
Where NameList is a List property in the code behind. Now I want to generate an action based on the selection in the ComboBox and not sure where to start. Thanks.
You’ll need to add a method to handle the
SelectionChangedevent. You can either do this in code:or in XAML:
where you can then do something with the selected items: