tags:

views:

27

answers:

1

Hi,

I have a ComboBox with a list of objects bound to it. Currently i have the items templated so they show only the property Class.Name. so the ComboBox is full of Class.Name However i am required to give the user the option to display the property Class.Description instead. If it were just that easy i would be fine, but they want the option to switch back and forth between them at runtime.

Any ideas?

+1  A: 

You can probably do this directly in WPF.

I would alter the business objects to include an additional Readonly property, something like, DisplayTextProperty

Public ReadOnly Property DisplayTextProperty()
    Get
        If ShowDescription Then
            Return Description
        Else
            Return Name
        End If
    End Get
End Property

I have done this in a few places now and it works great.

David Steele
I was hoping there was some way of dynamically binding it, but hey, this works a charm! thanks mate
TerrorAustralis