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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:39:44+00:00 2026-05-24T07:39:44+00:00

My first question here on the Stack. Forgive me for the bad explanation in

  • 0

My first question here on the Stack. Forgive me for the bad explanation in advance.

I am working on my first MVVM application (Silverlight). I have a custom user control that contains a ListBox to show navigation items. This control is placed in my main xaml page. I don’t know if I need to create a composite view model (my main page view model) with a view model especially for the custom control in it or if there is some way to elevate the ListBox properties that I need to bind to.

Through XAML I don’t know how to bind, let’s say, the ItemsSource property of the ListBox inside the custom control to my main page viewmodel. Basically, I’m at the point that I am questioning my design decision for trying to bind the custom control through my main page view model.

What I have done so far is create dependency properties for the custom control and try to tunnel those dependency properties down to the ListBox properties. I’ve achieved success with this method for ItemsSource but am having issues with SelectedItem.

Even if I do get SelectedItem to work, it still feels Wrong. Thanks for any advice in advance.

  • 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-24T07:39:45+00:00Added an answer on May 24, 2026 at 7:39 am

    The UserControl should inherit the DataContext from its parent control, unless you are setting it directly. You can then bind to the properties on your view model from your UserControl.

    If you would like to create a ViewModel specifically for the UserControl, you can also do that. You would then expose it as a property on your main ViewModel, and bind to it in the MainPage. Example:

    public class MainViewModel
    {
        public ChildViewModel ChildInfo { get; private set; }
    }
    

    And then in the view:

    <Grid>
        ...
        <lcl:ChildView DataContext="{Binding ChildInfo}" />
        ...
    </Grid>
    

    Your ChildViewModel would then contain properties like SelectedItem to bind your ListBox to.

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

Sidebar

Related Questions

Here's my first question at SO. I have a internal application for my company
This is my first question here. I have been searching Stack Overflow and other
First question here so hello everyone. The requirement I'm working on is a small
Greetings to all! This is my first question here on stackoverflow. I have a
Ok, I need help. This is my first question here. Background: I am working
This is my first question here on stack overflow. i need help on a
this is my first question here at Stack Overflow. I've been looking for a
It has been a long question, so here is the summary first, I have
My first ever question here. Please excuse me, I have just entered into C++
This is the first time i'm asking a question here at stack overflow so

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.