StandardValues Attibute

Grids for WPF Forum

Posted 9 years ago by Vadim Cherkashin - IA&E SB RAS
Avatar
Hi,

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

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

Comments (2)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
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 9 years ago by Vadim Cherkashin - IA&E SB RAS
Avatar
I am andestend.
Sanks for reply.
P.S. Of couse Attribute has array of constant values.
The latest build of this product (v2019.1 build 0681) was released 18 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.