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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:27:05+00:00 2026-05-20T07:27:05+00:00

I’d like to be able have equal heights of two DataGrid s based on

  • 0

I’d like to be able have equal heights of two DataGrids based on the DataGrid that have more data and become higher because of it. In other words, I’d like to have two DataGrids be the same in heights regardless data input. I have one row and few columns where one DataGrid takes one column and another DataGrid takes another column. In case, one of DataGrid gets more input then it extends taller. I want another DataGrid to be the same tall with empty space below. I am wondering how I can make it work. Any DataGrid should expand automatically based on the height of taller DataGrid. Any ideas are highly appreciated!

Below is sample XAML:

<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="DataGridExpand.MainWindow"
x:Name="Window"
Title="MainWindow"
Width="640" Height="480">

<Window.Resources>
    <XmlDataProvider x:Key="Info" XPath="Info/Values">
          <x:XData> 
            <Info xmlns="">
              <Values Name="Value1" />
              <Values Name="Value2"  />
              <Values Name="Value3" />
              <Values Name="Value4" />
              <Values Name="Value5"  />
              <Values Name="Value6"  />
              <Values Name="Value7"  />
              <Values Name="Value8"  />
              <Values Name="Value9"  />
            </Info>
          </x:XData>
    </XmlDataProvider>
    <XmlDataProvider x:Key="Info2" XPath="Info2/Values2">
          <x:XData> 
            <Info2 xmlns="">
              <Values2 Name="Value1" />
              <Values2 Name="Value2"  />
              <Values2 Name="Value3" />
              <Values2 Name="Value4" />
              <Values2 Name="Value5" />
            </Info2>
          </x:XData>
    </XmlDataProvider>
</Window.Resources>

<Grid x:Name="LayoutRoot" Margin="10" > 
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="49*" />
        <ColumnDefinition Width="20" />
        <ColumnDefinition Width="49*" />
    </Grid.ColumnDefinitions>
    <Border Padding="10" BorderBrush="Black" Background="#FFD2D2D2">
        <DataGrid x:Name="Main" GridLinesVisibility="Horizontal" AutoGenerateColumns="False" 
            ItemsSource="{Binding XPath=/Info2/Values2}"
            DataContext="{Binding Source={StaticResource Info2}}" Margin="10">
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding XPath=@Name}" Foreground="#FF6E6E6E" Width="160" />   
            </DataGrid.Columns>
        </DataGrid>
    </Border>
    <GridSplitter x:Name="GridSplitter" ResizeBehavior="PreviousAndNext" HorizontalAlignment="Stretch" Grid.Column="1" />
    <Border Grid.Column="2" Padding="10" BorderBrush="Black" Background="#FFD2D2D2">
        <DataGrid x:Name="Main1" GridLinesVisibility="Horizontal" AutoGenerateColumns="False" Margin="10"
            ItemsSource="{Binding XPath=/Info/Values}" 
            DataContext="{Binding Source={StaticResource Info}}">
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding XPath=@Name}" Foreground="#FF6E6E6E" Width="160" />   
            </DataGrid.Columns>
        </DataGrid>
    </Border>
</Grid>

  • 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-20T07:27:06+00:00Added an answer on May 20, 2026 at 7:27 am

    If I understand you right, you need to have both DataGrids to have the exactly same height? Try setting the MinimumHeight of one DataGrid to the ActualHeight of the other and vice versa. This may do the trick:

    <DataGrid x:Name="Main" 
        MinHeight="{Binding ElementName=Main1,Path=ActualHeight}"
        ...
    
    <DataGrid x:Name="Main1" GridLinesVisibility="Horizontal" AutoGenerateColumns="False"
        MinHeight="{Binding ElementName=Main,Path=ActualHeight}"
        ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to be able to have two protected classes in my package. That
I'd like to be able to call getProgram on objects which have that method,
I'd like to be able to extend ConfigurationManager so that I have an app.config
I have two dictionaries and I'd like to be able to make them one:
Problem I have a WPF Toolkit DataGrid , and I'd like to be able
I have the following data frame (info) that looks like this: > info[1:5,] field
I would like to be able to have hovering over the image invoke the
I want to be able to have default text like Enter content here... appear
I would like to be able to say things like cd [.fred] and have
I have a table and I would like to be able to set up

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.