Shadow Offset issues in .Net Maui

Haider Ali Faizi 100 Reputation points
2024-05-07T11:34:24.3033333+00:00

Hello, I am following this official documentation:"https://learn.microsoft.com/en-us/dotnet/maui/user-interface/shadow?view=net-maui-8.0" and it is working fine. But, I am facing one issues, when I try to set y-offset value to negative like:"Offset="20,-20"", shadow disappear and when i set negative x-offset value, like Offset="-20,20", it works fine. Can you tell what is the issues with y-offset value of shadow and how to fix it?

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,971 questions
0 comments No comments
{count} votes

Accepted answer
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 69,386 Reputation points Microsoft Vendor
    2024-05-08T01:32:30.57+00:00

    Which platform do you have this issue?

    I used following code, the shadow appears normally for all platforms. If you set y-offset value to negative, the shadow will move up, if you set the x-offset value to negative, the shadow will move left.

    Could you share your layout code that I can make a test?

     <Image Source="dotnet_bot.png"
    WidthRequest="250"
    HeightRequest="310">
             <Image.Shadow>
    
                 <Shadow Brush="Black"
    
             Offset="20,-20"
    
             Radius="40"
    
             Opacity="0.8" />
    
             </Image.Shadow>
    
         </Image>
    
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful