I am not able to access SelectedItem of Combobox that resides inside a button. I want to pass the SelectedItem as CommandParameter of the Button to my VM. Inside my VM I use MVVMLight's ICommand<T>.
What am I doing wrong?
<dx:SimpleButton Margin="0,5,0,5" MinWidth="160" Command="{Binding CreateNewSymbolCommand}" CommandParameter="{Binding ElementName=AssetClassInButton, Path=SelectedItem}">
<dx:SimpleButton.ContentTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical">
<TextBox Text="Choose Asset Class" Foreground="LightGreen" HorizontalAlignment="Center"/>
<dxe:ComboBoxEdit Name="AssetClassInButton" MinWidth="150" IsTextEditable="False" ItemsSource="{Binding Source={StaticResource AssetClassEnumValues}}"/>
</StackPanel>
</DataTemplate>
</dx:SimpleButton.ContentTemplate>
</dx:SimpleButton>
Get rid of the ContentTemplate\DataTemplate - you dont need it as you are setting the content of the Button directly and not the template of a reoccurring element.