Xceed Grid for WinForms v4.3 Documentation
ApplyToDesigner attribute
Welcome to Xceed Grid for WinForms v4.3 > Advanced Concepts > Extending the grid's classes > ApplyToDesigner attribute

Most classes that derive from the GridElement class or one of its derived classes can be used within the Grid Designer. However, in order for the derived classes to be used in a WYSIWYG manner, like all other native Xceed Grid for WinForms classes,   their visual properties must have the ApplyToDesigner attribute set to true.

Setting the ApplyToDesigner attribute

Every property that has a visual impact, such as the BackColor property, should have the ApplyToDesigner attribute set to true (by default, the ApplyToDesigner attribute is set to false). Setting this attribute to true will allow property modifications of derived classes to be reflected in the Grid Designer. 

Setting the ApplyToDesigner attribute on a property is done in the same manner as any other attribute. For example:

C# Copy Code

[ ApplyToDesigner( true ),
  Category( "Appearance" )
]
public Color BackColor
{
    get{ return Color.LightBlue; }
    set{ m_backColor = value; }
}

Since the BackColor property of the GridElement class has the ApplyToDesigner attribute set to true, any modifications made to a grid element or a derived class' background color will automatically be reflected in the Grid Designer. 

In some cases however, it might not be desired or required to set the ApplyToDesigner attribute to true for a property that has a visual impact. In these cases, if the property has the Browsable attribute set to true, the property will still be visible in the property grid however modifications made to the property will not be reflected in the Grid Designer. For example, in the case of the Grid Element class the Visible property has the ApplyToDesigner attribute set to false.   This behavior is necessary not to have the elements in the Grid Designer disappear if the Visible property was set to false via the property grid. 

Although setting the ApplyToDesigner attribute to false prevents visual property modifications on the grid elements from being reflected in the Grid Designer, if the property value is changed via the property grid, the modified values are still persisted. 

The ApplyToDesigner attribute has the following AttributeUsage attributes:

C# Copy Code
[ AttributeUsage( AttributeTargets.Property, Inherited = true, AllowMultiple = false ) ]

Limitations

Most classes that derive from the classes contained with Xceed Grid for WinForms can be used seamlessly in the Grid Designer. The only exceptions are with classes that derive from the ColumnManagerRow, ColumnManagerCell, GroupByRow, Group, GroupMargin and RowSelector classes. 

Any classes that derive from the ColumnManagerRow, ColumnManagerCell, GroupByRow, Group, GroupMargin and RowSelector classes can only be partially used in the designer. Visually, their appearance will be that of the default ColumnManagerRow, ColumnManagerCell, GroupByRow, Group, GroupMargin and RowSelector however, any properties that are added in the derived class will be accessible in the property grid although modifications made to these properties, even if the ApplyToDesigner attribute is set to true, will not be reflected in the Grid Designer. 

For more information in regards to using derived classes in the Grid Designer, jump to the Using derived classes topic.