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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:27:25+00:00 2026-05-30T21:27:25+00:00

I’m writting a form in WPF/c# with the MVVM pattern and trying to share

  • 0

I’m writting a form in WPF/c# with the MVVM pattern and trying to share data with a user control. (Well, the User Controls View Model)

I either need to:

  1. Create a View model in the parents and bind it to the User Control
  2. Bind certain classes with the View Model in the Xaml
  3. Be told that User Controls arn’t the way to go with MVVM and be pushed in the correct direction. (I’ve seen data templates but they didn’t seem ideal)

The usercontrol is only being used to make large forms more manageable so I’m not sure if this is the way to go with MVVM, it’s just how I would of done it in the past.

I would like to pass a class the VM contruct in the Xaml.

<TabItem Header="Applicants">
     <Views:ApplicantTabView>
         <UserControl.DataContext>
             <ViewModels:ApplicantTabViewModel Client="{Binding Client} />
         </UserControl.DataContext>
     </Views:ApplicantTabView>
 </TabItem>
public ClientComp Client
    {
        get { return (ClientComp)GetValue(ClientProperty); }
        set { SetValue(ClientProperty, value); }
    }

public static readonly DependencyProperty ClientProperty = DependencyProperty.Register("Client", typeof(ClientComp),
                                                                           typeof(ApplicantTabViewModel),
                                                                                       new FrameworkPropertyMetadata
                                                                                           (null));

But I can’t seem to get a dependancy property to accept non static content.

This has been an issue for me for a while but assumed I’d find out but have failed so here I am here.

Thanks in advance,
Oli

  • 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-30T21:27:26+00:00Added an answer on May 30, 2026 at 9:27 pm

    I answered a similar question as yours recently: passing a gridview selected item value to a different ViewModel of different Usercontrol

    Essentially setting up a dependency property which allows data from your parent view to persist to your child user control. Abstracting your view into specific user controls and hooking them using dependency properties along with the MVVM pattern is actually quite powerful and recommended for Silverlight/WPF development, especially when unit testing comes into play. Let me know if you’d like any more clarification, hope this helps.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I have a text area in my form which accepts all possible characters from
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I want to construct a data frame in an Rcpp function, but when I

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.