Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
80
Problem with store/restore of the dock workspace
posted

In our application different views can be added (via a 'view' menu option) to the layout, but each view should not exist more than once. This is implemented using the following code:

protected virtual TView ShowViewInWorkspace<TView>(string viewId, string workspaceName)

{

TView view = default(TView);

if (WorkItem.SmartParts.Contains(viewId))

{ view = WorkItem.SmartParts.Get<TView>(viewId); }

else { view = WorkItem.SmartParts.AddNew<TView>(viewId); }

if (workspaceName != null) { WorkItem.Workspaces[workspaceName].Show(view); }

}

 

If I select from the view menu two different views, they both are added to the layout. If I select one of them again from the view menu, the code above makes sure that I get a reference to the existing view. This is visible by the corresponding view getting selected.

 When I shut down the application, I use the SaveAsXml method from the UltraDockWorkSpace.

When the application is started again, first all views that where open previously are added to the smart part list (with the code above).

Then the LoadFromXml method from the UltraDockWorkSpace is called. Now everything is visible just as it was when shutting down.

So far so good.

However, if I now select one of the open views via the view-menu, I would expect the same behaviour as before, but I now very often get the following error message:

System.ArgumentException was unhandled
  Message="Key not found\r\nParameter name: key"
  Source="Infragistics2.Shared.v8.2"
  ParamName="key"

 

It looks like each smartpart has a key value, and there's a mismatch between the views that are opened at startup, and how they are registered in the xml file. But can this behaviour be switched off? Or am I doing something wrong?

Not that the 'Name' of a specific view when it is added to the SmartPart list is always the same.

Parents Reply Children
No Data