Hi guys,
I have another problem using the XamComboEditor for WPF (v13.1) used in a MVVM project.ItemsSource of the XamComboEditor is bound to an IList of enum values. In the editor the values are not displayed as they are but modified by converters to display a name and an icon, depending on the selected enum value. Using a template I can modify the dropdown area of the combo editor to show the items as described above. But unfortunately this works for the items displayed in the dropdown area only. If I select an item and the combo editor lost the focus, the item in den (collapsed) combo editor switches to the enum value and does not keep it´s "style" displayed in the dropdown. I guess my template works for the dropdown section only but not for the "text box" part of the XamComboEditor. Is there a way to apply a template to the "text box" part of the combo editor as well?It is currently not possible to change the view model, so I´m looking for a solution that works with the existing view model.
Here is the code I´m using for the XamComboEditor:
<igEditors:XamComboEditor Margin="0 2 10 4" Grid.Row="2" Grid.Column="1" ItemsSource="{Binding Path=TypeFilters}" Value="{Binding Path=SelectedTypeFilter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEditable="False" DropDownResizeMode="None"> <igEditors:XamComboEditor.ComboBoxStyle> <Style TargetType="ComboBox"> <Setter Property="ItemTemplate"> <Setter.Value> <DataTemplate> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> <Image Source="{Binding Path=., Converter={StaticResource dataTypeToIconConverter}}" Stretch="Fill" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0 2 4 2" Width="16" Height="16"/> <TextBlock Text="{Binding Path=., Converter={StaticResource dataTypeToStringConverter}}" /> </StackPanel> </DataTemplate> </Setter.Value> </Setter> </Style> </igEditors:XamComboEditor.ComboBoxStyle> </igEditors:XamComboEditor>
I hope this makes my problem clear. I´m still pretty new to the whole thing ;)
Daniel
Hello Daniel,
I will look forward for your reply.
Hi Stefan,
like many times before I have currently no time to work on this issue. Hope that I can continue with this in a week or so.
Sorry...
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.
I have been looking into the steps yo udescribed and the screenshots you attached and I wasn't able to reproduce your behavior on my side. I modified the sample I sent you before, so now there is a Button, so I can change the focus from the XamComboEditor to the Button, but it still worsk as expected. Could you please double check my sample and see whether you have missed something while implementing the logic in your solution. Also if you are able to modify my sample, so it reproduces your behavior and send it back to me, I will be glad to assist you further with this.
Looking forward for your reply.
Thanks Stefan,
this is pretty much the same I came up with after hours of trying... and it does not work.It works as long as you keep the combo focused but if the combo has lost the focus it just displays a part of the selected item and not all information of the selected item.
Maybe this image describes my problem:
1. screenshot:- combo is open (dropdown visible), no item selected. All items are shown as expected, both properties of the item (number and text) are shown.2. screenshot:- item "1 AB" selected. Item is shown as expected. Combo has still focus. Both properties of the item (number and text) are shown.
3. screenshot:- item "1 AB" still selected, but combo does not have the focus. Item is not shown as expected, only one property of the object (the text "AB") is shown.
I guess the problem is caused by different behavior of the controls the XamComboEditor is composed of. It works fine for the "dropdown part" whichobviously is derived from Microsofts ComboBox but it does not work for the "textbox part" of the XamComboEditor.I have no idea how to solve this. And - sorry - I don´t think that this is possible with that control at all.