code-samples
code-samples copied to clipboard
HamburgerMenuApp.V4 view from MenuItem will be constructed twice
After adding the following code to HomeView.Xaml.cs in HamburgerMenuApp.Core and make HamburgerMenuApp.V4 output debug message to console, then I found the "HomeView ctor..." message will pop up twice even I just click the Home menuItem once. I can`t see this issue in other V1~V3 samples, seems like the menuItem views is singleton in these projects.
=================================================
public HomeView() { InitializeComponent(); Console.WriteLine($@"{GetType().Name} ctor..."); }
~HomeView() => Console.WriteLine($@"{GetType().Name} dtor...");
I attached the screen capture here.. as you may see, I clicked the Home menu Item 4 times , but "HomeView ctor..." was printed 6 times. Since it`s not a 100% happened, so I clicked several times for better demonstrating this issue.