I am trying to display an image and a textblock in a radcombo box control nested within a radtreeview. The radcombox's itemssource is set to value that contains a text property and bitmapimage. I set the source for the image to the bitmapimage stored in the radcombox's itemsource. When the radcombox is expanded and displayed the text displays but the image does not display.
Here is a sample of the radcomboxes item templates:
<telerik:RadComboBox x:Name="rcbImages" VerticalAlignment="Center" IsEnabled="False" SelectedValue="{Binding Condition}" Visibility="Hidden" telerik:StyleManager.Theme="Office_Blue" Width="150" Grid.Column="5">
<telerik:RadComboBox.SelectionBoxTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="40" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="1" Text="{Binding Key.Description}" />
<Image Grid.Column="0" Source="{Binding Value}">
</Image>
</Grid>
</DataTemplate>
</telerik:RadComboBox.SelectionBoxTemplate>
<telerik:RadComboBox.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="40" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="1" Text="{Binding Description}" />
<Image Grid.Column="0" Source="{Binding Value}" Initialized="Image_Initialized" Loaded="Image_Loaded" ImageFailed="Image_ImageFailed">
</Image>
</Grid>
</DataTemplate>
</telerik:RadComboBox.ItemTemplate>
</telerik:RadComboBox>
And here is a sample of the code to get the image and the setting of the itemsource for the combox:
BitmapImage bitimage = new BitmapImage();
bitimage.BeginInit();
bitimage.StreamSource =
new System.IO.MemoryStream(images[i].ImageValue);
bitimage.EndInit();
images[i].Image = bitimage;
Dictionary<ImageType, BitmapImage> dicImages = new Dictionary<ImageType, BitmapImage>();
for (int i = 0; i < images.Count; i++)
{
dicImages.Add(images[i], images[i].Image);
}
combo.SelectedValuePath =
"Key.ImageKey";
combo.ItemsSource = dicImages;
combo.IsEnabled =
true;
Any help would be greatly appreciated.
Thanks,
Jonathan