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

Let's say I have objects which look very roughly like this: class object {
I have objects with location data stored in Core Data, I would like to
I have objects in a tree structure, I would like to aggregate status information
I would like to have objects in my view which can be dragged and
I have objects representing folders and I'm wondering if they should be represented in
I have objects: type A (Id, Name), type B (AId, Description). I want to
If I have objects on one layer with the same name as objects on
In a WPF app I have objects, derived from a custom control: ... <MyNamespace:MyCustControl
We have objects that we want to represent in stacks (think of stacking items
I have objects with many variables that I declare and explain in the comments.

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.