Skip to content

fix(controls): Tooltips, context menu, and comboboxes drop shadow#1472

Merged
pomianowski merged 6 commits intolepoco:mainfrom
Nuklon:branch-7
Nov 7, 2025
Merged

fix(controls): Tooltips, context menu, and comboboxes drop shadow#1472
pomianowski merged 6 commits intolepoco:mainfrom
Nuklon:branch-7

Conversation

@Nuklon
Copy link
Collaborator

@Nuklon Nuklon commented Jul 3, 2025

Pull request type

Please check the type of change your PR introduces:

  • Update
  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes

What is the current behavior?

Currently, the drop shadow used by tooltips and context menus are broken. This is because effects get clipped.
image

What is the new behavior?

The solution is to add a decorator that wraps around it. I also updated the dropshadows to follow original colors (they were far too dark). The tooltips have less shadow than context menus in WinUI.

image
image

@Nuklon Nuklon requested a review from pomianowski as a code owner July 3, 2025 11:51
@github-actions github-actions bot added controls Changes to the appearance or logic of custom controls. styles Topic is related to styles PR Pull request dotnet release labels Jul 3, 2025
@Nuklon
Copy link
Collaborator Author

Nuklon commented Jul 3, 2025

@Difegue
Copy link
Contributor

Difegue commented Jul 7, 2025

Have you considered adding this change to ComboBoxes as well?
image

I believe all you need is the following:
wpfui-12-20-21.patch

EDIT: Seems like wrapping the ComboBox popup in EffectThicknessDecorator breaks its animation a bit for some reason.. Might need some additional changes so feel free to ignore me 😓

@Nuklon
Copy link
Collaborator Author

Nuklon commented Jul 7, 2025

Have you considered adding this change to ComboBoxes as well? image

I believe all you need is the following: wpfui-12-20-21.patch

EDIT: Seems like wrapping the ComboBox popup in EffectThicknessDecorator breaks its animation a bit for some reason.. Might need some additional changes so feel free to ignore me 😓

Yes, with animations there are some issues due to added margins, and the translation gets rendered above the combobox. There are some possibilities:

  1. Remove TranslateTransform of dropdown.
  2. Change TranslateTransform to ScaleTransform (looks OK, but with very long comboboxes it's not as similar to WinUI).
  3. Accept a slight UI clipping issue. If you use EffectThicknessDecorator with Thickness="30,0,30,30" (the shadow is only added below and to the sides of the element) the shadow clips a little below the combobox until the animation is done. This might be acceptable. This is very simple and you can basically keep all code as-is.
  4. 3 and then delay adding the dropshadow. This is also done by WinUI, which only adds shadow when it's fully expanded, so I think this is the best solution.

I'll commit some changes for this.

@Nuklon Nuklon changed the title Fix tooltips and context menu drop shadow Fix tooltips, context menu, and comboboxes drop shadow Jul 7, 2025
@Nuklon Nuklon mentioned this pull request Aug 23, 2025
7 tasks

namespace Wpf.Ui.Controls;

public class EffectThicknessDecorator : Decorator
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider giving this class a doc block (explaining the purpose) that effectively repeats this part from the PR:

This is because effects get clipped. [..] The solution is to add a decorator that wraps around it.

@github-actions github-actions bot added the ⭐ top pull request Top pull request. label Aug 26, 2025
@pomianowski pomianowski changed the title Fix tooltips, context menu, and comboboxes drop shadow fix(controls): Tooltips, context menu, and comboboxes drop shadow Nov 7, 2025
@pomianowski pomianowski merged commit 3139927 into lepoco:main Nov 7, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

controls Changes to the appearance or logic of custom controls. dotnet PR Pull request release ⭐ top pull request Top pull request. styles Topic is related to styles

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants