dotnet / dotnet/maui

Text Flickering and Alignment Shift while invalidating the Drawable

Open
#35,799 2 comments 3 reactions 0 assignees View on GitHub
area-drawing platform/windows s/triaged s/verified t/bug
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 14h
Merged PRs (30d)
296

Description

### Description

I am creating custom control where the text of control needs to be updated dynamically. To update the text I have used the ICanvas DrawString in the GraphicsView. But when I'm invalidating the GraphicsView to update the text, I'm noticing flickering or text alignment shift on the existing constant texts randomly.

Sample: [SimpleSample.zip](https://github.com/user-attachments/files/28697191/TextSample.zip)

Note: The issue is resolved on 9.0.9. But still facing same issue.
Previous Issue link: https://github.com/dotnet/maui/issues/6368

### Steps to Reproduce

1. Create a new Maui App
2. Create a new class, which extend the class from GraphicsDrawable
3. Create a new class that implements IDrawable, and assign to this Drawable to GraphicsDrawable
4. Draw a custom text using ICanvas DrawString.
5. Invalidate the GraphicsView to redraw text while dragging the pointer.
6. Notice that the text is bouncing while dragging.

### Link to public reproduction project repository

NA

### Version with bug

10.0.60

### Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

### Last version that worked well

_No response_

### Affected platforms

Windows

### Affected platform versions

_No response_

### Did you find any workaround?

_No response_

### Relevant log output

```shell

```

Contributor guide

Open the contributing guide

Research direction

Start with the attached TextSample.zip and reproduce the issue on Windows using GraphicsView, GraphicsDrawable, IDrawable, ICanvas.DrawString, and repeated invalidation while dragging. Compare the behavior with the earlier .NET MAUI version referenced in the issue; done means constant text no longer flickers or shifts alignment during redraw.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.