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 871115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:35:32+00:00 2026-05-15T10:35:32+00:00

I’m currently creating a WPF application, using C# and XAML in Visual Studios 2010.

  • 0

I’m currently creating a WPF application, using C# and XAML in Visual Studios 2010.

I have a master grid. In that master grid I have a group bar which you can select different items. Depending on what you select, the middle of the master grid can be totally different. What I was wondering is, what’s the best way to program the middle part?

Right now, I have it set up in such a way that everything in the middle is dynamically programed in C#, and everything on the outside is programmed in XAML.

In C# I programmed: for each group bar item, there is a grid that goes with it (so that different content can be displayed on it). Each grid is a child of the master grid. Each grid is visible or hidden when necessary. Is this the best way to approach this?

The best example of this is in Outlook 2007, where you have your group bar on the right hand side. When you select different items on the group bar (mail, calendar, tasks) the right of the group bar completely changes.

  • 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-15T10:35:33+00:00Added an answer on May 15, 2026 at 10:35 am

    The easy way to do this in WPF is to define DataTemplates for each of your “middle” sections.

    Using the Outlook example, you might have a MessageCollection class that stores a list of messages, an EventCollection class that stores a list of calendar events, and a TaskCollection class that stores a list of tasks.

    In your “middle” area you would simply have a single ContentPresenter whose Content would be set to a MessageCollection, EventCollection, or TaskCollection. Presumably this would be done using a binding to a view model property.

    Here is how it might look:

    <Window ...>
      <Grid>
        <!-- group bar area -->
        ...
    
        <!-- "middle" area -->
        <ContentPresenter Grid.Row="1" Grid.Column="1"
                          Content="{Binding SelectedCollection}" />
      </Grid>
    </Window>
    

    Now you create a DataTemplate for each of the collection types, for example:

    <DataTemplate TargetType="{x:Type my:MessageCollection}">
      <Grid>
        ... put the XAML for displaying mailbox contents here ...
      </Grid>
    </DataTemplate>
    
    <DataTemplate TargetType="{x:Type my:EventsCollection}">
      <Grid>
        ... put the XAML for displaying a calendar here ...
      </Grid>
    </DataTemplate>
    
    <DataTemplate TargetType="{x:Type my:TasksCollection}">
      <Grid>
        ... put the XAML for displaying a to-do list here ...
      </Grid>
    </DataTemplate>
    

    With this setup, all you have to do to switch the inner grid is to set your “SelectedCollection” property in your view model to a different collection type.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 440k
  • Answers 440k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can use the adjustFontSizeToFitWidth property. So something like this.… May 15, 2026 at 5:19 pm
  • Editorial Team
    Editorial Team added an answer You should pass the event to the getCursorPosition method: document.onmouseup… May 15, 2026 at 5:19 pm
  • Editorial Team
    Editorial Team added an answer int b = ((a-1) % 7) + 1; Check using… May 15, 2026 at 5:19 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.