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

DropDownShadow doesn't reponse to CornerRadius property #3516

Closed
2 tasks
AbdAlghaniAlbiek opened this issue Oct 2, 2020 · 10 comments
Closed
2 tasks

DropDownShadow doesn't reponse to CornerRadius property #3516

AbdAlghaniAlbiek opened this issue Oct 2, 2020 · 10 comments

Comments

@AbdAlghaniAlbiek
Copy link

AbdAlghaniAlbiek commented Oct 2, 2020

When I add DropDownShadow control to a control like rectangle then I make rectangle's corners more rounded the shadow stay with sharp corner to solve that I saw CornerRadius property that introduced in October update in DropDownShadow properties, and when I give values to CornerRadius property nothing change (shadow stay with sharp corners)

App min and target version:

  • [Min] October 2018 Update (17763)
  • [Target] May 2019 Update (18362)

Device form factor:

  • Desktop

Visual Studio

  • 2019 (version: )
@AbdAlghaniAlbiek AbdAlghaniAlbiek added the bug 🐛 An unexpected issue that highlights incorrect behavior label Oct 2, 2020
@ghost ghost added the needs triage 🔍 label Oct 2, 2020
@ghost
Copy link

ghost commented Oct 2, 2020

Hello AbdAlghaniAlbiek, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

@Kyaa-dost
Copy link
Contributor

@AbdAlghaniAlbiek Thanks for highlighting the issue! Not certain if this is a bug or there is anything that perhaps is required to make this work. Let's see if any devs can shed light on this 💡

@Kyaa-dost Kyaa-dost added the help wanted Issues identified as good community contribution opportunities label Oct 2, 2020
@michael-hawker
Copy link
Member

@AbdAlghaniAlbiek can you provide more details on the XAML you're using? Screenshots are helpful too. As well as a mock-up of what you're expecting.

Generally, you should use RadiusX and RadiusY on the Rectangle within the DropShadowPanel in order to round the corners OR the CornerRadius of the inner control, not the CornerRadius property of the DropShadowPanel itself.

CornerRadius is a general property added on all UIElements. We don't hook it up in the DropShadowPanel control currently, I don't know if that makes any sense to do, as it would just clip the Shadow effect itself (and the inner content).

You can try and see what the behavior is in your scenario by just overriding the style to add the CornerRadius connection:

<Style TargetType="controls:DropShadowPanel">
        <Setter Property="IsTabStop"
                Value="False" />
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:DropShadowPanel">
                    <Grid Background="{TemplateBinding Background}"
                          BorderBrush="{TemplateBinding BorderBrush}"
                          BorderThickness="{TemplateBinding BorderThickness}"
                          HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                          VerticalAlignment="{TemplateBinding VerticalAlignment}"
                          CornerRadius="{TemplateBinding CornerRadius}">
                        <Border x:Name="ShadowElement" 
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                        <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

The only other thing is if you're trying to fill the shape with a composition brush, then you would be hitting this bug probably: microsoft/microsoft-ui-xaml#1884

@michael-hawker michael-hawker added need more info 📌 open discussion ☎️ and removed bug 🐛 An unexpected issue that highlights incorrect behavior help wanted Issues identified as good community contribution opportunities needs triage 🔍 labels Oct 6, 2020
@Kyaa-dost
Copy link
Contributor

@AbdAlghaniAlbiek any update on this? Are you still having this issue?

@Kyaa-dost
Copy link
Contributor

@AbdAlghaniAlbiek did you have a chance to try what mentioned above?

@AbdAlghaniAlbiek
Copy link
Author

AbdAlghaniAlbiek commented Feb 13, 2021 via email

@michael-hawker
Copy link
Member

@AbdAlghaniAlbiek you need to share more details with us for us to be able to help you. Like recreating your scenario in our Sample App page and providing us the XAML to reproduce the issue.

