punker76 / MahApps.Metro.SimpleChildWindow

A simple child window for MahApps.Metro
MIT License
374 stars 55 forks source link

How to show childwindow without shadow like this ? #53

Closed fengqiangboy closed 7 years ago

fengqiangboy commented 7 years ago

How to show childwindow without shadow like this ? https://user-images.githubusercontent.com/658431/28338628-dea5f8e2-6c09-11e7-8349-8bce5cf7a1c8.png

punker76 commented 7 years ago

@fengqiangboy Set the EnableDropShadow property of your ChildWindow to false. All properties are listed and described on Wiki https://github.com/punker76/MahApps.Metro.SimpleChildWindow/wiki/ChildWindow#properties

fengqiangboy commented 7 years ago

@punker76 Thank you for your answer.

I have set the EnableDropShadow property to false, but it doesn't work. Here is my childwindow xaml :

<simpleChildWindow:ChildWindow x:Class="ElectronicCigarette.CustomizeViews.DisplayEdit"
                               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                               xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                               xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                               xmlns:local="clr-namespace:ElectronicCigarette"
                               xmlns:simpleChildWindow="clr-namespace:MahApps.Metro.SimpleChildWindow;assembly=MahApps.Metro.SimpleChildWindow"
                               Padding="15" Title="TestChild 1" ShowCloseButton="True" AllowMove="True"
                               EnableDropShadow="False">

    <StackPanel Margin="20">
        <StackPanel Orientation="Horizontal">
            <Button Content="Import Image" Margin="5" />
            <Button Content="Export Image" Margin="5" />
            <Button Content="Reset To Default" Margin="5" />
        </StackPanel>
    </StackPanel>
</simpleChildWindow:ChildWindow>

And I show the childwindow like this :

private void EditBtnClick(object sender, RoutedEventArgs e)
        {
            ChildWindowManager.ShowChildWindowAsync(Window.GetWindow(this), new DisplayEdit());
        }
punker76 commented 7 years ago

@fengqiangboy Just added your sample to the demo and it works... so it must be something else in your scenario. Do you use the latest version? And which MahApps version?

image

fengqiangboy commented 7 years ago

@punker76 Sorry, I did not make it clear, it dose work, but I want make the background translucent like this. https://user-images.githubusercontent.com/658431/28338630-deacb9ca-6c09-11e7-8bdf-054fb008afd6.png And my MahApps version is 1.5.0, MahApps.Metro.SimpleChildWindow version is 1.4.0 .

punker76 commented 7 years ago

@fengqiangboy ah, got it. I will update the Wiki for this, cause I must change this. Before the default was a freezed SolidColorBrush with Gray2 from MahApps and Opacity=0.8. This brush cause some trouble in thread scenarios. So I removed it and uses Gray3 as default for the OverlayBrush.

You can set this at your ChildWindow in Xaml to reenable it.

    <simpleChildWindow:ChildWindow.OverlayBrush>
        <SolidColorBrush Color="{StaticResource Gray2}" Opacity="0.8" />
    </simpleChildWindow:ChildWindow.OverlayBrush>