Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
780
MinHeight\Width vs MinimizedHeight\Width
posted

 I'd like to limit my Dialog window min height & width when not minimized, but have it be a smaller size when minimized.  I try setting MinHeight & MinWidth to 400, and MnimizedHeight to 25, MinimizedWidth to 200.  But, then when I minimize the window, it stays 400x400.  I guess that's technically correct since I set that as min width\height, but I was assuming MinimizedHeight\Width would override those values when the window was minimized. 

Is there any way to achieve what I'm looking for?  The repro below shows what I mean.  I'd like it to stay at least 400x400 when not minimized, then be 200x25 when minimized.  Setting the MinimizedPanel's row height to 25 handles the height, but I still have the width problem. 

Thanks,
Keith

<Grid x:Name="LayoutRoot" >
    <Grid.RowDefinitions>
        <RowDefinition Height="*" />
        <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>

    <Canvas Grid.Row="0" >
        <igWindow:XamWebDialogWindow MinHeight="400" MinWidth="400" MinimizedHeight="25" MinimizedWidth="200" MinimizedPanel="{Binding ElementName=PanelMinimized}"/>
    </Canvas>
    <StackPanel x:Name="PanelMinimized" Grid.Row="1" />
</Grid> 

 

  • 4666
    Verified Answer
    posted

    Hi Keith, In XamWebDialogWindow MinWidth and MinHeight are with higher priority than MinimizedWidth and MinimizedHeight.

    XAML:

            <Grid x:Name="LayoutRoot" >
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <igWindow:XamWebDialogWindow Width="500" Height="500" SizeChanged="XamWebDialogWindow_SizeChanged"      MinimizedHeight="25" MinimizedWidth="200" MinimizedPanel="{Binding ElementName=PanelMinimized}"/>
                <StackPanel x:Name="PanelMinimized" Grid.Row="1" />
            </Grid>

    C#

            private void XamWebDialogWindow_SizeChanged(object sender, SizeChangedEventArgs e)
            {
                XamWebDialogWindow win = sender as XamWebDialogWindow;
                if (win != null)
                {
                    if (win.WindowState != Infragistics.Silverlight.WindowState.Minimized)
                    {
                        if (win.ActualWidth < 400)
                        {
                            win.Width = 400;
                        }
                        if (win.ActualHeight < 400)
                        {
                            win.Height = 400;
                        }
                    }
                }
            }

    You can use EventHandler for SizeChanged Event to implement desired behavior:

     

     

    Best Wishes!

    Mihail