
Hi,
New user and enjoying the product so far!
I am porting a set of WPF applications over to Avalonia and am having some issues with styling the selected item in a BarComboBox. I know that this was not straightforward in WPF days but was hoping things might be simpler now..
What I am trying to achieve is actually very simple (for now), which is to show a drop-down list of colour options and have that colour shown in the selected item display. What I have tried so far: Simply using a static list of a ColorViewModel class with a single Color member, with a DataTemplate configured for the ColorViewModel data type in app.axaml which just has a border and a background. The list of ColorViewModel is bound to the ItemsSource of the BarComboBox and colours displayed in the drop-down as you might expect, but with nothing showing in the selected item.
Next I took a closer look at the samples project and tried wrapping the ColorViewModel in a class derived from BarGalleryItemViewModel<ColorViewModel>, and provided a static list of objects of this class to the BarComboBox. One change from before: the selected item started to show the ToString value of the selected ColorViewModel, so it does appear that the object is bound to the selected area but the data template is not being used.
I have also tried explicity setting the ItemTemplate directly, and using an ItemTemplateSelector - which appears to only be called for the drop-down.
Is what I am doing possible please and if so how to approach?
thanks,
Matt