This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi
Is it possible to change how properties are edited by using an attribute on the property field. I would like to put say a [Slider] attribute on a int property of a class and maybe a [Select] attribute for a different int property.
Is this possible with the WPF Property Grid?
Is their a list of available attributes?
Thanks
Johan
|
|
|
Hi Johan, We don't directly support this because we're a bit dubious about putting presentation attributes on business objects. We prefer this to be specified in the presentation layer (usually in the XAML) using the PropertyEditor tag. However it would be possible to implement an attribute-based approach using a combination of a smart editor (to look for the attribute(s)) with a smart template (that knew how to interpret the attribute(s)). See http://www.mindscape.co.nz/blog/index.php/2008/12/11/smart-editors-for-the-wpf-property-grid-meet-smart-templates/ for details -- this is written in terms of specifying a popup dialog via an attribute, but it could be adapted to work for in-place editors instead (see the second note at the end of the article). We'd be happy to provide further guidance on this if required. |
|
|
Thanks, that is very helpful.
|
|