Grid autosize problem in Window with Expanders!<p>I am using .NET Framework 3.5 SP1, Silverlight 2 Beta 2, and Expression Blend 2.5 June Preview.<br><br>I am having a problem with a Window that will not size itself to fit the content in height. When I expand an expander, all rows below the row with the expander in, gets moved below the window in the grid, and becomes invisible. Please try the code by yourself, and try to help me figure out why.<br><br>Here's my XAML.<br><br>&lt;Window x:Class=&quot;Window7&quot;<br>    xmlns=&quot;<a href="http://schemas.microsoft.com/winfx/2006/xaml/presentation">http://schemas.microsoft.com/winfx/2006/xaml/presentation</a>&quot;<br>    xmlns:x=&quot;<a href="http://schemas.microsoft.com/winfx/2006/xaml">http://schemas.microsoft.com/winfx/2006/xaml</a>&quot;<br>    Title=&quot;Coldflame version 3&quot; Width=&quot;410&quot; Background=&quot;{x:Null}&quot; WindowStyle=&quot;None&quot; Opacity=&quot;1&quot; AllowsTransparency=&quot;True&quot; ResizeMode=&quot;NoResize&quot; Topmost=&quot;True&quot; SizeToContent=&quot;Height&quot; x:Name=&quot;CustomMessageBox&quot; WindowStartupLocation=&quot;Manual&quot; HorizontalAlignment=&quot;Stretch&quot; VerticalAlignment=&quot;Stretch&quot; HorizontalContentAlignment=&quot;Left&quot; VerticalContentAlignment=&quot;Top&quot; xmlns:d=&quot;<a href="http://schemas.microsoft.com/expression/blend/2008">http://schemas.microsoft.com/expression/blend/2008</a>&quot; xmlns:mc=&quot;<a href="http://schemas.openxmlformats.org/markup-compatibility/2006">http://schemas.openxmlformats.org/markup-compatibility/2006</a>&quot; mc:Ignorable=&quot;d&quot;&gt;<br>    &lt;Grid Background=&quot;{x:Null}&quot; HorizontalAlignment=&quot;Stretch&quot; VerticalAlignment=&quot;Stretch&quot; Height=&quot;Auto&quot; ShowGridLines=&quot;True&quot; ScrollViewer.VerticalScrollBarVisibility=&quot;Visible&quot; ClipToBounds=&quot;True&quot;&gt;<br>        &lt;Grid.RowDefinitions&gt;<br>            &lt;RowDefinition Height=&quot;Auto&quot; MinHeight=&quot;56&quot; /&gt;<br>         &lt;RowDefinition Height=&quot;Auto&quot; MinHeight=&quot;5&quot;/&gt;<br>         &lt;RowDefinition Height=&quot;Auto&quot; MinHeight=&quot;5&quot; /&gt;<br>         &lt;RowDefinition Height=&quot;*&quot; MinHeight=&quot;5&quot; /&gt;<br>            &lt;RowDefinition Height=&quot;Auto&quot; MinHeight=&quot;43&quot; /&gt;<br>        &lt;/Grid.RowDefinitions&gt;<br>        &lt;Rectangle Stroke=&quot;#FFFFFFFF&quot; Margin=&quot;0,0,0,0&quot; Grid.Row=&quot;0&quot; RadiusX=&quot;10&quot; RadiusY=&quot;10&quot; Opacity=&quot;0.8&quot; x:Name=&quot;MainRectangle&quot; Grid.RowSpan=&quot;5&quot; Height=&quot;Auto&quot; ClipToBounds=&quot;True&quot;&gt;<br>      &lt;Rectangle.Fill&gt;<br>       &lt;LinearGradientBrush EndPoint=&quot;0.5,1&quot; StartPoint=&quot;0.5,0&quot;&gt;<br>        &lt;GradientStop Color=&quot;#FF1A00FF&quot; Offset=&quot;0&quot;/&gt;<br>        &lt;GradientStop Color=&quot;#FF000000&quot; Offset=&quot;1&quot;/&gt;<br>        &lt;GradientStop Color=&quot;#FF0C0074&quot; Offset=&quot;0.121&quot;/&gt;<br>        &lt;GradientStop Color=&quot;#FF000000&quot; Offset=&quot;0.647&quot;/&gt;<br>       &lt;/LinearGradientBrush&gt;<br>      &lt;/Rectangle.Fill&gt;<br>     &lt;/Rectangle&gt;<br>        &lt;TextBlock Margin=&quot;12,12,33.96,0&quot; Height=&quot;15.96&quot; VerticalAlignment=&quot;Top&quot; Text=&quot;Coldflame version 3&quot; Foreground=&quot;#FFFFFFFF&quot; ScrollViewer.IsDeferredScrollingEnabled=&quot;False&quot; TextWrapping=&quot;Wrap&quot; x:Name=&quot;MainTitle&quot; Opacity=&quot;100&quot; /&gt;<br>        &lt;TextBlock Foreground=&quot;White&quot; Margin=&quot;12,33.96,12,6&quot; x:Name=&quot;MainContent&quot; Opacity=&quot;100&quot; ScrollViewer.IsDeferredScrollingEnabled=&quot;False&quot; Text=&quot;Notification description&quot; TextWrapping=&quot;Wrap&quot; /&gt;<br>        &lt;Expander Grid.Row=&quot;1&quot; Foreground=&quot;White&quot; Header=&quot;Notification options&quot; IsExpanded=&quot;False&quot; x:Name=&quot;NotificationOptions&quot; Margin=&quot;12,6,12,6&quot; Style=&quot;{DynamicResource Flamefusion_Expander}&quot; Grid.RowSpan=&quot;1&quot;&gt;<br>            &lt;Grid Height=&quot;Auto&quot; Margin=&quot;5&quot;&gt;<br>                &lt;CheckBox Style=&quot;{DynamicResource Flamefusion_CheckBox}&quot; Foreground=&quot;White&quot; Height=&quot;Auto&quot; HorizontalAlignment=&quot;Left&quot; IsChecked=&quot;False&quot; Margin=&quot;0,0,0,0&quot; VerticalAlignment=&quot;Top&quot; Width=&quot;Auto&quot; x:Name=&quot;CheckBox1&quot; Content=&quot;Do not show messages with this title again&quot;/&gt;<br>            &lt;/Grid&gt;<br>        &lt;/Expander&gt;<br>        &lt;Expander Foreground=&quot;White&quot; Header=&quot;Technical details&quot; IsExpanded=&quot;False&quot; Margin=&quot;12,6,12,6&quot; Style=&quot;{DynamicResource Flamefusion_Expander}&quot; Grid.Row=&quot;2&quot; Grid.RowSpan=&quot;1&quot; x:Name=&quot;TechnicalDetailsExpander&quot;&gt;<br>            &lt;Grid Height=&quot;Auto&quot; Margin=&quot;5&quot;&gt;<br>                &lt;TextBox Background=&quot;{x:Null}&quot; x:Name=&quot;Details&quot; Style=&quot;{DynamicResource Flamefusion_TextBox}&quot; Height=&quot;56&quot; VerticalAlignment=&quot;Top&quot; VerticalScrollBarVisibility=&quot;Visible&quot; TextWrapping=&quot;Wrap&quot; /&gt;<br>                &lt;CheckBox Style=&quot;{DynamicResource Flamefusion_CheckBox}&quot; Foreground=&quot;White&quot; IsChecked=&quot;True&quot; Margin=&quot;0,55,0,0&quot; VerticalAlignment=&quot;Top&quot; Height=&quot;23.96&quot; x:Name=&quot;CheckBox2&quot; Content=&quot;Allow this to be shared with Flamefusion&quot;/&gt;<br>            &lt;/Grid&gt;<br>        &lt;/Expander&gt;<br>        &lt;Button Foreground=&quot;White&quot; HorizontalAlignment=&quot;Right&quot; Margin=&quot;0,0,14,12&quot; x:Name=&quot;Button1&quot; Style=&quot;{DynamicResource Flamefusion_Button}&quot; Width=&quot;89&quot; Grid.Row=&quot;4&quot; Height=&quot;31&quot; VerticalAlignment=&quot;Bottom&quot; Content=&quot;Button1&quot;/&gt;<br>        &lt;Button Foreground=&quot;White&quot; Margin=&quot;0,0,109,12&quot; x:Name=&quot;Button2&quot; Style=&quot;{DynamicResource Flamefusion_Button}&quot; Grid.Row=&quot;4&quot; HorizontalAlignment=&quot;Right&quot; Width=&quot;89&quot; Height=&quot;31&quot; VerticalAlignment=&quot;Bottom&quot; Content=&quot;Button2&quot;/&gt;<br>        &lt;Button Foreground=&quot;White&quot; HorizontalAlignment=&quot;Right&quot; Margin=&quot;0,0,204,12&quot; x:Name=&quot;Button3&quot; Style=&quot;{DynamicResource Flamefusion_Button}&quot; Width=&quot;89&quot; Grid.Row=&quot;4&quot; Height=&quot;31&quot; VerticalAlignment=&quot;Bottom&quot; Content=&quot;Button3&quot;/&gt;<br>    &lt;/Grid&gt;<br>&lt;/Window&gt;</p><hr size="1" align="left" width="25%">- Mathy Flamefusion developer© 2009 Microsoft Corporation. All rights reserved.Wed, 09 Jul 2008 04:26:20 Z58b9041d-2c58-4bf6-8480-5ea00f59af66http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/58b9041d-2c58-4bf6-8480-5ea00f59af66#58b9041d-2c58-4bf6-8480-5ea00f59af66http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/58b9041d-2c58-4bf6-8480-5ea00f59af66#58b9041d-2c58-4bf6-8480-5ea00f59af66Mathias Lorenzenhttp://social.msdn.microsoft.com/Profile/en-US/?user=Mathias%20LorenzenGrid autosize problem in Window with Expanders!<p>I am using .NET Framework 3.5 SP1, Silverlight 2 Beta 2, and Expression Blend 2.5 June Preview.<br><br>I am having a problem with a Window that will not size itself to fit the content in height. When I expand an expander, all rows below the row with the expander in, gets moved below the window in the grid, and becomes invisible. Please try the code by yourself, and try to help me figure out why.<br><br>Here's my XAML.<br><br>&lt;Window x:Class=&quot;Window7&quot;<br>    xmlns=&quot;<a href="http://schemas.microsoft.com/winfx/2006/xaml/presentation">http://schemas.microsoft.com/winfx/2006/xaml/presentation</a>&quot;<br>    xmlns:x=&quot;<a href="http://schemas.microsoft.com/winfx/2006/xaml">http://schemas.microsoft.com/winfx/2006/xaml</a>&quot;<br>    Title=&quot;Coldflame version 3&quot; Width=&quot;410&quot; Background=&quot;{x:Null}&quot; WindowStyle=&quot;None&quot; Opacity=&quot;1&quot; AllowsTransparency=&quot;True&quot; ResizeMode=&quot;NoResize&quot; Topmost=&quot;True&quot; SizeToContent=&quot;Height&quot; x:Name=&quot;CustomMessageBox&quot; WindowStartupLocation=&quot;Manual&quot; HorizontalAlignment=&quot;Stretch&quot; VerticalAlignment=&quot;Stretch&quot; HorizontalContentAlignment=&quot;Left&quot; VerticalContentAlignment=&quot;Top&quot; xmlns:d=&quot;<a href="http://schemas.microsoft.com/expression/blend/2008">http://schemas.microsoft.com/expression/blend/2008</a>&quot; xmlns:mc=&quot;<a href="http://schemas.openxmlformats.org/markup-compatibility/2006">http://schemas.openxmlformats.org/markup-compatibility/2006</a>&quot; mc:Ignorable=&quot;d&quot;&gt;<br>    &lt;Grid Background=&quot;{x:Null}&quot; HorizontalAlignment=&quot;Stretch&quot; VerticalAlignment=&quot;Stretch&quot; Height=&quot;Auto&quot; ShowGridLines=&quot;True&quot; ScrollViewer.VerticalScrollBarVisibility=&quot;Visible&quot; ClipToBounds=&quot;True&quot;&gt;<br>        &lt;Grid.RowDefinitions&gt;<br>            &lt;RowDefinition Height=&quot;Auto&quot; MinHeight=&quot;56&quot; /&gt;<br>         &lt;RowDefinition Height=&quot;Auto&quot; MinHeight=&quot;5&quot;/&gt;<br>         &lt;RowDefinition Height=&quot;Auto&quot; MinHeight=&quot;5&quot; /&gt;<br>         &lt;RowDefinition Height=&quot;*&quot; MinHeight=&quot;5&quot; /&gt;<br>            &lt;RowDefinition Height=&quot;Auto&quot; MinHeight=&quot;43&quot; /&gt;<br>        &lt;/Grid.RowDefinitions&gt;<br>        &lt;Rectangle Stroke=&quot;#FFFFFFFF&quot; Margin=&quot;0,0,0,0&quot; Grid.Row=&quot;0&quot; RadiusX=&quot;10&quot; RadiusY=&quot;10&quot; Opacity=&quot;0.8&quot; x:Name=&quot;MainRectangle&quot; Grid.RowSpan=&quot;5&quot; Height=&quot;Auto&quot; ClipToBounds=&quot;True&quot;&gt;<br>      &lt;Rectangle.Fill&gt;<br>       &lt;LinearGradientBrush EndPoint=&quot;0.5,1&quot; StartPoint=&quot;0.5,0&quot;&gt;<br>        &lt;GradientStop Color=&quot;#FF1A00FF&quot; Offset=&quot;0&quot;/&gt;<br>        &lt;GradientStop Color=&quot;#FF000000&quot; Offset=&quot;1&quot;/&gt;<br>        &lt;GradientStop Color=&quot;#FF0C0074&quot; Offset=&quot;0.121&quot;/&gt;<br>        &lt;GradientStop Color=&quot;#FF000000&quot; Offset=&quot;0.647&quot;/&gt;<br>       &lt;/LinearGradientBrush&gt;<br>      &lt;/Rectangle.Fill&gt;<br>     &lt;/Rectangle&gt;<br>        &lt;TextBlock Margin=&quot;12,12,33.96,0&quot; Height=&quot;15.96&quot; VerticalAlignment=&quot;Top&quot; Text=&quot;Coldflame version 3&quot; Foreground=&quot;#FFFFFFFF&quot; ScrollViewer.IsDeferredScrollingEnabled=&quot;False&quot; TextWrapping=&quot;Wrap&quot; x:Name=&quot;MainTitle&quot; Opacity=&quot;100&quot; /&gt;<br>        &lt;TextBlock Foreground=&quot;White&quot; Margin=&quot;12,33.96,12,6&quot; x:Name=&quot;MainContent&quot; Opacity=&quot;100&quot; ScrollViewer.IsDeferredScrollingEnabled=&quot;False&quot; Text=&quot;Notification description&quot; TextWrapping=&quot;Wrap&quot; /&gt;<br>        &lt;Expander Grid.Row=&quot;1&quot; Foreground=&quot;White&quot; Header=&quot;Notification options&quot; IsExpanded=&quot;False&quot; x:Name=&quot;NotificationOptions&quot; Margin=&quot;12,6,12,6&quot; Style=&quot;{DynamicResource Flamefusion_Expander}&quot; Grid.RowSpan=&quot;1&quot;&gt;<br>            &lt;Grid Height=&quot;Auto&quot; Margin=&quot;5&quot;&gt;<br>                &lt;CheckBox Style=&quot;{DynamicResource Flamefusion_CheckBox}&quot; Foreground=&quot;White&quot; Height=&quot;Auto&quot; HorizontalAlignment=&quot;Left&quot; IsChecked=&quot;False&quot; Margin=&quot;0,0,0,0&quot; VerticalAlignment=&quot;Top&quot; Width=&quot;Auto&quot; x:Name=&quot;CheckBox1&quot; Content=&quot;Do not show messages with this title again&quot;/&gt;<br>            &lt;/Grid&gt;<br>        &lt;/Expander&gt;<br>        &lt;Expander Foreground=&quot;White&quot; Header=&quot;Technical details&quot; IsExpanded=&quot;False&quot; Margin=&quot;12,6,12,6&quot; Style=&quot;{DynamicResource Flamefusion_Expander}&quot; Grid.Row=&quot;2&quot; Grid.RowSpan=&quot;1&quot; x:Name=&quot;TechnicalDetailsExpander&quot;&gt;<br>            &lt;Grid Height=&quot;Auto&quot; Margin=&quot;5&quot;&gt;<br>                &lt;TextBox Background=&quot;{x:Null}&quot; x:Name=&quot;Details&quot; Style=&quot;{DynamicResource Flamefusion_TextBox}&quot; Height=&quot;56&quot; VerticalAlignment=&quot;Top&quot; VerticalScrollBarVisibility=&quot;Visible&quot; TextWrapping=&quot;Wrap&quot; /&gt;<br>                &lt;CheckBox Style=&quot;{DynamicResource Flamefusion_CheckBox}&quot; Foreground=&quot;White&quot; IsChecked=&quot;True&quot; Margin=&quot;0,55,0,0&quot; VerticalAlignment=&quot;Top&quot; Height=&quot;23.96&quot; x:Name=&quot;CheckBox2&quot; Content=&quot;Allow this to be shared with Flamefusion&quot;/&gt;<br>            &lt;/Grid&gt;<br>        &lt;/Expander&gt;<br>        &lt;Button Foreground=&quot;White&quot; HorizontalAlignment=&quot;Right&quot; Margin=&quot;0,0,14,12&quot; x:Name=&quot;Button1&quot; Style=&quot;{DynamicResource Flamefusion_Button}&quot; Width=&quot;89&quot; Grid.Row=&quot;4&quot; Height=&quot;31&quot; VerticalAlignment=&quot;Bottom&quot; Content=&quot;Button1&quot;/&gt;<br>        &lt;Button Foreground=&quot;White&quot; Margin=&quot;0,0,109,12&quot; x:Name=&quot;Button2&quot; Style=&quot;{DynamicResource Flamefusion_Button}&quot; Grid.Row=&quot;4&quot; HorizontalAlignment=&quot;Right&quot; Width=&quot;89&quot; Height=&quot;31&quot; VerticalAlignment=&quot;Bottom&quot; Content=&quot;Button2&quot;/&gt;<br>        &lt;Button Foreground=&quot;White&quot; HorizontalAlignment=&quot;Right&quot; Margin=&quot;0,0,204,12&quot; x:Name=&quot;Button3&quot; Style=&quot;{DynamicResource Flamefusion_Button}&quot; Width=&quot;89&quot; Grid.Row=&quot;4&quot; Height=&quot;31&quot; VerticalAlignment=&quot;Bottom&quot; Content=&quot;Button3&quot;/&gt;<br>    &lt;/Grid&gt;<br>&lt;/Window&gt;</p><hr size="1" align="left" width="25%">- Mathy Flamefusion developerFri, 04 Jul 2008 09:27:54 Z2008-07-04T09:27:54Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/58b9041d-2c58-4bf6-8480-5ea00f59af66#b5b57b4a-9816-4179-bb76-c67e25e389afhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/58b9041d-2c58-4bf6-8480-5ea00f59af66#b5b57b4a-9816-4179-bb76-c67e25e389afMarco Zhouhttp://social.msdn.microsoft.com/Profile/en-US/?user=Marco%20ZhouGrid autosize problem in Window with Expanders!I cannot reproduce this problem, the code you pasted above works correctly for me, could you please elaborate if there is any other steps I need to follow to repro this issue.<br><br>Thanks<br> Wed, 09 Jul 2008 04:26:20 Z2008-07-09T04:26:20Z