0

アプリケーションに CAB と SCSF を使用しており、Infragistics の CAB Extensibility Kit を使用しています。

この記事に従いました。サンプルには 3 つのプロジェクトがあります。シェルフォーム。共通および SmartPartLib

Infragistics CAB 拡張性キット

SmartPartLib プロジェクトには、クラス ModuleController.cs があります。このメソッドは、アプリの起動時に表示されるいくつかのビューを作成しています...いつそれを知りたいですか

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

が初期化されています。サンプル SCSF プロジェクトで同じことをしようとしましたが、この WorkspaceObject を null として取得しています. 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、メソッドから AddViews メソッドを呼び出すことができますOnBuiltUp。このメソッドは、Workspace コレクションが初期化された後の時点で CAB によって呼び出されます。

于 2011-01-05T14:58:20.553 に答える