• Upgrade your Internet Experience
  • Sign in
  • Microsoft.com
  • United States (English)
    Brasil (Português)Česká republika (Čeština)Deutschland (Deutsch)España (Español)France (Français)Italia (Italiano)Россия (Русский)대한민국 (한국어)中华人民共和国 (中文)台灣 (中文)日本 (日本語)香港特别行政區 (中文)
 
 
.NET Framework Developer Center
 
 
Home
 
 
Library
 
 
Learn
 
 
Downloads
 
 
Support
 
 
Community
 
 
Forums
 
 
 
.NET Framework Developer Center > .NET Development Forums > Windows Presentation Foundation (WPF) > Grid autosize problem in Window with Expanders!
Ask a questionAsk a question
Search Forums:
  • Search Windows Presentation Foundation (WPF) Forum Search Windows Presentation Foundation (WPF) Forum
  • Search All .NET Development Forums Search All .NET Development Forums
  • Search All MSDN Forums Search All MSDN Forums
 

QuestionGrid autosize problem in Window with Expanders!

  • Friday, July 04, 2008 9:27 AMMathias Lorenzen Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code
    Vote As Helpful
    0

    I am using .NET Framework 3.5 SP1, Silverlight 2 Beta 2, and Expression Blend 2.5 June Preview.

    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.

    Here's my XAML.

    <Window x:Class="Window7"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Coldflame version 3" Width="410" Background="{x:Null}" WindowStyle="None" Opacity="1" AllowsTransparency="True" ResizeMode="NoResize" Topmost="True" SizeToContent="Height" x:Name="CustomMessageBox" WindowStartupLocation="Manual" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalContentAlignment="Left" VerticalContentAlignment="Top" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
        <Grid Background="{x:Null}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="Auto" ShowGridLines="True" ScrollViewer.VerticalScrollBarVisibility="Visible" ClipToBounds="True">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" MinHeight="56" />
             <RowDefinition Height="Auto" MinHeight="5"/>
             <RowDefinition Height="Auto" MinHeight="5" />
             <RowDefinition Height="*" MinHeight="5" />
                <RowDefinition Height="Auto" MinHeight="43" />
            </Grid.RowDefinitions>
            <Rectangle Stroke="#FFFFFFFF" Margin="0,0,0,0" Grid.Row="0" RadiusX="10" RadiusY="10" Opacity="0.8" x:Name="MainRectangle" Grid.RowSpan="5" Height="Auto" ClipToBounds="True">
          <Rectangle.Fill>
           <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="#FF1A00FF" Offset="0"/>
            <GradientStop Color="#FF000000" Offset="1"/>
            <GradientStop Color="#FF0C0074" Offset="0.121"/>
            <GradientStop Color="#FF000000" Offset="0.647"/>
           </LinearGradientBrush>
          </Rectangle.Fill>
         </Rectangle>
            <TextBlock Margin="12,12,33.96,0" Height="15.96" VerticalAlignment="Top" Text="Coldflame version 3" Foreground="#FFFFFFFF" ScrollViewer.IsDeferredScrollingEnabled="False" TextWrapping="Wrap" x:Name="MainTitle" Opacity="100" />
            <TextBlock Foreground="White" Margin="12,33.96,12,6" x:Name="MainContent" Opacity="100" ScrollViewer.IsDeferredScrollingEnabled="False" Text="Notification description" TextWrapping="Wrap" />
            <Expander Grid.Row="1" Foreground="White" Header="Notification options" IsExpanded="False" x:Name="NotificationOptions" Margin="12,6,12,6" Style="{DynamicResource Flamefusion_Expander}" Grid.RowSpan="1">
                <Grid Height="Auto" Margin="5">
                    <CheckBox Style="{DynamicResource Flamefusion_CheckBox}" Foreground="White" Height="Auto" HorizontalAlignment="Left" IsChecked="False" Margin="0,0,0,0" VerticalAlignment="Top" Width="Auto" x:Name="CheckBox1" Content="Do not show messages with this title again"/>
                </Grid>
            </Expander>
            <Expander Foreground="White" Header="Technical details" IsExpanded="False" Margin="12,6,12,6" Style="{DynamicResource Flamefusion_Expander}" Grid.Row="2" Grid.RowSpan="1" x:Name="TechnicalDetailsExpander">
                <Grid Height="Auto" Margin="5">
                    <TextBox Background="{x:Null}" x:Name="Details" Style="{DynamicResource Flamefusion_TextBox}" Height="56" VerticalAlignment="Top" VerticalScrollBarVisibility="Visible" TextWrapping="Wrap" />
                    <CheckBox Style="{DynamicResource Flamefusion_CheckBox}" Foreground="White" IsChecked="True" Margin="0,55,0,0" VerticalAlignment="Top" Height="23.96" x:Name="CheckBox2" Content="Allow this to be shared with Flamefusion"/>
                </Grid>
            </Expander>
            <Button Foreground="White" HorizontalAlignment="Right" Margin="0,0,14,12" x:Name="Button1" Style="{DynamicResource Flamefusion_Button}" Width="89" Grid.Row="4" Height="31" VerticalAlignment="Bottom" Content="Button1"/>
            <Button Foreground="White" Margin="0,0,109,12" x:Name="Button2" Style="{DynamicResource Flamefusion_Button}" Grid.Row="4" HorizontalAlignment="Right" Width="89" Height="31" VerticalAlignment="Bottom" Content="Button2"/>
            <Button Foreground="White" HorizontalAlignment="Right" Margin="0,0,204,12" x:Name="Button3" Style="{DynamicResource Flamefusion_Button}" Width="89" Grid.Row="4" Height="31" VerticalAlignment="Bottom" Content="Button3"/>
        </Grid>
    </Window>


    - Mathy Flamefusion developer
    • ReplyReply
    • QuoteQuote
     

All Replies

  • Wednesday, July 09, 2008 4:26 AMMarco ZhouMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Vote As Helpful
    0
    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.

    Thanks
    • ReplyReply
    • QuoteQuote
     
Need Help with Forums? (FAQ)
 
© 2009 Microsoft Corporation. All rights reserved.
Terms of Use
|
Trademarks
|
Privacy Statement