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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T22:05:37+00:00 2026-05-28T22:05:37+00:00

I want to visually represent my data in columns, rather than the row representation

  • 0

I want to visually represent my data in columns, rather than the row representation of a DataGrid. You could think of my data as a List<Column> where a Column contains List<Cell>. The reason I do not transpose the data and just use a DataGrid is that I want to have the ability to add/remove columns dynamically, without having to process all of the data.

+--------------------------------------------+  
|            | Col Header | Col Header | ... |
| Row Header |    Cell    |   Cell     | ... |
|   ...      |     ...    |    ...     | ... |
+--------------------------------------------+

I have a sample of xaml that pretty much does what I want:

<StackPanel Orientation="Horizontal">
   <StackPanel Orientation="Vertical" VerticalAlignment="Top">
      <TextBox Text="" IsReadOnly="True" BorderThickness="0" HorizontalAlignment="Stretch"/>
      <TextBox Text="" IsReadOnly="True" BorderThickness="0,0,0,2" BorderBrush="Black" HorizontalAlignment="Stretch"/>
      <ItemsControl ItemsSource="{Binding RowHeaders}">
         <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
               <StackPanel Orientation="Vertical"/>
            </ItemsPanelTemplate>
         </ItemsControl.ItemsPanel>
         <ItemsControl.ItemTemplate>
            <DataTemplate>
               <TextBox Text="{Binding Mode=OneWay}" IsReadOnly="True" BorderThickness="0,0,2,2" BorderBrush="Black" FontWeight="Bold" />
            </DataTemplate>
         </ItemsControl.ItemTemplate>
      </ItemsControl>
   </StackPanel>
   <ItemsControl ItemsSource="{Binding Columns}">
      <ItemsControl.ItemsPanel>
         <ItemsPanelTemplate>
            <StackPanel Orientation="Horizontal" />
         </ItemsPanelTemplate>
      </ItemsControl.ItemsPanel>
      <ItemsControl.ItemTemplate>
         <DataTemplate>
            <StackPanel Orientation="Vertical" >
               <TextBox Text="{Binding ColHead1, Mode=OneWay}" IsReadOnly="True"  BorderThickness="0" FontWeight="Bold" HorizontalAlignment="Stretch"/>
               <TextBox Text="{Binding ColHead2, Mode=OneWay}" IsReadOnly="True" FontWeight="Bold" BorderThickness="0,0,0,2" BorderBrush="Black" HorizontalAlignment="Stretch"/>
               <ItemsControl ItemsSource="{Binding Cells}">
                  <ItemsControl.ItemsPanel>
                     <ItemsPanelTemplate>
                        <StackPanel Orientation="Vertical" />
                     </ItemsPanelTemplate>
                  </ItemsControl.ItemsPanel>
                  <ItemsControl.ItemTemplate>
                     <DataTemplate>
                        <TextBox x:Name="textBox" Text="{Binding}" IsReadOnly="{Binding IsReadOnly}" BorderThickness="0,0,0,2" BorderBrush="Black" HorizontalAlignment="Stretch"/>
                     </DataTemplate>
                  </ItemsControl.ItemTemplate>
               </ItemsControl>
            </StackPanel>
         </DataTemplate>
      </ItemsControl.ItemTemplate>
   </ItemsControl>
</StackPanel>

However, how can I ensure that my rows are always aligned? The cells within a column are guaranteed to be aligned since they are contained within a single ItemsControl. However, each column is inside its own StackPanel. Is there a way to ensure that all rows are aligned?

Also, does this seem like a good solution for the problem or is there a better alternative?

  • 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-28T22:05:37+00:00Added an answer on May 28, 2026 at 10:05 pm

    You should be able to use Grid.IsSharedSizeScope to make your rows share a size.

    I’ve used it in the past for making unassociated columns the same size, and there’s no reason it can’t be used for rows as well

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

Sidebar

Related Questions

I want visually represent table row data in a chart/graph but the chart should
I want to represent some data visually, using a visualization component. Now I want
My WPF TabControl contains multiple TabItems. I want to visually alert users that data
I have data that I want to represent visually. The actual data is a
Semantically, I want an itemized list, but visually I just want some space. How
I want to debug data structures and/or algorithms visually in inferior buffers (mainly python
I want to visually display my data on asp.net website as www.visualthesaurus.com display for
I want to link to bookmark on a page (mysite.com/mypage.htm#bookmark) AND visually highlight the
I want to see class, function and variable/property, dependencies visually, like NDepend , but
I want to use shift-tab for auto completion and shifting code blocks visually. I

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.