Is this supported?
I've tried without any luck.. the editor is populated with data as it should (using ObservableCollection<dynamic> as ItemsSource), but the correct DataTemplate for the relevant data type is not shown, just the default included in the control:
<UserControl.Resources> <DataTemplate DataType="ctl:ProductType1"> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding Path=PartNumber}"/> <TextBlock Text=" - "/> <TextBlock Text="{Binding Path=RevisionName}"/> </StackPanel> </DataTemplate> <DataTemplate DataType="ctl:ProductType2"> <StackPanel Orientation="Vertical"> <TextBlock Text="{Binding Path=PartNumber}" FontWeight="Bold"/> <TextBlock Text="{Binding Path=Name}"/> </StackPanel> </DataTemplate> </UserControl.Resources>
<ig:XamComboEditor TabIndex="1" x:Name="EditorNewPartNumber" Grid.Column="1" Grid.Row="4" Margin="0 5 0 0" FontFamily="Segoe UI" FontSize="13" ItemsSource="{Binding Source={StaticResource ViewModelLocator}, Path=ViewModel.Products}" DisplayMemberPath="PartNumber" SelectedItem="{Binding Source={StaticResource ViewModelLocator}, Path=ViewModel.ProductItem, Mode=TwoWay}" CustomValueEnteredAction="{Binding Source={StaticResource ViewModelLocator}, Path=ViewModel.ProductEnteredAction}" AutoComplete="{Binding Source={StaticResource ViewModelLocator}, Path=ViewModel.IsProductEnabled}" Visibility="{Binding Source={StaticResource ViewModelLocator}, Path=ViewModel.IsProductRequired, Converter={StaticResource BoolToVisibilityConverter}}" KeyUp="EditorNewPartNumber_KeyUp"> </ig:XamComboEditor>
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.
Thank you for your post. I have been looking into it and I can say that because of the XamComboEditor’s DisplayMemberPath a default ItemsTemplate is created. Even if you don’t set it, it will have a default value set to the ItemsSource’s first Property, so I can suggest you define an ItemTempalte like this:
<ig:XamComboEditor.ItemTemplate> <DataTemplate> <ContentControl Content="{Binding}"/> </DataTemplate> </ig:XamComboEditor.ItemTemplate>
so the implicit DataTemplates could work. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.