CommunityToolkit / CommunityToolkit/Maui
[BUG] DrawingView does not render correctly after tab navigation (TabBar)
- Dominant language
- C#
- Stars
- 2.7k
- Forks
- 500
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 7
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Did you read the "Reporting a bug" section on Contributing file?
- [X] I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug
### Current Behavior
In a MAUI app, when using a TabBar structure for the UI, on application startup DrawingView is rendered correctly and all the controls work as expected. However after navigating to SecondaryPage (tab) and back to the MainPage (tab) the DrawingView is not rendered correctly anymore.
### Expected Behavior
DrawingView remains rendered correctly during TabBar navigation.
### Steps To Reproduce
1. Open and run the solution from the reproduction repository on Windows machine.
2. Observe the DrawingView control.
3. (optional) Interact with Drawing View control.
4. Navigate to Secondary tab.
5. Navigate to Main tab.
### Link to public reproduction project repository
https://github.com/Ghibytzu/DrawingViewWithTabBarNet8/tree/master
### Environment
```markdown
- .NET MAUI CommunityToolkit: 9.0.2
- OS: Windows 11 Build 10.0.22631.3880
Android Emulator pixel 5 api 33
- .NET MAUI: 8.0.61
```
### Anything else?
**Important Note:** There is a similar issue on Android, after navigation the DrawingView remains rendered but cannot be accessed. E.g. method DrawingView.ClearI() does not clear the content and other controls ignore DrawingView's position.

**Important Note2:** Also, I tried the same code on .NET MAUI CommunityToolkit: 6.1.0 with .NET Framework 7.0 and the issue does not reproduce: DrawingView works as expected during tab navigation (TabBar).
**Additional debugging steps performed**
I tried several methods like overriding the OnAppearing() method of the Content page but with no avail:
```
protected override void OnAppearing()
{
base.OnAppearing();
ReinitializeDrawingView();
}
private void ReinitializeDrawingView()
{
if (!MainLayout.Children.Contains(drawView))
{
MainLayout.Children.Insert(0, drawView);
}
}
```
After navigation DrawingView has IsVisible = true but IsLoaded = false and is not rendering on screen.
Contributor guide
Research direction
Start with the linked DrawingViewWithTabBarNet8 reproduction and reproduce the failure by switching from MainPage to SecondaryPage and back on Windows. Investigate DrawingView lifecycle and rendering state after tab navigation, including the reported IsVisible=true and IsLoaded=false state; done means the control renders and remains interactive after returning to MainPage on the affected platforms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop, mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100