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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:28:10+00:00 2026-05-23T18:28:10+00:00

I’m trying to get a DataGrid column to fill up the remaining space for

  • 0

I’m trying to get a DataGrid column to fill up the remaining space for the DataGrid, when the parent control contains a ScrollViewer without having the column take far more Width than the top level window.

As shown in the two images below, the datagrid itself behaves as desired if the DataGrid columns are set with Width="Auto". The DataGrid stretches to fill the width in the parent control, and allows the ScrollViewer to kick in as the control is sized down. However there is a lot of wasted space in the DataGrid.

No Scrolling

Scrolling

However, if I use Width="*" for the description column, the width of the control becomes significantly wider than the top level window.

enter image description here

There is a nearly identical question (unanswered) here.

Below is some sample XAML for the elements within the scrollviewer. I tried setting the MaxWidth of the DataGrid based on some parent width, which would reign in the space gobbling column, but that approach hasn’t worked so far. I could hard code a MaxWidth, but I want the DataGrid to stretch as much as possible to the visible area.

<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Background="{StaticResource ControlBackgroundBrush}">
    <Grid MinWidth="600" MinHeight="400">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="10"></ColumnDefinition>
            <ColumnDefinition Width="Auto"></ColumnDefinition>
            <ColumnDefinition Width="*"></ColumnDefinition>
            <ColumnDefinition Width="10"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Label Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" Style="{DynamicResource LabelHeader}" Content="{Binding Title, Mode=OneWay}" />
        <Label Grid.Row="1" Grid.Column="1" Style="{DynamicResource EntityIndexNameInput}" Content="{Binding EntityIndexNameLabel, Mode=OneWay}" />
        <Label Grid.Row="3" Grid.Column="1" Style="{DynamicResource DescriptionInput}" Content="{Binding DescriptionLabel, Mode=OneWay}" />
        <TextBox Grid.Row="1" Grid.Column="2" ToolTip="{Binding EntityIndexNameValidationMessage, Mode=OneWay}" Text="{Binding EntityIndexName, Mode=TwoWay, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}" MaxLength="255" Validation.ErrorTemplate="{x:Null}" Loaded="TextBox_Loaded" />
        <WrapPanel Grid.Row="2" Grid.Column="2">
            <CheckBox Style="{DynamicResource IsPrimaryKeyIndexInput}" ToolTip="{Binding IsPrimaryKeyIndexValidationMessage}" Content="{Binding IsPrimaryKeyIndexLabel, Mode=OneWay}" IsChecked="{Binding IsPrimaryKeyIndex}" />
            <CheckBox Style="{DynamicResource IsUniqueIndexInput}" ToolTip="{Binding IsUniqueIndexValidationMessage}" Content="{Binding IsUniqueIndexLabel, Mode=OneWay}" IsChecked="{Binding IsUniqueIndex}" />
        </WrapPanel>
        <TextBox Grid.Row="3" Grid.Column="2" ToolTip="{Binding DescriptionValidationMessage, Mode=OneWay}" Text="{Binding Description, Mode=TwoWay, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" TextWrapping="Wrap" Height="120" MaxLength="2000" Validation.ErrorTemplate="{x:Null}" />
        <GroupBox Header="{Binding Source={StaticResource labels}, Path=PropertiesHeader}" Grid.Row="4" Grid.Column="2">
            <Grid Margin="2">
                <DataGrid AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility="Column" ItemsSource="{Binding Items}" MaxWidth="{Binding RelativeSource={RelativeSource AncestorType=Grid}, Path=ActualSize.Width}">
                    <DataGrid.Columns>
                        <lib:BindableDataGridComboBoxColumn Header="{Binding Source={StaticResource labels}, Path=EntityIndexPropertyNameHeader}" DisplayMemberPath="PropertyName" SelectedValuePath="PropertyID" SelectedValueBinding="{Binding PropertyID}" ItemsSource="{Binding EntityDataProperties}" />
                        <DataGridTextColumn Header="{Binding Source={StaticResource labels}, Path=OrderHeader}" Binding="{Binding PropertyOrder, Mode=TwoWay}" Width="Auto" />
                        <DataGridTextColumn Header="{Binding Source={StaticResource labels}, Path=DescriptionHeader}" Binding="{Binding Description, Mode=TwoWay}" Width="*" />
                    </DataGrid.Columns>
                </DataGrid>
            </Grid>
        </GroupBox>
        <StackPanel Orientation="Horizontal" Grid.Row="5" Grid.Column="2" Margin="5">
            <Button Command="{Binding UpdateCommand}" Content="{Binding UpdateButtonLabel}"></Button>
            <Button Command="{Binding ResetCommand}" Content="{Binding ResetButtonLabel}"></Button>
            <Button Command="{Binding DefaultsCommand}" Content="{Binding DefaultsButtonLabel}"></Button>
            <Button Command="{Binding CloseConfirmCommand}" Content="{Binding CloseButtonLabel}"></Button>
        </StackPanel>
    </Grid>
</ScrollViewer>

Any other approaches to this issue?

  • 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-23T18:28:11+00:00Added an answer on May 23, 2026 at 6:28 pm

    I would try to prevent the content of the ScrollViewer from being too wide:

    <ScrollViewer ...>
        <Grid MinWidth="600" MinHeight="400"
              MaxWidth="{Binding ActualWidth,
                         RelativeSource={RelativeSource FindAncestor,
                                                        AncestorType=ScrollViewer}}">
            ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka

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.