CommunityToolkit / CommunityToolkit/Windows

AttachedDropShadow casts wrong shadow on different scale screens

Aperta
#832 1 commento 2 reazioni 0 assegnatari Vedi su GitHub
bug components::extensions
Lingua principale
C#
Stelle
1.1k
Fork
166
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### Describe the bug

I have noticed that the `AttachedDropShadow` (from `CommunityToolkit.Uwp.Extensions`) messes up the shadow rendering when we combine different screen scalings with different scaled assets (`scale-100`, `scale-125`, `...`).

This is how the shadow looks on my 100% scaled screen. It loads the `scale-100` image.

Image

This is what happens when I move the window to my surface laptop studio screen. It loads the `scale-150` image and the shadow gets messed up.

Image

In general, the moving from one screen to the other is to illustrate that the shadow does work at first and then gets messed up.
If you open the Window in the high scale screen, the shadow is messed up anyways, it doesn't **need** to be moved.
I am not sure if the cause is the screen scale or the PPI/DPI, I am no expert in this matter.

### Steps to reproduce

```text
See below, as this is not a RichEditTextBox
```

### Expected behavior

> [!IMPORTANT]
> Make sure you have 2 monitors with different scales connected to your machine

[AttachedDropShadowRepo.zip](https://github.com/user-attachments/files/24728339/AttachedDropShadowRepo.zip)

1. Open Solution
1. Run Project
1. Move Window from scale screen to scale screen
1. See the wrong shadow

### Expected behavior

The correct shadow as is when there is only one monitor attached, or when only one asset scaling is present.

### Screenshots

_No response_

### Code Platform

- [x] UWP
- [ ] WinAppSDK / WinUI 3
- [ ] Web Assembly (WASM)
- [ ] Android
- [ ] iOS
- [ ] MacOS
- [ ] Linux / GTK

### Windows Build Number

- [ ] Windows 10 1809 (Build 17763)
- [ ] Windows 10 1903 (Build 18362)
- [ ] Windows 10 1909 (Build 18363)
- [ ] Windows 10 2004 (Build 19041)
- [ ] Windows 10 20H2 (Build 19042)
- [ ] Windows 10 21H1 (Build 19043)
- [ ] Windows 10 21H2 (Build 19044)
- [ ] Windows 10 22H2 (Build 19045)
- [x] Windows 11 21H2 (Build 22000)
- [ ] Other (specify)

### Other Windows Build number

_No response_

### App minimum and target SDK version

- [ ] Windows 10, version 1809 (Build 17763)
- [ ] Windows 10, version 1903 (Build 18362)
- [ ] Windows 10, version 1909 (Build 18363)
- [ ] Windows 10, version 2004 (Build 19041)
- [ ] Windows 10, version 2104 (Build 20348)
- [x] Windows 11, version 22H2 (Build 22000)
- [ ] Other (specify)

### Other SDK version

_No response_

### Visual Studio Version

_No response_

### Visual Studio Build Number

February 2026 (18.3.2)

### Device form factor

Desktop

### Additional context

That's the code, for quick reference

```xml





```

### Help us help you

Yes, but only if others can assist.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia con AttachedDropShadow in CommunityToolkit.Uwp.Extensions e riproduci il problema usando AttachedDropShadowRepo.zip su monitor con scale diverse. Confronta il comportamento quando apri o sposti la finestra tra gli schermi; il lavoro è completato quando l’ombra viene visualizzata correttamente con gli asset scale-100 e scale-150.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp
Ambito
desktop, frontend
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.