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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:25:32+00:00 2026-06-02T04:25:32+00:00

Sorry if this is a noob questions. I just started learning WPF so hopefully

  • 0

Sorry if this is a noob questions. I just started learning WPF so hopefully you guys dont mind. But, is it possible to create two columns for each row dynamically through the xaml or would this have to be done in back end code (viewmodel, .cs)? Right now I have just a long list of items through binding with datasource. For example, datasource = “{binding path=House.Item}” … Item is a collection which stores the label and value as it execute a stored procedure call. eg: label=”Color”, value=”White”.

I currently have:

Color <– label

White < — value in a textblock

Window <– label

Vinyl < — value in a textblock … etc

I would like to have the result to be 2 column for each row (doesnt display correctly):

Color | >>> Window

White | >>> Vinly

Door | >>> Basement

Wood | >>> Finished

The reason why I would want to achieve this is so I can eliminate the horizontal scrolling just in case the items gets really long. Any advice would be helpful. Thanks a lot in advanced.

Update:

<ListBox.Resources>                                 
<DataTemplate DataType="{x:Type Models:HouseDetail}" >                                               
<Views:HouseView>           
</DataTemplate>
<ListBox.Resources>

This is pretty much how my data is generated which again is giving me a flow of like “top to bottom” whereas I would like it to show “left to right”.
eg: 1 2 3 <– (what I want)
instead of

1

2

3

  • 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-02T04:25:34+00:00Added an answer on June 2, 2026 at 4:25 am

    If want to display a list then you should look at a Listbox control. For each item in the list you can describe how you want the item to be laid out using an ItemTemplate. See the ItemTemplate documentation for more informaiton on using ItemTemplates.

    Have an object representing your list items (eg the House class). Create an ObservableCollection of your list items and bind your Listbox to the ObservableCollection. Then, in the XAML, describe the layout of each House item and how you want it to look. Something like this should work:

    Code

    public class House 
    {
         public string Color { get; set; }
         public string Material { get;set; }
         public string Window { get; set; }
    }
    
    
    public class ViewModel
    {
        public ObservableCollection<House> Houses { get; set; }
    }
    

    XAML:

      <!-- DataContext should be set to an instance of ViewModel -->
     <ListBox ItemsSource="{Binding Houses}">
         <ListBox.ItemTemplate>
             <DataTemplate>
                 <StackPanel>
                     <!-- I am just using StackPanels here, but you can use any layout control you want to describe how you want each list item to look --> 
                     <StackPanel Orientation=Horizontal>
                         <TextBlock Text="House Color:"/>
                         <TextBlock Text="{Binding Path=Color}"/>
                     </StackPanel>
                     <StackPanel Orientation=Horizontal>
                         <TextBlock Text="House Material:"/>
                         <TextBlock Text="{Binding Path=Material}"/>
                     </StackPanel>
                     <!-- Add more controls to show more information -->
                 </StackPanel>
             </DataTemplate>
         </ListBox.ItemTemplate>
     </ListBox>
    

    Sorry, I don’t have a compiler handy so I’m not sure if this will compile, but it should be close.

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

Sidebar

Related Questions

Sorry if this is kind of a noob question, but I'm just starting to
Sorry, this might be a basic/stupid/noob question - I am just trying to tweak
Sorry this is a basic question, but all my research just barely missed answering
Hi Sorry for this noob question but here goes...i have a working slidetoggle on
I am new to drupal, so sorry for this noob question, but I was
Sorry if this is a noob question, but All my code is error-free and
Question: Hello All, Sorry that this is kind of a noob question. I just
I'm sorry if this question is noob-ish but I'm not having much luck with
Sorry if this is a noob question but is there a way to combine
I'm sorry if this is an absolute noob question, but I can't figure this

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.