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

MetroWindow v0.12.0.0 should not default to transparent #961

Closed
beugnen opened this issue Jan 20, 2014 · 14 comments
Closed

MetroWindow v0.12.0.0 should not default to transparent #961

beugnen opened this issue Jan 20, 2014 · 14 comments

Comments

@beugnen
Copy link

beugnen commented Jan 20, 2014

By default, MetroWindows in v12 without any reference to MahApps behaviours seem to be transparent by default and is confirmed by your FAQ here -

https://github.com/MahApps/MahApps.Metro/wiki/FAQ

Why on earth did you guys do this? I've not seen any other API on any platform do this. Yes I

e.g. the following code results in a transparent window

<Controls:MetroWindow  x:Class="MetroTest1.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"
        Title="MainWindow" Height="350" Width="525"
        AllowsTransparency="False">



    <Grid>
        <Button Content="Button"
                HorizontalAlignment="Left"
                Margin="220,28,0,0"
                VerticalAlignment="Top"
                Width="75" />
        <Label Content="Label"
               HorizontalAlignment="Left"
               Margin="38,25,0,0"
               VerticalAlignment="Top" />
        <TextBox HorizontalAlignment="Left"
                 Height="23"
                 Margin="81,28,0,0"
                 TextWrapping="Wrap"
                 Text="TextBox"
                 VerticalAlignment="Top"
                 Width="120" />

    </Grid>
</Controls:MetroWindow>

I can fix it by performing this new v12 step: (but why should I?)

<Controls:MetroWindow  x:Class="MetroTest1.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"
        Title="MainWindow" Height="350" Width="525"
        AllowsTransparency="False">

    <i:Interaction.Behaviors>
        <Behaviours:BorderlessWindowBehavior AllowsTransparency="False" />
    </i:Interaction.Behaviors>

    <Grid>
        <Button Content="Button"
                HorizontalAlignment="Left"
                Margin="220,28,0,0"
                VerticalAlignment="Top"
                Width="75" />
        <Label Content="Label"
               HorizontalAlignment="Left"
               Margin="38,25,0,0"
               VerticalAlignment="Top" />
        <TextBox HorizontalAlignment="Left"
                 Height="23"
                 Margin="81,28,0,0"
                 TextWrapping="Wrap"
                 Text="TextBox"
                 VerticalAlignment="Top"
                 Width="120" />

    </Grid>
</Controls:MetroWindow>

MOD EDIT: Please surround your code in ```s.

@AzureKitsune
Copy link
Member

The reason why AllowsTransparency is set to true is because for some odd reason, the glowing border effect requires it. It's default.

@beugnen
Copy link
Author

beugnen commented Jan 20, 2014

By default the window is transparent and therefore has no border let alone a glow!

@beugnen
Copy link
Author

beugnen commented Jan 20, 2014

Amrykid - "The reason why AllowsTransparency is set to true is because for some odd reason, the glowing border effect requires it. It's default."

Incorrect.

This code will correctly display a v12 window as per v10. i.e. metro style; non-transparent; saves window position; and has a glowing border.

<Controls:MetroWindow  x:Class="MetroTest1.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"
        Title="MainWindow" Height="350" Width="525"
        AllowsTransparency="False"
        SaveWindowPosition="True">

    <i:Interaction.Behaviors>
        <Behaviours:BorderlessWindowBehavior AllowsTransparency="False"
                                             EnableDWMDropShadow="True" />
        <Behaviours:WindowsSettingBehaviour/>
    </i:Interaction.Behaviors>

    <Grid>
        <Button Content="Button"
                HorizontalAlignment="Left"
                Margin="220,28,0,0"
                VerticalAlignment="Top"
                Width="75" />


    </Grid>
</Controls:MetroWindow>

@zeluisping
Copy link
Contributor

The glowing border is coloured, such as seen here:
glowborder
To use it, you set the GlowBrush property on MetroWindow.

EnableDWMDropShadow enables the shadow that shows when the window is active.

EnableDWMDropShadow cannot be set to True when AllowsTransparency is True.

The reason your window is transparent is because you did not merge the resources, please refer to the following webpage to learn the basics:
http://mahapps.com/MahApps.Metro/guides/quick-start.html

@AzureKitsune
Copy link
Member

@100GPing100 beat me to it.

Off-topic: Please surround your code with ```s.

@beugnen
Copy link
Author

beugnen commented Jan 20, 2014

I am well aware of the basics thanks.

Compare these v.10 and v.12 MahApps Metro applications and the default window border shadow.

v10 (TOR) shows out of the box border shadow on an inactive window.
v12 (Mainwindow) shows default behaviourwhere said shadow is no more.

untitled

I find the v12 breaks much including WinForm control hosting as mentioned on the FAQ, which only causes the window position save bug I reported elsewhere.

@AzureKitsune
Copy link
Member

Because of the switch (about a year ago) to the glow border which needs AllowsTransparency to be true. (I'm starting to sound like a broken record.)

We are aware of the breaking changes but we didn't make it to the 1.0 mark yet. If we have to break things, it's better for us to do it now.

@beugnen
Copy link
Author

beugnen commented Jan 20, 2014

Not at the extent when a change to allow for a glowing coloured border (when the old v0.10 one was arguably fine) breaks say WinForm hosting. Why are you pushing the glow border and therefore transparency to be a 1st-class citizen? One wonders just how frequency one would want to have a nice shade of blue border on an application window.

I consider being able to host Microsoft's .NET built-in Chart control from System.Windows.Forms.DataVisualization.Charting in a WPF app easily to be considerably more important than a border that may not be following the current Windows colour scheme. Ideally one should be able to just plop such things onto a window instead of having to either turn off MahApp features or include new code compared to v0.10.

Would you consider including the following on your Basics screen at least?

// add to your namespace includes
  xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
  xmlns:Behaviours="clr-namespace:MahApps.Metro.Behaviours;assembly=MahApps.Metro"
.
.
.
    <i:Interaction.Behaviors>
        <Behaviours:BorderlessWindowBehavior AllowsTransparency="False" />
        <Behaviours:WindowsSettingBehaviour/>
    </i:Interaction.Behaviors>

I do think you guys are doing a tremendous job but I question the priority of glowing borders and their cascading dependence on transparency.

@punker76
Copy link
Member

@zeluisping
Copy link
Contributor

@MickyD I have used this:

    <i:Interaction.Behaviors>
        <behaviours:BorderlessWindowBehavior AllowsTransparency="False" EnableDWMDropShadow="False"/>
        <behaviours:WindowsSettingBehaviour/>
    </i:Interaction.Behaviors>

Together with the GlowBrush and AvalonDock (which partially uses WinForms) did not have any airspace problems.

@beugnen
Copy link
Author

beugnen commented Feb 23, 2014

@punker76 What? That I'm voicing concerns about the Project's recent lessor backwards compatibility or how documentation could be improved.

Such arrogance.

At work we only use open source if the project has a proven history of non-breaking changes; is stable; that the source code is available; and is supported by a lively community.

As Principal Developer, your project no longer has my vote.

@beugnen
Copy link
Author

beugnen commented Feb 23, 2014

@100GPing100 yes thanks but I was already doing that. However, as per the old versions, we should not need to.

@zeluisping
Copy link
Contributor

You do have a point regarding the default value of AllowsTransparency. The glow border seems to be working just fine with AllowsTransparency set to false, thus why the change?

@beugnen
Copy link
Author

beugnen commented Feb 23, 2014

Thanks @100GPing100

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

4 participants