Can I use an IValueConverter?

2 posts, 0 answers
  1. Chandler
    Chandler avatar
    1 posts
    Member since:
    Feb 2009

    Posted 24 Feb 2009 Link to this post

    Is it possible to use an IValueConverter with DisplayMemberPath?  For instance I have and object hierarcy as follows

    class Item
        public ObservableCollection<ItemImage> Images {get; set;}

    class ItemImage
        public ItemMedia MediaUrl {get; set;}
        public string Type {get; set;}

    class ItemMedia
        public string High {get; set;}
        public string Mid {get; set;}
        public string Low {get; set;}

    So I want to assign the coverflow's ItemSource to an ObservableCollection<Item>.  As you can see each Item can have more than one image associated with it; I would want the first one with a Type == "Full".  Then I would use the Mid proprty (which is basically the URI to the image).  The problem comes with trying to grab the correct image from the ObservableCollection.  Normally on an ItemsControl I would use a Converter to run a Linq query on that ObservableCollection and return the Mid.  I can't quite figure out how to do the equivalent with the coverflow control...perhaps I'm a little brain dead today.

  2. Miroslav Nedyalkov
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 25 Feb 2009 Link to this post

    Hello Chandler,

    This functionality is not supported by the CoverFlow control at the moment. You can wrap your hierarchy with an addiitonal class and set a collection of wrapped items as ItemsSource instead of directly setting your collection to the CoverFlow. For example:

    class WrappedItemImage : ItemImage 
        public string WrappedMediaUrl 
                //You can replace this code with use of value converter. 
                return this.MediaUrl.Mid; 

    Hope this helps.

    Miroslav Nedyalkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top