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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T14:56:50+00:00 2026-05-29T14:56:50+00:00

First step : a simple ListBox <ListBox Height=95 HorizontalAlignment=Left Margin=17,0,0,0 Name=myList VerticalAlignment=Top Width=287> with

  • 0

First step : a simple ListBox

<ListBox Height="95" HorizontalAlignment="Left" Margin="17,0,0,0" Name="myList" VerticalAlignment="Top" Width="287">

with that code :

myList.Items.Add("toto");

Ok, it’s working fine.

Second step : I want to have two columns for each row.

So I tried that

<ListBoxItem Name="my_item">
    <StackPanel Orientation="Horizontal">
        <TextBlock Name="my_item_id"></TextBlock>
        <TextBlock Name="my_item_name"></TextBlock>
    </StackPanel>
</ListBoxItem>

But in my code ?

I tried

my_item_id = "1234";
my_item_name = "toto";
myList.Items.Add(my_item);

But it’s not working … I suppose I’m doing wrong but then how to make it working ?

Thanks.

  • 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-29T14:56:51+00:00Added an answer on May 29, 2026 at 2:56 pm
    1. You should assign an ItemTemplate to the ListBox which binds to properties on the items. e.g.

      <ListBox.ItemTemplate>
          <DataTemplate>
              <StackPanel>
                  <TextBlock Text="{Binding Id}"/>
                  <!-- ... -->
      
    2. You add items which have those properties, e.g. anonymous objects:

      myList.Items.Add(new { Id = "Lorem", ... });
      

    See also: Data Templating

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

Sidebar

Related Questions

Just looking for the first step basic solution here that keeps the honest people
I am using AsyncSocket class in a simple client-server application. As a first step
I'm hoping to implement a simple molecular dynamics program. My first step is to
I'm trying to implement a simple ray-tracing algorithm so the first step is to
This project is the probable first step in migrating a large CMS from Classic
When you are starting a personal programming project, what is your first step? I'm
I was wondering how other developers begin refactoring. What is your first step? How
First, let's get the security considerations out of the way. I'm using simple authentication
This is my first step into the world of stackoverflow, so apologies if I
I am designing an image decoder and as a first step I tried to

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.