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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:27:03+00:00 2026-05-28T02:27:03+00:00

I am new to MVVM/WPF and know how to use Grid and StackPanel layout

  • 0

I am new to MVVM/WPF and know how to use Grid and StackPanel layout controls. What is the best method for doing a layout similar to this:

-------------------------
|      Navigation       |
-------------------------
|         |             |
| Summary |   Details   |
|         |             |
-------------------------
|      Extra Data       |
-------------------------

Once I have the layout how do I get the correct views into the correct cells. Each different area (Navigation, Summary, etc.) will have its own View/ViewModel.

I have thought of a couple different methods but not sure which (if any) are best.

Method 1
Imbedded grid like such

<Grid>
   <Row>  (Navigation)
   <Row>  
      <Grid>
         <Column>  (Summary)
         <Column>  (Detail)
      </Grid>
   <Row>  (Extra)
</Grid>

Would require spanning columns which I am not sure if that is good practice or not.

Method 2 Imbedded View

<Grid>
   <Row>  (Navigation)
   <Row>  (Summary/Details defined by a another view containing 2 columns)
   <Row>  (Extra)
</Grid>

Could also use StackPanel in place of Grid for Method 2

With either method (or something else) how do I specify what cell gets what view? For instance, I have the following in MainWindowViewModel:

    public MainWindowViewModel()
    {

        NavigationViewModel navigationViewModel = new NavigationViewModel();
        this.ViewModels.Add(navigationViewModel);

        SummaryViewModel summaryViewModel = new SummaryViewModel ();
        this.ViewModels.Add(summaryViewModel);

        DetailViewModel detailViewModel= new DetailViewModel();
        this.ViewModels.Add(detailViewModel);


        ExtraDataViewModel extraDataViewModel = new ExtraDataViewModel ();
        this.ViewModels.Add(extraDataViewModel);
   }


        private ObservableCollection<ViewModelBase> _viewModels;
        public ObservableCollection<ViewModelBase> ViewModels
        {
            get
            {
                if (_viewModels == null)
                {
                    _viewModels = new ObservableCollection<ViewModelBase>();
                }
                return _viewModels;
            }
        }

And in MainWindowView I have this:

<Window.Resources>
    <ResourceDictionary Source="MainWindowResources.xaml" />
</Window.Resources>


<Grid>
    <Grid.RowDefinitions>
       <RowDefinition Height="100" />
       <RowDefinition Height="*" />
       <RowDefinition Height="50" />
    </Grid.RowDefinitions>
    <ItemsControl ItemsSource="{Binding ViewModels}" Margin="3" /> 
</Grid>

Just not sure how to tap into ItemsSource to specify the correct view in the correct cell.

  • 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-28T02:27:04+00:00Added an answer on May 28, 2026 at 2:27 am

    Either Prism or Caliburn.Micro are really great tools for building composite UIs. I would not make an effort in building this functionality on my own.


    Update

    If you don’t want to bring in another framework I would recommend you just use a Gridfor the general layout and put ItemsControls into the cells of the Grid. Use a DataTemplate to connect your view-models with their respective view.

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

Sidebar

Related Questions

I'm new to WPF and MVVM. I'm struggling to determine the best way to
Being new to both WPF and MVVM, I'm studying Josh Smith's article on the
I am new to WPF and MVVM, and I am working on an application
I'm using MVVM in a WPF app. I'm very new to both. Let me
I'm pretty new to WPF and using the MVVM design pattern. To help learn
I use MVVM pattern in my multithreading WPF app. Now in the model I
I'm very new to MVVM and even WPF to some degree so bear with
I am new to MVVM, and also fairly new to WPF. As a matter
I have recently started learning wpf and am trying to use mvvm. My understanding
I'm doing a multi-layer MVVM WPF application, which is connected to an Oracle database.

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.