I have a question about showing a viewmodel after clicking a button on a ribbon.
I am designing an MDI application with a tabcontrol and a ribbon.
I have a shellviewmodel which consists of a ribbon and a tabcontrol. In the tabcontrol workspaces will be showed, the user can show a particular workspace by pressing the corresponding button on the ribbon.
All workspaces will be discovered at runtime, so that I can expand the application in the future. All workspaces will register there corresponding buttondata by the shell.
An example of the code for a button is shown below, this code will attach the click event of the button to a method “DisplayWorkspace” in the shellviewmodel.
ButtonData addButton = new ButtonData()
Label = "Add Customer",
LargeImage = new Uri("/App;component/Shell/Resources/Images/customer-icon_32x32.png", UriKind.Relative),
KeyTip = "Add Customer",
ToolTipTitle = "Add Customer",
ToolTipDescription = "Add Customer to the database.",
ToolTipFooterTitle = helpString,
Message = "[Event Click] = [Action DisplayWorkspace($executioncontext)]",
ToolTipFooterImage = smallHelpImage
My problem is, how can the DisplayWorkspace method determine which workspace needs to be shown?
The $executionContext value does not deliver the right information to the shellviewmodel so that it can determine the particular workspace.
Can somebody give me some hints on how to solve this.