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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:00:46+00:00 2026-05-28T05:00:46+00:00

I am trying to bind a property ObservableCollection<ObservableCollection<Location>> to a ListBox with ItemTemplate of

  • 0

I am trying to bind a property ObservableCollection<ObservableCollection<Location>> to a ListBox with ItemTemplate of ListBox which in-turn has an ItemTemplate that is a grid. The layout of the listbox within a listbox seems to work fine. However, I am having issues with my databinding.

For the second layer listbox ItemsSource I have tried binding using the Collection Current Item Bindings ItemSource="{Binding /}" and using ItemsSource="{TemplateBinding /}". I new to WPF and am using MVVM, so any tips and/or criticism are appreciated.

<ListBox Grid.Row="4" Width="610" Height="600" HorizontalContentAlignment="Stretch" ItemsSource="{Binding CurrentLocation.Children}">
    <ListBox.ItemTemplate>
        <DataTemplate>
            <ListBox Width="550" Height="100" Margin="5"   HorizontalContentAlignment="Stretch"  ItemsSource="{Binding /}" >
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Grid HorizontalAlignment="Stretch" Margin="5">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="3*" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <TextBlock Grid.Column="0" Grid.Row="0" Margin="5" Text="Name:" />
                            <TextBlock Grid.Column="0" Grid.Row="1" Margin="5" Text="Description:" />
                            <TextBlock Grid.Column="1" Grid.Row="0" Margin="5" Text="{Binding Name}" />
                            <TextBlock Grid.Column="1" Grid.Row="1" Margin="5" Text="{Binding Description}" TextWrapping="Wrap" />
                            <Button Grid.Column="2" Grid.Row="0" Command="{Binding TODO}">
                                <TextBlock Text="Edit"/>
                            </Button>
                            <Button Grid.Column="2" Grid.Row="1" Command="{Binding TODO}">
                                <TextBlock Text="Delete"/>
                            </Button>
                        </Grid>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>
  • 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-28T05:00:46+00:00Added an answer on May 28, 2026 at 5:00 am

    Each ListBoxItem contains the DataContext of whatever the object is in the parent collection, so you should be fine to specify nothing in the Binding.

    <ListBox ItemsSource="{Binding MyCollectionOfCollections}">
        <ListBox.ItemTemplate>
            <DataTemplate>
                <!-- DataContext of each item will an inner ObservableCollection<Location> -->
                <ListBox ItemsSource="{Binding }" />
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to bind System.Windows.SystemParameters.PrimaryScreenWidth to a ColumnDefinition's (From within a 'Grid') Width property,
I'm trying to bind element's Height value to Checkbox.IsChecked property. Why that's not working?
Hello I am trying to bind a ItemsSource to a ObservableCollection. It seems the
I'm trying to bind some XAML code to a property in my ViewModel. <Grid
I'm trying to bind the Forderground dependency property to my UIControl, so that it's
Im trying to bind 2 different WPF controls to the same property in the
I am trying to bind programmatically the Content property of my WPF Button to
I have been trying to bind the StringFormat of the Text property of a
I'm trying to bind a simple one-line string to a textbox's text property but
I'm trying to bind a second level property of my class to a combobox.

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.