SCSF: display view from another view against button click
Question
i am facing one problem in SCSF.
I have two workspaces
- MdiWorkspace
- DeckWorkspace
i have two views in a module
- Viewer (display in mdiworkspace)
- Property Viewer (in deckworkspace)
in Viewer i have a button in toolbar whose purpose is to display PropertyViewer (another View).
how can i display this PropertyViewer in deckworkspace agaist button click event.
NOTE: i am not using Command[CommandName].AddInvoker(control, "click:) and CommandHandler
Solution
I'm going to assume your toolbar sits in a SmartPart that implements the MVP pattern. Have the button click event handler in the SmartPart fire an event that its presenter will handle. Your presenter code would look like this:
// Presenter code protected override void OnViewSet() { this.View.ToolbarButtonClick += View_ToolbarButtonClick; } public void View_ToolbarButtonClick(object sender, EventArgs e) { // remove the handler so the property viewer // will only be added the first time this.View.OnToolbarButtonClick -= View_ToolbarButtonClick; var propertyView = new PropertyViewer(); this.WorkItem.Workspaces[WorkspaceNames.MyDeckWorkspace].Show(propertyView); }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow