我正在为我的应用程序使用CAB和SCSF,并且我正在使用Infragistics的CAB可扩展性工具包
我关注了这篇文章。该示例包含三个项目。外壳形式。common和SmartPartLib
Infragistics CAB Extensibility Kit
在SmartPartLib项目中有ModuleController.cs类。这个方法是创建一些视图,这些视图将显示在App start上...我想知道什么时候
this.WorkItem.Workspaces[Constants.WorkspaceNames.DockWorkspace]已初始化。我试图在示例SCSF项目中执行相同的操作,但我得到的WorkspaceObject为null。请告诉我有没有人在用英格拉瑟斯出租车套件..。
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);
}发布于 2011-01-05 22:58:21
您可以尝试实现IBuilderAware接口,并从OnBuiltUp方法调用AddViews方法。此方法将由CAB在初始化Workspace集合后的某个点调用。
https://stackoverflow.com/questions/4603968
复制相似问题