Robert
Robert

Reputation: 1726

Overriding controls from another form

I've got an app that I need a bit of help with. It uses DevExpress controls (C#, vs2012) and I'm having a bit of difficulty getting a User Control to override the events from the main form. The MainForm inherits from DevExpress's RibbonForm and is laid out in the typical Outlook fashion, with the Ribbon at the top, NavBar on the left side, and Content area on the right. As you can see from my diagram, I currently have the MainForm and then several UserControls that I load into a Panel control when a specific nav bar button is clicked. So when the user clicks 'Customers', the Customer usercontrol is loaded in the content area. What I'm trying to do now is in each UserControl, override the Ribbon events from the MainForm so I can have the logic in each UserControl. For instance, in Customers, the Save ribbon event would do something different than the Orders Save event. enter image description here

If I have the UserControls inherit from the MainForm, then they will each have the ribbon and navbar items on them, which I don't want. Is there any way to get the UserControls to override the ribbon events from the MainForm form?

Any help/guidance is appreciated!

Upvotes: 0

Views: 657

Answers (1)

DmitryG
DmitryG

Reputation: 17848

Is there any way to get the UserControls to override the ribbon events from the MainForm form?

Yes. This way is Ribbon Merging.
Just add the RibbonControl into each user control. Add and customize all needed commands in each case. Then use the RibbonControl.MergeRibbon/RibbonControl.UnmergeRibbon methods when switching between these user controls - child ribbon will be merged/unmerged into/form parent ribbon.

Upvotes: 1

Related Questions