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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:04:08+00:00 2026-05-22T03:04:08+00:00

Once the gridsplitter is used to resize a grid the row * will not

  • 0

Once the gridsplitter is used to resize a grid the row * will not reclaim the space when the other rows are collapsed.

I have the following grid in a master detail view with three rows. A data grid on top a splitter in the middle and a contentcontrol view in the last row. The splitter has a close button on it to collapse the detail. This all works with the exception that once the user resizes using the gridsplitter.

    <Grid Margin="3,0">
    <Grid.RowDefinitions>
        <RowDefinition Height="*"/>
        <RowDefinition Style="{StaticResource CollapsableRow}"/><!-- Splitter Here -->
        <RowDefinition Style="{StaticResource CollapsableRow}"/>
    </Grid.RowDefinitions>

The GridSplitter style:

    <Style x:Key="gridSplitterStyle" TargetType="{x:Type GridSplitter}">
    <Setter Property="Visibility" Value="{Binding IsItemSelected, Converter={StaticResource BoolToShow},ConverterParameter='Visible|Collapsed'}" />
    <Setter Property="Width" Value="Auto"/>
    <Setter Property="Height" Value="14"/>
    <Setter Property="HorizontalAlignment" Value="Stretch"/>
    <Setter Property="Border.BorderBrush" Value="#FF6593CF" />
    <Setter Property="Border.BorderThickness" Value="0,1,0,0" />
    <Setter Property="UIElement.SnapsToDevicePixels" Value="True" />
    <Setter Property="UIElement.Focusable" Value="False" />
    <Setter Property="Control.Padding" Value="7,7,7,7" />
    <Setter Property="Cursor" Value="SizeNS" /></Style>

Like I said the collapse works correctly unless the gridsplitter is used to resize. After that the whitespace stays.

EDIT:
H.B. and codenaked had simple and consistant suggestions so and I attempted to implement them w/o success in a data trigger:

<Style x:Key="CollapsableRow" TargetType="{x:Type RowDefinition}">
    <Style.Triggers>
        <DataTrigger Binding="{Binding SelectedItem, Converter={StaticResource IsNullConverter}}" Value="True">
            <Setter Property="RowDefinition.Height" Value="0"/>
        </DataTrigger>
        <DataTrigger Binding="{Binding SelectedItem, Converter={StaticResource IsNullConverter}}" Value="False">
            <Setter Property="RowDefinition.Height" Value="Auto"/>
        </DataTrigger>            
    </Style.Triggers>
</Style>   
  • 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-22T03:04:09+00:00Added an answer on May 22, 2026 at 3:04 am

    Since the grid splitter and detail were already being hidden Visibility was the obvious choice to reset the next row definition height.

     /// <summary>
    /// Grid splitter that show or hides the following row when the visibility of the splitter is changed. 
    /// </summary>
    public class HidableGridSplitter : GridSplitter { 
    
        GridLength height;
    
        public HidableGridSplitter()
        {
            this.IsVisibleChanged += HideableGridSplitter_IsVisibleChanged;
            this.Initialized += HideableGridSplitter_Initialized;
        }
    
        void HideableGridSplitter_Initialized(object sender, EventArgs e)
        {
            //Cache the initial RowDefinition height,
            //so it is not always assumed to be "Auto"
            Grid parent = base.Parent as Grid;
            if (parent == null) return;
            int rowIndex = Grid.GetRow(this);
            if (rowIndex + 1 >= parent.RowDefinitions.Count) return;
            var lastRow = parent.RowDefinitions[rowIndex + 1];
            height = lastRow.Height;
        }
    
        void HideableGridSplitter_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            Grid parent = base.Parent as Grid;
            if (parent == null) return;
    
            int rowIndex = Grid.GetRow(this);
    
            if (rowIndex + 1 >= parent.RowDefinitions.Count) return;
    
            var lastRow = parent.RowDefinitions[rowIndex + 1];
    
            if (this.Visibility == Visibility.Visible)
            {
                lastRow.Height = height;
            }
            else
            {
                height = lastRow.Height; 
                lastRow.Height = new GridLength(0);
            }
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using a GridSplitter to resize a cell in a grid however its
Once I have all the files I require in a particular folder, I would
Once the user is on my page, I do not want him to refresh
Once you have finished/reintegrated a branch, is it best practice to delete the branch
Once again, our best loved i=i-- -like issues. In C99 we have: 6.5 Expressions
I have a login.jsp page which contains a login form. Once logged in the
Once you run out of space, is there easier way to increase the Amazon
Once again.. i have the trigger below which has the function to keep/set the
Once, to have a complete control over the head/body of HTTP messages - I
Once in a while I have to fuddle around with mod_rewrite or rather Apache's

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.