MahApps.Metro icon indicating copy to clipboard operation
MahApps.Metro copied to clipboard

Trouble with windows borders (NoResize Windows)

Open cacapis opened this issue 11 years ago • 2 comments

Hello, please look at the image for the issue. I already tried several combinations of properties WindowsStyle, ResizeMode, AllowsTransparency and Background. I can't seem to find the right combination to eliminate the window borders. Mahapps version is 1.1.2 and XAML code of the window is at the bottom of the post. Am I missing something or is it not possible to remove the borders?

Thanks a lot.-

mahapps

<Controls:MetroWindow
    x:Class="MainWindow"       
    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"
    Height="134"
    ShowIconOnTitleBar="False"
    ShowMaxRestoreButton="False"
    ShowMinButton="False"
    ShowSystemMenuOnRightClick="False"
    Width="680"
    WindowTitleBrush="#FF119EDA" IsMaxRestoreButtonEnabled="False" IsMinButtonEnabled="False" ResizeMode="NoResize" WindowStyle="None" Background="#FF380101">
    <i:Interaction.Behaviors>
        <Behaviours:BorderlessWindowBehavior/>
    </i:Interaction.Behaviors>


    <Controls:MetroWindow.LeftWindowCommands>
        <Controls:WindowCommands>
            <Button Name="btnSnapTo"
                    Background="Black"
                    Content="z"
                    FontFamily="Wingdings 3"
                    Width="34"/>

            <TextBox Name="txtTarget"
                     BorderThickness="0"
                     FontFamily="Consolas"
                     HorizontalAlignment="Left"
                     HorizontalContentAlignment="Center"
                     Margin="0,1,0,0"
                     Text="srvtecro01"
                     VerticalAlignment="Top"
                     VerticalContentAlignment="Center"
                     Width="224"
                     Visibility="Visible"/>
        </Controls:WindowCommands>
    </Controls:MetroWindow.LeftWindowCommands>

    <Grid>
        <Button Content="Button" Height="25" HorizontalAlignment="Left" Margin="308,49,0,0" Name="Button2" Padding="0" VerticalAlignment="Top" Width="120" />
        <Button Content="New" Height="30" Margin="445,49,179,16" Width="34" />
        <Button Content="New" Height="30" Margin="-11,0,633,63" Width="34" />
        <Button Content="New" Height="30" Margin="636,0,-12,65" Width="34" />
    </Grid>
</Controls:MetroWindow>

cacapis avatar Apr 13 '15 20:04 cacapis

You can't click on those borders because they are used for resizing. Dragging these borders will result in the window being resized.

To modify you may edit the following line of BorderlessWindowBehavior.cs in your local copy of MahApps.Metro:

windowChrome = new WindowChrome
{
        ResizeBorderThickness = SystemParameters2.Current.WindowResizeBorderThickness,

Here ResizeBorderThickness is set to the system default. Set it to new Thickness(0).

Dotnetifier avatar Apr 26 '15 15:04 Dotnetifier

Thanks a lot for your answer.-

cacapis avatar May 07 '15 10:05 cacapis