njsokalski avatar image
0 Votes"
njsokalski asked ·

Passing Current Control to IValueConverter

I have an ItemsControl, and in several of the Binding(s) in the DataTemplate I use an IValueConverter. In several of these IValueConverter(s) I need to access the control in which I am doing the Binding (for example, if I am binding the Tag property, I need to access the control that contains that Tag property). My first idea was to pass the control as the ConverterParameter, but I could not figure out how to do this. What can I do to access the containing control from within an IValueConverter? Thanks.

· 1
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Currently, Converter can not directly pass element in ConverterParameter. In general we use it to pass string format. There is a similar thread you can refer to it. You could try to bind your listView with the property of the Converter and pass your control name as the ConverterParameter. In the Converter, you could based on the listView to find your control.

0 Votes 0 · ·

0 Answers