StandardValues Attibute

Grids for WPF Forum

Posted 14 years ago by Vadim Cherkashin - IA&E SB RAS

Can you made new property Attribute - StandardValuesAttibute?
for set StandardValues without xaml

public class Properties
  [Editor(typeof(ComboBoxPropertyEditor), typeof(PropertyEditor))]
  public object Property { set; get; } }

Comments (2)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Vadim,

When it comes to attributes like that, we prefer to leverage the attributes provided by .Net. Most customers would not want to reference our assemblies from their "data" objects.

But, that is probably something you could accomplish using custom code. You would need to implement a custom TypeConverter that overrides GetStandardValues(ITypeDescriptorContext) , GetStandardValuesExclusive(ITypeDescriptorContext), and GetStandardValuesSupported(ITypeDescriptorContext). In those methods, you'd search for your custom attribute and return the appropriate values. You could then use the [TypeConverter(typeof(CustomTypeConverter))] on the properties. You should be able to cast the Context to a IPropertyDataAcessor or one of the concrete types to get the appropriate attributes.

I'm not sure you'd be able to define a list of objects in that manner though, as attributes need constant values.

Actipro Software Support

Posted 14 years ago by Vadim Cherkashin - IA&E SB RAS
I am andestend.
Sanks for reply.
P.S. Of couse Attribute has array of constant values.
The latest build of this product (v24.1.2) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.