Composite UI Application Block 之自定义UIElement

1.1. UIElement

1.1.1.    接口定义

 

IUIElementAdapterFactoryCatalog

21 IUIElementAdapterFactoryCatalog

其中UIElementAdapterFactoryCatalogCAB中提供的默认实现

IUIElementAdapterFactory

22 IUIElementAdapterFactory

CompositeUI.WinForms中有一个实现了该接口的ToolStripUIAdapterFactory,用以提供菜单或工具条的实现

23 IUIElementAdapter

其中UIElementAdapterCAB中提供的抽象泛型实现

1.1.2.    接口协作

24 接口调用关系

25 GetFactory的默认实现

因此在建立我们自己的UI时,需要至少实现两个类,用于实现IUIElementAdapterFactoryIUIElementAdapter,然后在系统初始化期间把我们自己的Factory加入到服务集合中,代码如下所示:

      protected override void AfterShellCreated()

           {

                 base.AfterShellCreated();

 

                  IUIElementAdapterFactoryCatalog catalog = RootWorkItem.Services.Get<IUIElementAdapterFactoryCatalog>();

            catalog.RegisterFactory(new ClickableTreeViewAdapterFactory());

            // both main menus should have their items added to the root nodes collection

            RootWorkItem.UIExtensionSites.RegisterSite(UIExtensionConstants.MAINMENU, Shell.MainNavigationTree);

            RootWorkItem.UIExtensionSites.RegisterSite(UIExtensionConstants.MAINSTATUS, Shell.mainStatusStrip);

 

            // Load the menu structure from App.config

                 UIElementBuilder.LoadFromConfig(RootWorkItem, Shell.MainNavigationTree);

           }

其中ClickableTreeViewAdapterFactory是我们UI实现类。

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值