This is a migrated thread and some comments may be shown as answers.

Can I use an IValueConverter?

1 Answer 76 Views
CoverFlow
This is a migrated thread and some comments may be shown as answers.
Chandler
Top achievements
Rank 1
Chandler asked on 24 Feb 2009, 03:24 PM
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.

Chandler

1 Answer, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 25 Feb 2009, 11:47 AM
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 
    {  
        get  
        {  
            //You can replace this code with use of value converter. 
            return this.MediaUrl.Mid; 
        } 
    } 
}

Hope this helps.

Greetings,
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.
Tags
CoverFlow
Asked by
Chandler
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
Share this question
or