Skip to content

Problem with window size #1938

@Pekshev

Description

@Pekshev

I use a window so that when you move the mouse - a one-size window. If you do not - the other window size
But reducing the window - is the minimum size of the width of the window

The problem appeared after the transition from version 0.14 to version 1.1.2

This on startup
1
This on mouse enter:
2
And after mouse leave:
3

Xaml:

<controls:MetroWindow x:Class="MetroProblem.MainWindow"
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                      xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
                      mc:Ignorable="d" MouseEnter="MainWindow_OnMouseEnter" MouseLeave="MainWindow_OnMouseLeave"
                      SizeToContent="WidthAndHeight" ResizeMode="NoResize" ShowMinButton="False" ShowMaxRestoreButton="False"
                      WindowStartupLocation="CenterScreen" BorderBrush="{DynamicResource AccentColorBrush}">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedSingleRowTabControl.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"></ColumnDefinition>
            <ColumnDefinition Width="Auto"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Label Name="Label" Grid.Row="0" Grid.Column="0">Some Label</Label>
        <Button Name="Button" Grid.Row="1" Grid.Column="1">Some Button</Button>
    </Grid>
</controls:MetroWindow>

and code-behind:

using System.Windows;
using System.Windows.Input;

namespace MetroProblem
{
    /// <summary>
    /// Логика взаимодействия для MainWindow.xaml
    /// </summary>
    public partial class MainWindow 
    {
        public MainWindow()
        {
            InitializeComponent();
            OnMouseLeave();
        }

        private void MainWindow_OnMouseEnter(object sender, MouseEventArgs e)
        {
            this.Button.Visibility = Visibility.Visible;
        }

        private void MainWindow_OnMouseLeave(object sender, MouseEventArgs e)
        {
                OnMouseLeave();
        }

        private void OnMouseLeave()
        {
            this.Button.Visibility = Visibility.Collapsed;
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions