forum

home / developersection / forums / access a property of ienumerable

Access a property of IEnumerable

Jayden Bell 2165 28-Jan-2014

I have a custom class for a combobox having following properties:

public IEnumerable<object> ItemsSource
{
    get { return (IEnumerable<object>)GetValue(ItemsSourceProperty); }
    set
    {
        SetValue(ItemsSourceProperty, value);
    }
}
public string DisplayMemberPath
{
    get { return (string)GetValue(DisplayMemberPathProperty); }
    set { SetValue(DisplayMemberPathProperty, value); }
}

where ItemsSourceProperty,DisplayMemberPathProperty are the dependency properties already registered.

Now if ItemSource has a list of custom objects :{id int, name string}. and DisplayMemberPath has value:'name' or 'id'. How can I access 'name' or 'id' properties of my object ?


c# c# 
Updated on 29-Jan-2014
Jayden Bell

Other


Message
Can you answer this question?

Answer

1 Answers

Liked By