ComboBox ItemTemplate does not support values of type 'Image'

Posted by Charlie on Stack Overflow See other posts from Stack Overflow or by Charlie
Published on 2012-07-16T23:56:30Z Indexed on 2012/12/07 11:04 UTC
Read the original article Hit count: 248

Filed under:
|
|
|
|

I'm trying to bind a WPF combobox to an observable collection of images. Here is my collection:

    public class AvatarPhoto
    {
        public int AvatarId { get; set; }
        public BitmapImage AvatarImage { get; set; }
    }
    public ObservableCollection<AvatarPhoto> AvailableProfilePictures { get; private set; }

Here is my xaml: enter image description here

Visual Studio gives me this compile time error: Property 'ItemTemplate' does not support values of type 'Image'.

Why is this error seen?

Thanks

Update: thanks for the answer! It solved the problem.

Now I have updated my code but I'm seeing this in the ComboBox: enter image description here

Why is it not displaying pictures correctly? In the debug window I can see my collection is correctly populated:

enter image description here

© Stack Overflow or respective owner

Related posts about wpf

Related posts about image