MaterialDesignInXamlToolkit icon indicating copy to clipboard operation
MaterialDesignInXamlToolkit copied to clipboard

Light bars in the Card at the corners when using UniformCornerRadius

Open MEDUZAprogrammer opened this issue 1 year ago • 10 comments

Bug explanation

I have a window style called WindowStyle, after upgrading from 4.9.0 by 5.1.0 light bars appeared in the corners with the parameter UniformCornerRadius= "10", which is very annoying for users of my application, since at 4.9.0 there was no such problem, these stripes are not visible on a white background. Removed \ < ContentPresenter Content="{TemplateBinding Content}"/>, the problem remained.

image image

Changed the layout in the tree, removed most of the properties in the style and elements, BorderThickness = 0, BorderBrush = Transparent, didn't help. How do I get rid of these light bars?

<Style TargetType="{x:Type Window}" x:Key="WindowStyle">
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="OverridesDefaultStyle" Value="True"/>
    <Setter Property="AllowsTransparency" Value="True"/>
    <Setter Property="WindowStyle" Value="None"/>
    <Setter Property="ResizeMode" Value="CanResize"/>
    <Setter Property="ShowInTaskbar" Value="True"/>
    <Setter Property="Padding" Value="0"/>
    <Setter Property="Background" Value="Transparent"/>
    <Setter Property="BorderBrush" Value="Transparent"/>
    <Setter Property="BorderThickness" Value="0"/>
    <Setter Property="WindowChrome.WindowChrome">
        <Setter.Value>
            <WindowChrome NonClientFrameEdges="None" CornerRadius="0" 
                  ResizeBorderThickness="7" CaptionHeight="20"/>
        </Setter.Value>
    </Setter>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type Window}">
                <Border x:Name="Border" Background="{TemplateBinding Background}" Padding="4" BorderThickness="0">
                    <Grid Background="{TemplateBinding Background}">

                        <Grid.RowDefinitions>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>

                        <materialDesign:Card x:Name="CardBorder" Style="{StaticResource MaterialDesignElevatedCard}" Grid.Row="0" Margin="{TemplateBinding Padding}" UniformCornerRadius="10" UseLayoutRounding="True" 
                                             materialDesign:ElevationAssist.Elevation="Dp2" >

                            <AdornerDecorator Grid.Row="0">
                                <materialDesign:DialogHost DialogMargin="8" IsOpen="{Binding IsLoading, UpdateSourceTrigger=PropertyChanged}" DialogContentUniformCornerRadius="20" CornerRadius="10"
                                                            Style="{StaticResource MaterialDesignEmbeddedDialogHost}" UseLayoutRounding="True" 
                                                            DialogContent="{Binding LoadingDialogContent, UpdateSourceTrigger=PropertyChanged}" IsRestoreFocusDisabled="True">
                                        <Grid>

                                            <Grid.Resources>
                                                <ResourceDictionary>
                                                    <ResourceDictionary.MergedDictionaries>
                                                        <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Snackbar.xaml" />
                                                    </ResourceDictionary.MergedDictionaries>
                                                </ResourceDictionary>
                                            </Grid.Resources>
                                            
                                            <ContentPresenter Content="{TemplateBinding Content}"/>

                                            <materialDesign:Snackbar IsActive="{Binding SnackIsActive}" MessageQueue="{Binding SnackMessageQueue}" Margin="2" ActionButtonStyle="{StaticResource MaterialDesignSnackbarActionLightButton}"/>

                                        </Grid>
                                </materialDesign:DialogHost>
                            </AdornerDecorator>
                            
                        </materialDesign:Card>

                        <ResizeGrip x:Name="WindowResizeGrip" Grid.Row="1"
                                HorizontalAlignment="Right" VerticalAlignment="Bottom"
                                Visibility="Collapsed" IsTabStop="False" />
                    </Grid>
                </Border>
                <ControlTemplate.Triggers>
                    <Trigger Property="WindowState" Value="Maximized">
                        <Setter TargetName="Border" Property="Padding" Value="0"/>
                        <Setter TargetName="CardBorder" Property="UniformCornerRadius" Value="0"/>
                        <Setter Property="WindowChrome.WindowChrome">
                            <Setter.Value>
                                <WindowChrome NonClientFrameEdges="None" CornerRadius="15" ResizeBorderThickness="7" CaptionHeight="20"/>
                            </Setter.Value>
                        </Setter>
                        <Setter Property="Padding" Value="0 4 4 0"/>
                    </Trigger>
                    <Trigger Property="ResizeMode" Value="CanResizeWithGrip">
                        <Setter TargetName="WindowResizeGrip" Property="Visibility" Value="Visible" />
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

Version

5.1.0

MEDUZAprogrammer avatar Oct 04 '24 07:10 MEDUZAprogrammer