0

我正在为我的应用程序使用 CAB 和 SCSF,并且我正在使用 Infragistics 的 CAB 扩展套件

我关注了这篇文章。该示例包含三个项目。外壳形式。通用和 SmartPartLib

Infragistics CAB 扩展套件

在 SmartPartLib 项目中有类 ModuleController.cs。此方法正在创建一些将在 App 启动时显示的视图...我想知道什么时候

this.WorkItem.Workspaces[Constants.WorkspaceNames.DockWorkspace]

已初始化。我尝试在示例 SCSF 项目中做同样的事情,但我将这个 WorkspaceObject 设置为空。请告诉我是否有人使用 Infragistics CAB Kit...

 private void AddViews()
        {
            //Create the Root View first, but do not show it
            RootView theRootView = this.WorkItem.SmartParts.AddNew<RootView>();


            //Here is the important part: 
            //Whenever dynamically creating controls that will interact with the
            //UltraDockManager, for the best results, make sure that you
            //assign a unique value to the control's "Name" property. In this case,
            //since the dynamic nature of CAB and SmartParts brings us to the
            //same situation, we also add a value to the SmartPart's "Name" property:

            TreeView theTreeView = this.WorkItem.SmartParts.AddNew<TreeView>();                 //1: Create
            theTreeView.Name = "theTreeView";                                                   //2: Set Name
            this.WorkItem.Workspaces[Constants.WorkspaceNames.DockWorkspace].Show(theTreeView); //3: Show it

            GridView theGridView = this.WorkItem.SmartParts.AddNew<GridView>();
            theGridView.Name = "theGridView";
            this.WorkItem.Workspaces[Constants.WorkspaceNames.DockWorkspace].Show(theGridView);

            ChartView theChartView = this.WorkItem.SmartParts.AddNew<ChartView>();
            theChartView.Name = "theChartView";
            this.WorkItem.Workspaces[Constants.WorkspaceNames.DockWorkspace].Show(theChartView);

            //Load the layout through the interface
            ((IRootView)theRootView).LoadDockLayout();

            //Finally show the Root View
            this.WorkItem.Workspaces[Constants.WorkspaceNames.MainWorkspace].Show(theRootView);

        }
4

1 回答 1

0

您可以尝试实现该IBuilderAware接口并从该方法调用您的 AddViewsOnBuiltUp方法。此方法将在初始化 Workspace 集合后由 CAB 调用。

于 2011-01-05T14:58:20.553 回答