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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:17:21+00:00 2026-05-28T19:17:21+00:00

Given the following XAML my goal is to keep the columns AAA, BBB, CCC

  • 0

Given the following XAML my goal is to keep the columns AAA, BBB, CCC always visible. The columns with the listboxes can resize all the way to zero though.

If I remove the ListBoxes then the application works exactly the way I want it to. That is, it doesn’t have the weird behavior where the min widths are not respected.

With the listboxes (or DataGrids) the following XAML has this behavior:

After starting the application, if I drag the splitterA all the way close to BBB (BBB will keep the desired width of 25), then drag the splitterB all the way to the right then AAA will have the desired width of 25.

On the other hand, after starting the application, if I drag splitterA all the way to the right (AAA will keep the desired width of 25), then drag the splitterB all the way to the right then AAA will go off the screen. Surprisingly if I then drag the splitterA just a pixel to the left then both columns will “snap” into the correct place.

<Grid Background="CadetBlue" >
  <Grid.ColumnDefinitions>
    <ColumnDefinition Width="Auto"/>
    <ColumnDefinition />
    <ColumnDefinition MinWidth="60"/>
  </Grid.ColumnDefinitions>
  <TextBlock Text="CCC" Width="25"  />
  <ListBox Grid.Column="1"  />
  <GridSplitter Width="5" Grid.Column="2" Name="splitterB" HorizontalAlignment="Left" />
  <Grid Background="Aqua" Grid.Column="2" Margin="5,0,0,0" >
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="Auto"/>
      <ColumnDefinition />
      <ColumnDefinition MinWidth="30"/>
    </Grid.ColumnDefinitions>
    <TextBlock Text="BBB" Width="25"  />
    <ListBox Grid.Column="1"  />

    <GridSplitter Width="5" Grid.Column="2" Name="splitterA" HorizontalAlignment="Left"  />
    <Grid Background="BurlyWood"  Grid.Column="2" Margin="5,0,0,0" >
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition />
      </Grid.ColumnDefinitions>
      <TextBlock Text="AAA" Width="25"  />
      <ListBox Grid.Column="1"  />
    </Grid>
  </Grid>
</Grid>

Why does it work when I remove the listboxes?

Note: I modified the question and XAML code slightly to clarify things and also to show what I just found about the listboxes.

  • 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-28T19:17:22+00:00Added an answer on May 28, 2026 at 7:17 pm

    It’s a WPF bug:

    https://connect.microsoft.com/VisualStudio/feedback/details/636072/msdn-forum-grid-layout-issue-with-minwidth-starsizing

    http://social.msdn.microsoft.com/Forums/en/wpf/thread/24460784-7d09-4627-89fe-975e0ca7b303

    I got around it with a hack. If anyone has a better solution I’d love to hear it…

    XAML:

    <Grid Background="CadetBlue" >
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition />
        <ColumnDefinition MinWidth="60"/>
      </Grid.ColumnDefinitions>
      <TextBlock Text="CCC" Width="25"  />
      <ListBox Grid.Column="1"  />
      <GridSplitter Width="5" Grid.Column="2" Name="splitterB" HorizontalAlignment="Left" DragDelta="splitterB_DragDelta" />
      <Grid Background="Aqua" Grid.Column="2" Margin="5,0,0,0" >
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto"/>
          <ColumnDefinition Name="bbbColumn"/>
          <ColumnDefinition MinWidth="30"/>
        </Grid.ColumnDefinitions>
        <TextBlock Text="BBB" Width="25"  />
        <ListBox Grid.Column="1" Name="bbbListBox" />
    
        <GridSplitter Width="5" Grid.Column="2" Name="splitterA" HorizontalAlignment="Left" DragDelta="splitterA_DragDelta" />
        <Grid Background="BurlyWood"  Grid.Column="2" Margin="5,0,0,0" >
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition />
          </Grid.ColumnDefinitions>
          <TextBlock Text="AAA" Width="25"  />
          <ListBox Grid.Column="1"  />
        </Grid>
      </Grid>
    </Grid>
    

    Code:

    private void ToggleWidths()
    {
      if (bbbColumn.ActualWidth < 10
        && bbbListBox.Visibility != System.Windows.Visibility.Collapsed)
        bbbListBox.Visibility = System.Windows.Visibility.Collapsed;
      else if (bbbColumn.ActualWidth >= 10
        && bbbListBox.Visibility != System.Windows.Visibility.Visible)
        bbbListBox.Visibility = System.Windows.Visibility.Visible;
    }
    
    private void splitterA_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e)
    {
      ToggleWidths();
    }
    
    private void splitterB_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e)
    {
      ToggleWidths();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the following XAML the editPanel is always visible. The overlayGrid is only visibile
Given the following bit of XAML <Border Name=Brder Visibility=Visible Width=10 Height=10 Background=Red></Border> <Button Content=Hide></Button>
Given the following code, is there a way I can call class A's version
Given the following XAML... <ComboBox x:Name=advisoriesComboBox DisplayMemberPath=Name ItemsSource={Binding Path=Advisories} SelectedItem={Binding Path=SelectedAdvisory} /> <Button Command={Binding
Given the following XAML: <TabControl DataContext={StaticResource mainVM} ItemsSource={Binding MovableVM.Docked, UpdateSourceTrigger=PropertyChanged}> <TabControl.ItemTemplate> <DataTemplate> <TextBlock> <TextBlock
Given the following XAML markup, I would expect the text in the Hyperlink to
Given the following XAML fragment: <ComboBox ItemsSource={Binding ListOfItems} SelectedItem={Binding CurrentItem, Mode=TwoWay}/> It would seem
Given the following code: <Window x:Class=WpfApplication76.Window1 xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:col=clr-namespace:System.Collections;assembly=mscorlib Title=Window1 Height=300 Width=300> <Window.Resources> <CollectionViewSource
given the following XAML code: <Canvas Name=MainView> <Canvas Name=TriangleElement Width=50 Height=50 Canvas.Left=110 Canvas.Top=100> <Canvas.RenderTransform>
Given the following xaml code, I would like to create this xaml code the

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.