CAB с UltraDockWorkspace - PullRequest
       19

CAB с UltraDockWorkspace

0 голосов
/ 05 января 2011

Я использую CAB и SCSF для своего приложения и использую CAB Extensibility Kit от Infragistics

Я следовал этой статье.Образец имеет три проекта.Форма оболочки.общие и SmartPartLib

Комплект расширения CAB Infragistics

В проекте SmartPartLib существует класс ModuleController.cs.Этот метод создает некоторые представления, которые будут отображаться при запуске приложения ... Я хочу знать, что, когда

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);

        }

1 Ответ

0 голосов
/ 05 января 2011

Вы можете попробовать реализовать интерфейс IBuilderAware и вызвать свой метод AddViews из метода OnBuiltUp. Этот метод будет вызываться CAB в момент после инициализации коллекции Workspace.

...