Equivalent of PropertyViewModel.Value for PropertyControl

Aug 10, 2012 at 8:58 PM

I'm looking at migrating from an older version of PropertyEditor to the latest version of PropertyControl. One of the problems I've run into but can't see how to solve is the ability to get the displayed value from the PropertyViewModel. PropertyEditor had a PropertyViewModel with a Value field I could grab the value from.

The motivation is a localized report generator. For PropertyEditor I wrote an extension method that would get the call the editor's CreatePropertyModel to get the TabViewModel, then traverse the list to create an HTML report of all the property settings. Localization came along for free. It was pretty slick.

In PropertyControl I can subclass DefaultPropertyItemFactory and override its CreateModel to get access to the IList<Tab> it creates. I can traverse the list. But there's no equivalent of Value on the PropertyItem. Any ideas on how I can get to the displayed value?

Aug 20, 2012 at 10:32 PM

Delving deeper. If I get the IList<Tab> from CreateModel, I can drill all the way down to a property's value. I could do it like this:


Where instance is the instance of the object with the properties I'm looking at.

I like being able to generate a report from the model because that way the report is organized in exactly the same order, using the same localizations, as the user interface (aside from True/False on checkboxes, which is easy to localize at this point).

Aug 21, 2012 at 1:01 PM

Yes, this should work.