I have several cases where I have a property that I want to declare readonly, but also give some explanation of how it is calculated/set using the [Display(Description="")] attribute. I would like to do this in the metadata, if possible, rather than override in the dataform itself.
Here's an example:
[Display(Description = "Total number of travel hours, calculated as total hrs worked - actual working hrs this month")]
public decimal TravelHours
{
get
{
return this.TotalHrsWorked - this.ActualWorkedHours;
}
}
This won't show the description as a DescriptionViewer when I bind to this property in a DataForm & DataField.
It seems like when I set the [ReadOnly] attribute it hides the DescriptionViewer, and even setting DescriptionViewerVisibility=Visible in the dataform xaml still doesn't change it. Also, any calculated properties (no setter) seem to have this attribute enforced by default. It's kind of annoying, because these are the ones I really want to show the descriptionviewer for.
The only way around it I have found so far is to make the property not readonly and add a dummy setter (for calculated properties). That seems like a kludge.
Is there any way to show the dataform/datafield descriptionviewer on readonly properties?