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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:32:31+00:00 2026-06-16T00:32:31+00:00

In a List I store several items with a header and sub items _categories

  • 0

In a List I store several items with a header and sub items

_categories = new List<Category>();

Category cOne = new Category() { Header = "Category one" };
cOne.AddItem("Sub One");
cOne.AddItem("Sub Two");
cOne.AddItem("Sub Three");
_categories.Add(cOne);

In WPF I bind these items to a ListBox.

<ListBox x:Name="listbox">
  <ListBox.ItemTemplate>
    <DataTemplate>
      <StackPanel>
        <TextBlock Text="{Binding Header}" />
        <ListBox ItemsSource="{Binding Subs}" Padding="10 0 0 0" />
      </StackPanel>
    </DataTemplate>
  </ListBox.ItemTemplate>
</ListBox>

What I now try but fail is to make only the items in the inner ListBox click-able, i.e. to avoid:

enter image description here

If I set TextBlock.IsEnabled or TextBlock.IsHitTestVisible to false nothing changes. If the StackPanel's properties are set to false the inner ListBox isn’t click-able any more but interestingly the TextBlock still is. And the outer ListBox's properties prevents to click anything at all.

The behavior is identical if the outer ListBox is a ListView instead.

I haven’t figured out yet what I need to change to make sure that only the items in the inner list are enabled. Any ideas?

  • 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-06-16T00:32:31+00:00Added an answer on June 16, 2026 at 12:32 am

    If there is no need to select the items in the outer ListBox whatsoever, do not use a ListBox – use an ItemsControl instead:

    <ItemsControl x:Name="itemsControl">
        <ItemsControl.ItemTemplate>
            <DataTemplate>
                <StackPanel>
                    <TextBlock Text="{Binding Header}" />
                    <ListBox ItemsSource="{Binding Subs}" Padding="10 0 0 0" />
                </StackPanel>
            </DataTemplate>
      </ItemsControl.ItemTemplate>
    </ItemsControl >
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a chess game that originally used an stl list to store the
I am working with python plugins.I used list to store some values as below:
I am a beginner in C++. I need to store list of addresses that
I'm trying to store a List as a DynamoDB attribute but I need to
I have a requirement to store the list of services for multiple computers. I
I want to store a list of numbers (essentially, a set in mathematical terms)
I would like to store a list of entityIDs of outlook emails to a
Question : where does Eclipse store the list of files it opens on startup?
I want to store a list of objects, lets say of type Car, but
How do I store a list of data that is submitted to a controller

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.