dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.16k stars 1.74k forks source link

Missing mutations for ListView items #9640

Open etvorun opened 2 years ago

etvorun commented 2 years ago

Description

XAML Hot Reload does not work when editing DataTemplate used by ListView

Steps to Reproduce

  1. Open attached project
  2. Build and run
  3. In VS open Debug > Windows > Live Visual Tree
  4. Toggle off Just My XAML button in LVT toolbar
  5. Expand elements Expected: there are elements under ListView Actual: no elements under ListView Note: as a result XAML Hot Reload does not work when editing content of ListView's DataTemplate MauiApp1.zip

image

Version with bug

6.0.408

Last version that worked well

Unknown/Other

Affected platforms

Windows, I was not able test on other platforms

Affected platform versions

Windows

Did you find any workaround?

No response

Relevant log output

No response

drasticactions commented 2 years ago

I believe the root of this problem is how ListView handles child elements, which is the same as Xamarin.Forms https://github.com/xamarin/Xamarin.Forms/issues/14277.

When XAML Hot Reload checks for child elements, we use 'IVisualTreeElement' and get the visual children from the parent. This is implemented on the base element, but ListView doesn't store its children there. It has its own internal lists.

@etvorun had pointed out ItemsView and that this could be the place to implement that interface.

ghost commented 2 years ago

Thanks for the issue report @etvorun! This issue appears to be a problem with Visual Studio, so we ask that you use the VS feedback tool to report the issue. That way it will get to the routed to the team that owns this experience in VS.

If you encounter a problem with Visual Studio, we want to know about it so that we can diagnose and fix it. By using the Report a Problem tool, you can collect detailed information about the problem, and send it to Microsoft with just a few button clicks.

  1. Go to the VS feedback tool to report the issue
  2. Close this bug, and consider adding a link to the VS Feedback issue so that others can follow its activity there.

This issue will be automatically closed in 3 days if there are no further comments.

drasticactions commented 2 years ago

@jfversluis I do not believe this is a Visual Studio bug, but a MAUI one. https://github.com/xamarin/Xamarin.Forms/issues/14277

This can only be fixed if IVisualTreeElement is implemented for ItemsView or ListView. If it's not, XAML Hot Reload can't work for those controls.

ghost commented 2 years ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

drasticactions commented 2 years ago

I am going to spike what it would take to fix this. It is a significant enough control that it's worth exploring it.

homeyf commented 1 year ago

Verified this issue with Visual Studio 17.7.0 Preview 1.0. Can repro on windows platform with above project. MauiApp1.zip image