I need my ComboBox's first item to be selected when loaded.
XAML:
<ComboBox x:Name="CreateLstBoxFormat" HorizontalAlignment="Left" Margin="27,334,0,0" IsSynchronizedWithCurrentItem="True" VerticalAlignment="Top" Width="90" SelectedValuePath="Content" SelectedIndex="0" SelectedItem="{Binding CreateFormatSelectedItem, Mode=TwoWay}">
<ComboBox.ItemsSource>
<x:Array xmlns:sys="clr-namespace:System;assembly=mscorlib" Type="{x:Type sys:String}">
<sys:String>MXF</sys:String>
<sys:String>Quicktime MOV</sys:String>
<sys:String>DPX</sys:String>
<sys:String>TIF</sys:String>
<sys:String>TGA</sys:String>
<sys:String>CIN</sys:String>
<sys:String>EXR</sys:String>
</x:Array>
</ComboBox.ItemsSource>
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding Create_FormatSelectCommand}"
CommandParameter="{Binding YourCommandParameter}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</ComboBox>
I expected MXF
to be initially selected in the combo box on opening of the window.
I'm using the SelectedItem
property to fire an event when the selected item has changed.