How to enable visual inheritance for Developer Express controls

We have found a way to enable visual inheritance in our controls when they are used in Visual Studio 2005 / 2008. We have tested this solution in all the typical visual inheritance scenarios and haven't noticed any failures yet. But we cannot be completely sure that we have chosen the correct approach and thus we don't enable visual inheritance by default. What causes this doubt is that Microsoft disabled visual inheritance for its controls.

There is a DXDesignKeys tool shipped with the DXperience suite. It adds a new key to the registry and is capable of changing its state. When this key is present and enabled, Developer Express controls allow visual inheritance. If it is not present or disabled, visual inheritance is prohibited just as with standard controls (this is the default behavior).

Tool file path:

D:\Program Files (x86)\DevExpress 13.2\Components\Tools\Components\DXDesignKeys.exe

 

This problem is actually caused by a limitation of the Visual Form Inheritance mechanism. Note that the Bar.ItemLinks property is a collection. VFI does not fully support collections. It does not inherit collections as one might expect. Collections are simply copied. So, you cannot change collections on derived forms, you can just add new elements. Thus, the newly added items are displayed at the last position on a toolbar.

As the most effective solution in this instance, we recommend that you create all the required toolbars and items at design time, but manage item links programmatically. This way, there is no need to store collections. Another approach is to put Item Links on toolbars only on those forms, which are actually used in your application, not on base forms.

See Also:
Can I use the grid on an inherited form or user control?
How to enable visual inheritance for Developer Express controls

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值