MahApps / MahApps.Metro

A framework that allows developers to cobble together a better UI for their own WPF applications with minimal effort.
https://mahapps.com
MIT License
9.34k stars 2.44k forks source link

CleanWindow Width #1847

Closed JDCain closed 9 years ago

JDCain commented 9 years ago

On any window I apply the CleanWindowStyle a minimum width seems to take effect which I have not found a way to override. I am attempting to have a window width of 175 image

<Controls:MetroWindow x:Class="Vigil.View.CleanWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
        xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
        xmlns:behaviours="clr-namespace:MahApps.Metro.Behaviours;assembly=MahApps.Metro"
        Title="CleanWindow" Height="300" Width="175"                     
        Style="{DynamicResource MyCleanWindowStyle}">
    <Window.Resources>
        <ResourceDictionary>
            <Style x:Key="MyCleanWindowStyle" TargetType="{x:Type Controls:MetroWindow}" BasedOn="{StaticResource CleanWindowStyleKey}" />
            <ResourceDictionary.MergedDictionaries>                
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Emerald.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Clean/Clean.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>

    <Grid>

    </Grid>
</Controls:MetroWindow>
AzureKitsune commented 9 years ago

When I made the CleanWindow style, I set the MinWidth to about 400 to preview the titlebar from overlapping.

https://github.com/MahApps/MahApps.Metro/blob/master/MahApps.Metro/Styles/Clean/CleanWindow.xaml#L264

You can copy the style and replace that setter if you want to make the window smaller.

JDCain commented 9 years ago

Thank you very much for your help! I should have checked that.

ghost commented 9 years ago

Hey man how do you get that awsome dark style?

robertstefan commented 9 years ago

@NicoTravassos see the VS style it's in the sample application :)

ghost commented 9 years ago

Thanks man

punker76 commented 9 years ago

@NicoTravassos @robertstefan the dark style comes from

<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />
robertstefan commented 9 years ago

@punker76 and i had the impression for a moment it was the one from the VS... :disappointed: My bad.

ghost commented 9 years ago

@punker76 :+1: