Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7037497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:33:08+00:00 2026-05-28T01:33:08+00:00

I have a RibbonBar with four buttons, each of which selects a different view

  • 0

I have a RibbonBar with four buttons, each of which selects a different view and injects it into the MainRegion. Right now, it’s working well but each of the four views have a few controls in common e.g. Displaying the username, date/time, search box etc. As of now, I’ve made separate views but I would like to know if there is a way of implementing a Master Page/UserControl so that I don’t have to repeat code.

So the design, right now, is like so:

Shell

<Window>
    <Grid>
        <DockPanel>
            <RibbonBar Regions:RegionManager.RegionName="ToolbarRegion">
            </RibbonBar>
            <ContentControl Regions:RegionManager.RegionName="MainRegion">
            </ContentControl>
        </DockPanel>
    </Grid>
</Window>

The ToolbarRegion contains the RibbonBar with the four buttons.

Each Button will inject a view into the MainRegion. Each of these views has some common controls (much like a Master Page in ASP.Net), but the content of each view is different.

There are ways to work around this (I can’t change the Shell design) but I was wondering if there was a better, more elegant way to do this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:33:09+00:00Added an answer on May 28, 2026 at 1:33 am

    I like using the Prism framework, however I feel that their Regions should only be used for Application Layout (MenuRegion, NavigationRegion, ContentRegion, etc), and not Navigation. Using them for Navigation means letting the View control the application flow, and I feel that is a job for the ViewModels.

    My preferred method for displaying changing content is with DataTemplates and ContentControls

    To create something like you outlined, I would have a parent ViewModel which contains

    • ObservableCollection<IPageViewModel> PageViewModels
    • IPageViewModel SelectedPageViewModel

    The area I wanted to display the dynamic content would use a ContentControl such as this:

    <ContentControl Content="{Binding SelectedPage" />
    

    And DataTemplates would be used to tell WPF how to draw each section

    <DataTemplate TargetType="{x:Type local:Page1ViewModel}">
        <local:Page1View />
    </DataTemplate>
    
    <DataTemplate TargetType="{x:Type local:Page2ViewModel}">
        <local:Page2View />
    </DataTemplate>
    
    <DataTemplate TargetType="{x:Type local:Page3ViewModel}">
        <local:Page3View />
    </DataTemplate>
    

    I have not used a RibbonBar before, however it sounds like it should allow for an ItemsSource so your final XAML should probably look something similar to this:

    <Window>
        <Grid>
            <DockPanel>
                <RibbonBar ItemsSource="{Binding PageViewModels}" 
                           SelectedItem="{Binding SelectedPageViewModel}" 
                           DockPanel.Dock="Top" ...>
    
                </RibbonBar>
    
                <StackPanel>
                    <Grid>
                        ... Generic Content
                    </Grid>
    
                    <ContentControl Content="{Binding SelectedPageViewModel}">
    
                        <ContentControl.Resources>
                            <DataTemplate TargetType="{x:Type local:Page1ViewModel}">
                                <local:Page1View />
                            </DataTemplate>
                            <DataTemplate TargetType="{x:Type local:Page2ViewModel}">
                                <local:Page2View />
                            </DataTemplate>
                            <DataTemplate TargetType="{x:Type local:Page3ViewModel}">
                                <local:Page3View />
                            </DataTemplate>
                        </ContentControl.Resources>
    
                    </ContentControl>
                </StackPanel>
            </DockPanel>
        </Grid>
    </Window>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have deployed numerous report parts which reference the same view however one of them
Have started working my way through a book called WebGL: Up and Running, which
have written this little class, which generates a UUID every time an object of
Have a procedure which looks like Procedure TestProc(TVar1, TVar2 : variant); Begin TVar1 :=
Above is the ribbonbar after I have logged in as a super user. The
Have created a ATL COM project through which I am inserting Menu Items to
I'm trying out the Telerik controls, specifically the RibbonBar/RibbonForm and am running into a
Have some validating problems which seem to appear only when using the Auth component.
Have looked for a solution for 2 days now and am beating my head
I have a ribbon window with a number of buttons wich is using a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.