Question about AddValueConverter

Jul 22, 2010 at 11:41 PM

I'm totally lost on how the adding of the visability converter works or is supposed to work.  I must be missing something obvious at the end of a long day.

From my reading it will add a value converter and bind IsVisible to any boolean property?

So if I have a checkbox control that I want to use to indicate a status it will autobind isVisible to it?


public bool HasWarrantyInfo  {get;set;}

and then in XAML Checkbox named HasWarrantyInfo.

I would see wanting to bind IsChecked to the property but not IsVisible... ???


or is it going to add a value converter is IsVisible is bound to a bool but no converter exists? 



Jul 23, 2010 at 12:14 AM

It only adds the value converter if the DP that is being bound is VisibilityProperty and it is being bound to a bool. Since CheckBoxes' conventional property is IsCheckedProperty, the converter will not be applied.

Jul 23, 2010 at 2:02 AM

So nothing in the basic framework would do it right now. One would have to add an explicit AddElementConvention (…,”Visibility”,…)

It’s all bonus code in case I did, and also another excellent spot to add some custom stuff for some of the same converters I use over and over.