Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with window size #1938

Closed
Pekshev opened this issue May 28, 2015 · 1 comment
Closed

Problem with window size #1938

Pekshev opened this issue May 28, 2015 · 1 comment
Milestone

Comments

@Pekshev
Copy link

Pekshev commented May 28, 2015

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;
        }
    }
}
@punker76 punker76 added this to the 1.5.0 milestone Mar 9, 2017
@punker76
Copy link
Member

punker76 commented Mar 9, 2017

@Pekshev I retested this issue with the latest source and can not see any difference now between normal window and mahapps window.

sizetocontent_normal

sizetocontent_mahapps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants