barriovolvo
barriovolvo

Reputation:

How do I databind a control in an item template to the item itself, and not one of its properties?

I've got a WPF ListBox that's databound to an ObservableCollection of type Employee. In the ItemTemplate, I'm binding the content of controls to various properties, as normal. But for one of the controls in the template, I've made a custom converter class that it uses, and I'd like the converter to get passed in the Employee object itself as the value, as opposed to one of its' properties. Is this easy to do? I don't want to resort to something like adding a read only property to Employee whose getter just says return this.

Thanks in advance!

Upvotes: 1

Views: 82

Answers (1)

David Schmitt
David Schmitt

Reputation: 59346

Just use

{Binding}

or

{Binding Converter={...}}

i.e. without a Path.

Upvotes: 2

Related Questions