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

  • Home
  • SEARCH
  • 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 6202259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:42:04+00:00 2026-05-24T04:42:04+00:00

Hi I am building a wpf application in which a screen will be comprising

  • 0

Hi I am building a wpf application in which a screen will be comprising of different user controls for performing various application.

I wanted to know the right process for doing this in MVVM? Should each user control have its own view model, or should they still bind to the main View model properties?

Please suggest a good approach. Thanks,

  • 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-24T04:42:07+00:00Added an answer on May 24, 2026 at 4:42 am

    When I use an UserControl I pass the data through DependencyProperties. My UserControls doesn’t have ViewModels. UserControls only handle the passed data a very special way.

    But if I have View that contains some Sub-Views I prefere to have for each Sub-View a own model. These model I’ll bind through a property of the ViewModel of the MainView.

    Some example:

    UserControl1, Code behind:

    public partial class UserControl1 : UserControl
    {
        public MyClass MyProperty
        {
            get { return (MyClass)GetValue(MyPropertyProperty); }
            set { SetValue(MyPropertyProperty, value); }
        }
    
        public static readonly DependencyProperty MyPropertyProperty =
            DependencyProperty.Register("MyProperty", typeof(MyClass), typeof(UserControl1), new UIPropertyMetadata(null));
    
    
        public UserControl1()
        {
            InitializeComponent();
        }
    }
    
     public class MyClass
    {
        public int MyProperty { get; set; }
    }
    

    And the usage in the view, XAML:

    <Window x:Class="Sandbox.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:Sandbox="clr-namespace:Sandbox">
      <Grid>
        <Sandbox:UserControl1 MyProperty="{Binding MyOtherPropertyOfTypeMyClassInMyViewModel, Mode=TwoWay}" />
      </Grid>
    

    Hope this helps

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

Sidebar

Related Questions

Im building a web application which is a process management app. Several different employee
I am building an application which has multiple user entry screens. I would like
I'm building an application using WPF that will be a designer of sorts, meaning,
We're building a touch screen kiosk application that will run on Windows POS Ready
I'm building a WPF application, and I derived a bunch of controls from the
I'm building a touch screen application in WPF and I'm wanting to show a
I'm building a WPF application in which I need to display document previews such
I am building a WPF application in which I need to open one of
I'm building an application in C# using WPF. How can I bind to some
I'm building a WPF application. I'm doing some async communication with the server side,

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.