If you modify the sample we have in the sample app like this:

          <controls:DropShadowPanel BlurRadius="8"
                                    ShadowOpacity="1"
                                    OffsetX="4"
                                    OffsetY="4"
                                    Color="Black"
                                    Margin="20"
                                    IsMasked="True">
            <Rectangle Width="100" Height="50"
                Fill="Green" RadiusX="8" RadiusY="8" />
          </controls:DropShadowPanel>

You get this:

image

Which seems like the effect you're looking for?

@AbdAlghaniAlbiek
Copy link
Author

@michael_hawker
yes that what I want to do, DropDownShadow is responsive for RadiusX and RadiusY changes but it doesn't work with CornerRadius property even I give it the style that you produced above but also it doesn't work 😓😓

I don't know why it works with Rectangle (RadiusX, RadiusY) and doesn't work with Grid-stackpanel-.....(CornerRadius)
even I tried that in your samlple (thank you for version 7.0.0) it the same result

@michael-hawker michael-hawker added this to the 7.1 milestone Aug 11, 2021
ghost pushed a commit that referenced this issue Aug 27, 2021
## Fixes #3122 #3607 #3516

_Also implements #3693 for the new DropShadow._

FYI @seanocali as this is a different implementation approach (which is simpler to use outside of the DropShadowPanel we've been working on) but should hopefully achieve the same result.

This PR adds attached shadows which can easily be attached to any FrameworkElement without needing to modify the layout like DropShadowPanel does today. They can also be shared using a resource, added to the style of an element, and animated! All the things! 🎉

## PR Type

What kind of change does this PR introduce?

<!-- Please uncomment one or more options below that apply to this PR. -->

<!-- - Bugfix -->
- Feature by @Ryken100 and integrated/extended by @michael-hawker 
<!-- - Code style update (formatting) -->
<!-- - Refactoring (no functional changes, no api changes) -->
<!-- - Build or CI related changes -->
<!-- - Documentation content changes -->
<!-- - Sample app changes -->
<!-- - Other... Please describe: -->

## What is the current behavior?

DropShadowPanel is clunky and requires modifying how you layout your app.

## What is the new behavior?

Just attach a shadow and be done! (DropShadowPanel is deprecated.)

## PR Checklist

- [x] Composition Only Shadow Support? (with Target)
- [x] Add XML Docs
- [x] Animation Support to Explicit Animation System?
- [x] Bug can't use `AttachedCardShadow` directly with `Border`?

Please check if your PR fulfills the following requirements: <!-- and remove the ones that are not applicable to the current PR -->

- [ ] Tested code with current [supported SDKs](../#supported)
- [ ] Pull Request has been submitted to the documentation repository [instructions](../blob/main/Contributing.md#docs). Link: <!-- docs PR link -->
- [ ] Sample in sample app has been added / updated (for bug fixes / features)
  - [ ] Icon has been created (if new sample) following the [Thumbnail Style Guide and templates](https://github.com/CommunityToolkit/WindowsCommunityToolkit-design-assets)
- [ ] New major technical changes in the toolkit have or will be added to the [Wiki](https://github.com/CommunityToolkit/WindowsCommunityToolkit/wiki) e.g. build changes, source generators, testing infrastructure, sample creation changes, etc...
- [ ] Tests for the changes have been added (for bug fixes / features) (if applicable)
- [ ] Header has been added to all new source files (run _build/UpdateHeaders.bat_)
- [ ] Contains **NO** breaking changes

<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below.
Please note that breaking changes are likely to be rejected within minor release cycles or held until major versions. -->

## Other information

<!-- Please add any other information that might be helpful to reviewers. -->
@michael-hawker
Copy link
Member

Our new attached shadow feature coming in 7.1 (available in 7.1.0-rc1 package now) should resolve these issues as they have and respect a CornerRadius property on the shadow itself which can be aligned to a UI Element.

@AbdAlghaniAlbiek
Copy link
Author

Thank you all. I was following you on twitter, I saw a sample how to implement it in uwp application it is awesome 🔥

@ghost ghost locked as resolved and limited conversation to collaborators Nov 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants