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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:57:47+00:00 2026-05-16T00:57:47+00:00

I am currently experimenting with WPF. One thing, I wanted to do was a

  • 0

I am currently experimenting with WPF.
One thing, I wanted to do was a master to detail selection over multiple comboboxes.
I have a ViewModel with GroupItems that i use as ItemSource for the first combobox. These GroupItems have a Property called Childs, which includes a List of items that belong to this group.

I can’t find a way to bind the comboBox1.SelectedItem.Childs as Itemsource for the second comboBox.

Right now I only got to

ItemsSource="{Binding ElementName=comboBox1, Path=SelectedItem}"

But I don’t get the Property of the SelectedItem. How can this be done? Or is this not the WPF way to this?

Is there any good website to learn how to select different elements? Eplaining Path, XPath, Source and everything?

Thanks for any help.

  • 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-16T00:57:48+00:00Added an answer on May 16, 2026 at 12:57 am

    Your binding above isn’t attempting to bind to Childs, only SelectedItem.

    Try something like this:

    Window1.xaml

    <Window x:Class="WpfApplication5.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow" Height="350" Width="525">
        <StackPanel>
            <ComboBox x:Name="_groups" ItemsSource="{Binding Groups}" DisplayMemberPath="Name"/>
            <ComboBox ItemsSource="{Binding SelectedItem.Items, ElementName=_groups}"/>
        </StackPanel>
    </Window>
    

    Window1.xaml.cs

    using System.Windows;
    
    namespace WpfApplication5 {
        /// <summary>
        ///   Interaction logic for MainWindow.xaml
        /// </summary>
        public partial class MainWindow : Window {
            public MainWindow() {
                InitializeComponent();
    
                var model = new ViewModel();
    
                var g1 = new Group { Name = "Group1" };
                g1._items.Add("G1C1");
                g1._items.Add("G1C2");
                g1._items.Add("G1C3");
                model._groups.Add(g1);
    
                var g2 = new Group { Name = "Group2" };
                g2._items.Add("G2C1");
                g2._items.Add("G2C2");
                g2._items.Add("G2C3");
                model._groups.Add(g2);
    
                var g3 = new Group { Name = "Group3" };
                g3._items.Add("G3C1");
                g3._items.Add("G3C2");
                g3._items.Add("G3C3");
                model._groups.Add(g3);
    
                DataContext = model;
            }
        }
    }
    

    ViewModel.cs

    using System;
    using System.Collections.Generic;
    
    namespace WpfApplication5
    {
        public class Group {
            internal List<String> _items = new List<string>();
            public IEnumerable<String> Items {
                get { return _items; }
            }
            public String Name { get; set; }
        }
        public class ViewModel
        {
            internal List<Group> _groups = new List<Group>();
            public IEnumerable<Group> Groups
            {
                get { return _groups; }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently experimenting with build script, and since I have an ASP.net Web Part
I'm currently experimenting with GWT and Spring. More specifically I wanted to make the
I want to have generalised email templates. Currently I have multiple email templates with
Currently, I don't really have a good method of debugging JavaScript in Internet Explorer and
Currently we have a hybrid ASP/PHP setup connecting to a SQL Server 2005 database.
Currently we have a project with a standard subversion repository layout of: ./trunk ./branches
I am experimenting with WPF and re-implementing my old maze screensaver. My code basically
I'm experimenting problems with text rendering in WPF (third party applications and mine too).
I currently experimenting with different lightweight text editors for Scala development. jEdit seems to
I'm currently experimenting with loading external SWF files from both an standard AS3 application,

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.