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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:30:58+00:00 2026-05-11T19:30:58+00:00

I have objects I’m databinding to a ListBox in WPF. Here’s what the end

  • 0

I have objects I’m databinding to a ListBox in WPF. Here’s what the end result should look like:

-------------------------------
| Name    | Opt1    |  Value1 |
|         | Opt2    |  Value2 |
|         | Opt3    |  Value3 |
|         | Opt4    |  Value4 |
-------------------------------

Essentially i’ve got a DataTemplate for the overall variable, and then the Opt/Value combo has it’s own DataTemplate. I’m trying to display the list of values as simply as possible.

<Label Content="{Binding Path=Identifier.Name, Mode=OneWay}" />
<ListView Grid.Column="1" HorizontalAlignment="Stretch" 
          ItemsSource="{Binding Path=Values, Mode=OneWay}" />

The binding for Values is currently only a <Grid> with 2 <Label>‘s and ListView has a lot of features I dont watch, such as the border styling, selections, and such, when all I really want is to be able to databind using a List.

I’ve tried to databind the items to a stackpanel but couldn’t get it to work in XAML. I suppose another solution is to do what I’m doing, and rewrite the <Style> for ListView. Any suggestions on the correct way to do this?

  • 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-11T19:30:58+00:00Added an answer on May 11, 2026 at 7:30 pm

    It certainly sounds like something you can do with a ListBox, or an ItemsControl if you do not want them to be selectable. We can also make use of the IsSharedSizeScope attached property to keep our columns formatted and even. Also, take a look at the Inheritance Higharchy at the bottom of the ListBox link, it should help you determine which type of list you need for different scenarios.

    Try something like this:

    <DockPanel>
      <Label Content="{Binding Path=Identifier.Name, Mode=OneWay}" />
      <ListBox ItemsSource="{Binding Path=Values, Mode=OneWay}"
               Grid.IsSharedSizeScope="True">
        <ListBox.ItemTemplate>
          <DataTemplate>
            <Grid>
              <Grid.ColumnDefinitions>
                <ColumnDefinition SharedSizeGroup="OptionColumn" />
                <ColumnDefinition SharedSizeGroup="ValueColumn" />
              </Grid.ColumnDefinitions>
              <TextBlock Grid.Column="0" Text="{Binding Option}" />
              <TextBlock Grid.Column="1" Text="{Binding Value}" />
            </Grid>
          </DataTemplate>
        </ListBox.ItemTemplate>
      </ListBox>
    </DockPanel>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, NHibernate question here. I have two objects that I would like to map
I have two objects, let's call them Input and Output Input has properties Input_ID
I have a bunch of objects in a flat structure. These objects have an
I have several objects in the database. Url to edit an object using the
Assume you have some objects which have several fields they can be compared by:
If I have two objects, one being the list of items, and the other
If I have two objects on the heap referring to each other but they
I have a question with fluent interfaces. We have some objects that are used
During coding I frequently encounter this situation: I have several objects ( ConcreteType1 ,
At work, I'm frequently working on projects where numerous properties of certain objects have

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.