Sub123
Topic Author
Posts: 1
Joined: 20 Mar 2025, 11:55

DropShadowEffect on Rectangle causes the whole interface broken

20 Mar 2025, 12:18

Hello. I have a problem. I am using unigine with noiesisgui. I have several interface files.
The problem is when there is a DropShadowEffect in a style xaml file the whole interface shifts and scales like half of size from it.
The only one button spoils entire window. I tried to comment out this directive and it works fine.
I would like to keep the effect but fix it.
<Button Content="Login" Margin="1490,809,17,6" Style="{DynamicResource KeyGray}"
                Command="..." />
         
<Style x:Key="KeyGray" TargetType="{x:Type Button}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                
                    <Border SnapsToDevicePixels="true" CornerRadius="6">
                        <Grid>
                        
                            <Rectangle x:Name="background" Fill="#B5B5B5" RadiusX="7" RadiusY="7" />
                            
                            <Rectangle x:Name="backgroundBlur" RadiusX="7" RadiusY="7" Stroke="#5C5C5C"
                                       StrokeThickness="5">
                                
                             <Rectangle.Effect>
                                 <DropShadowEffect BlurRadius="10" ShadowDepth="10" Opacity="0.5"/>
                             </Rectangle.Effect>
                        </Grid>
                    </Border> 
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        
    </Style>
 
User avatar
sfernandez
Site Admin
Posts: 3363
Joined: 22 Dec 2011, 19:20

Re: DropShadowEffect on Rectangle causes the whole interface broken

24 Mar 2025, 19:05

Hi, there is a minor issue in the xaml code you pasted, you forgot to close the Rectangle tag.
    <Style x:Key="KeyGray" TargetType="{x:Type Button}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Border SnapsToDevicePixels="true" CornerRadius="6">
                        <Grid>
                            <Rectangle x:Name="background" Fill="#B5B5B5" RadiusX="7" RadiusY="7" />
                            <Rectangle x:Name="backgroundBlur" RadiusX="7" RadiusY="7" Stroke="#5C5C5C"
                                       StrokeThickness="5">
                              <Rectangle.Effect>
                                 <DropShadowEffect BlurRadius="10" ShadowDepth="10" Opacity="0.5"/>
                              </Rectangle.Effect>
                            </Rectangle>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
Anyway I don't think that would be the source of the problem, it looks more like an issue with the Unigine integration. It might have something wrong with the offscreen rendering phase. You should take a look at the integration guide: https://www.noesisengine.com/docs/Gui.C ... Guide.html

Who is online

Users browsing this forum: No registered users and 4 guests