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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:05:16+00:00 2026-05-11T10:05:16+00:00

I have two WPF list boxes. One is a list of lists (actually a

  • 0

I have two WPF list boxes. One is a list of lists (actually a List of ObservableCollection), the other is a list of all known instances of ‘Thingy’.

Here’s the datatemplate I’m using for the ‘thingy’ class.

<DataTemplate DataType='{x:Type Model:Thingy}'>     <StackPanel Orientation='Horizontal'>         <CheckBox x:Name='ThingyInListCheckBox' Click='ThingyInList_Click'></CheckBox>         <TextBlock Text='{Binding Path=ThingyName}'></TextBlock>      </StackPanel>  

Here’s the XAML for the list boxes:

<ListBox     Name='ListOfGroups'    SelectionMode='Single'>            </ListBox> <ListBox     Name='ListOfThingys'    SelectionMode='Single'> </ListBox> 

I have the data binding for the list boxes set up in code, because I’m too tired to figure out how to do it in XAML:

ListOfGroups.ItemsSource = InMemoryCache.ThingyGroups; ListOfThingys.ItemsSource = InMemoryCache.Thingys; 

What I want is the checkbox ‘ThingyInListCheckBox’ to be checked if the ‘thingy’ object is in the list that is the selected item in the ‘ListOfGroups’ listbox. So basically I need to bind it to the ‘Contains’ method of the ‘ListOfGroups’.SelectedItem while passing it the ‘ListOfThingys’.SelectedItem as a parameter.

I’m tempted to do this all in code, but I’m trying to get a better understanding of XAML data binding because I hate myself and I want me to suffer.

Is this even possible, or have I hit the inevitable ‘wall of databinding’ that exists in every other data binding system in the history of software development?

  • 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. 2026-05-11T10:05:17+00:00Added an answer on May 11, 2026 at 10:05 am

    It is possible, in fact the hard thing is that there are many ways to do this and you have to choose one. None of them is a simple addition to your current code. However there is one way, by which you gain more than solving your problem. Actually, it is more of a pattern, called MVVM (some might argue about the naming).

    Here is a small explanation on your example. Suppose ThingyGroup has an IsSelected property, which is bound to the IsSelected property of the containing ListBoxItem. Again, suppose Thingy has a Group property too. Then you can use Group.IsSelected as a path to bind checkbox. Notice that there is still a small issue that IsSelected is a bool and IsChecked is a nullable bool.

    A search on MVVM should give you concrete samples.

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

Sidebar

Ask A Question

Stats

  • Questions 76k
  • Answers 76k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer The IAR compiler does not support the std namespace (I'm… May 11, 2026 at 2:55 pm
  • added an answer It is possible. In IIS7, you just have to create… May 11, 2026 at 2:55 pm
  • added an answer As outlined in the Powershell Quick reference¹: True False ~~~~… May 11, 2026 at 2:55 pm

Related Questions

I am facing a problem with one of my XBAP (WPF Browser application) projects:
I have a rather classic UI situation - two ListBoxes named SelectedItems and AvailableItems
I am using two ListBox controls in my WPF window that are identical (identical
If I have two objects, one being the list of items, and the other

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.