Hi,
We want to add multiple Images with name in XAMComboEditor.
Like: ImageName- Image as kind of that.
Can u please help us, how we can add multiple images in combo box. We are following MVVM pattern.
Your help would be appreciate.
Thanks.
Hello Kanwar,
In order to display images inside the XamComboEditor for every item, I can suggest you create a BitmapImage type property for every DataItem in the ViewModel class and by using the ItemTemplate property of the editor, you will be able to bind for it.
For example:
<ig:XamComboEditor.ItemTemplate> <DataTemplate> <Grid Height="60"> <Grid.ColumnDefinitions> <ColumnDefinition Width="80" /> <ColumnDefinition Width="80" /> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <TextBlock Text="{Binding Path=Name}" Margin="2" Grid.Column="0" VerticalAlignment="Center" /> <TextBlock Text="{Binding Path=Id}" Margin="2" Grid.Column="1" VerticalAlignment="Center" /> <Image Source="{Binding Path=Image}" Margin="2" Width="50" Height="50" Stretch="Uniform" Grid.Column="2" /> <Image Source="{Binding Path=SecondImage}" Margin="2" Width="50" Height="50" Stretch="Uniform" Grid.Column="3" /> </Grid> </DataTemplate></ig:XamComboEditor.ItemTemplate>
Depending on the behavior you would like to achieve, you can always alter the DataItem class and adjust it accordingly. For more detailed information on this approach, you can take a look at the "xamComboEditor > Display > Using DataTemplates in Combo Editor" sample from our WPF Samples Browser.
I have attached a sample application that demonstrates the approach from above.
If you have any questions, please let me know.