I would like to invoke a command when the SelectedItemChanged event is fired on a XamComboEditor.
I can't seem to figure out how to do it.
The code that I am using that does not work:
<igDP:Field Width="auto" Name="DocumentType" Label="Document Type" > <igDP:Field.Settings> <igDP:FieldSettings EditorType="{x:Type igEditors:XamComboEditor}" > <i:Interaction.Triggers> <i:EventTrigger EventName="SelectedItemChanged"> <i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type igDP:XamDataGrid}}, Path=SaveCommand}"/> </i:EventTrigger> </i:Interaction.Triggers> <igDP:FieldSettings.EditorStyle> <Style TargetType="{x:Type igEditors:XamComboEditor}"> <Setter Property="ItemsSource" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type igDP:XamDataGrid}}, Path=DataContext.DocumentTypeLookup, Mode=TwoWay, ValidatesOnExceptions=True, ValidatesOnDataErrors=True}"/> <Setter Property="DropDownButtonDisplayMode" Value="MouseOver"/> </Style> </igDP:FieldSettings.EditorStyle>
</igDP:FieldSettings> </igDP:Field.Settings> </igDP:Field>
</igDP:FieldSettings> </igDP:Field.Settings>
</igDP:Field>
Hello,
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
If the above suggestion helped you solve your issue please verify the thread as answered so other users may take better advantage of it.
Hi,
I am using XamComboEditor as a stand-alone control and not part of the grid.
I have a similar situation where I want to bind the SelectedItemChanged to ViewModel. How can I do it?
Any sample code will help.
Thank You.
Handling in the ViewModel's Set method did it. Thanks.
Hello jshuklaPamli,
I have been looking into your enquiry and there is usually no one approach for this, but dozens. You can do it with Interactions, Behaviors, RelayCommands, the latest one I stumbled upon was using the Expression Blend Samples library from ExpressionBlend and I am sure there are many more. For those there are ton of blogs that would describe the approaches better than me, however for your particular scenario I can suggest you simply create a VMSelectedItem property in your ViewModel, that you can bind to the SelectedItem of the XamComboEditor and use the VMSelectedItem‘s set method to get notified when the item is changed.
Hope this helps.