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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:42:02+00:00 2026-06-04T10:42:02+00:00

My understanding of DataBinding is still at the working on it level, so here

  • 0

My understanding of DataBinding is still at the “working on it” level, so here is my issue. I have this data:

private class User
    {
        public string username { get; set; }
        public string real_name { get; set; }
    }

ObservableCollection<User> users = new ObservableCollection<User>();
...adds stuff...
CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(users);

I want this to be displayed in a two column ListBox. I’ve gotten in in a two column ComboBox by doing:

<ComboBox Height="23" HorizontalAlignment="Left" Margin="114,23,0,0" Name="comboBox_client" VerticalAlignment="Top" Width="113" IsEditable="True" ItemsSource="{Binding}" >
        <ComboBox.ItemTemplate>
            <DataTemplate>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{Binding username}" Name="left" Width="50" />
                    <TextBlock Text="{Binding real_name}" Name="right" Width="100" />
                </StackPanel>
            </DataTemplate>
        </ComboBox.ItemTemplate>
    </ComboBox>

with

comboBox_client.ItemsSource = view;

But I’m not sure how to make the step over to a ListBox, since I see no ItemTemplate, and I don’t understand the concept behind what the above Xaml is actually doing. If I take out the ItemTemplate part and try the rest on the ListBox, I just just a listbox full of System.Windows.DataTemplate.

Point in the right direction please?

  • 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-04T10:42:03+00:00Added an answer on June 4, 2026 at 10:42 am

    ListBox has an ItemTemplate property too. I think you just missed that.

    You can just use the same DataTemplate you used for your ComboBox.

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

Sidebar

Related Questions

Just learning WPF databinding and have a gap in my understanding. I've seen a
I have a very simple object called CellData. Is defined as: public sealed class
Understanding question: 1.) X_IndexViewModel class public class X_IndexViewModel { public List<SelectListItem> CheckBox_1 { get;
I'm working on a project where I have some hierarchical data that I want
I have a problem in understanding some basic concepts here i think ... I
Hi I am having issues with understanding WPF databinding with nested objects. I have
My understanding of regex and working with strings in php is poor at best
(Understanding of VB.NET: Intermediate) I have 60 Comboboxes on a 10 tabs. I want
My understanding of this is that a synchronized block keeps other threads from accessing
My understanding of col is that it may be used to indicate a class

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.