-1

Window.Current.Content is getting null in winui3 Gettting exception object reference not set to an instance I am implementing Ishitestvisible Any suggestions?

  • 1
    Does this answer your question? [What is a NullReferenceException, and how do I fix it?](https://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-and-how-do-i-fix-it) – Progman May 28 '22 at 08:35

1 Answers1

0

As per the Window.Current documentation:

For UWP apps, gets the window of the current thread. Desktop apps always return null.

https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.window.current

Kevin Gallahan
  • 1,645
  • 10
  • 9
  • Very strange that their WinUI3 docs say to use it. https://learn.microsoft.com/en-us/windows/apps/design/basics/navigate-between-two-pages – John Glen Nov 28 '22 at 00:58
  • @JohnGlen The doc you linked is a part of the Windows app design basics content, none of which is limited to talking about WinUI 3 development. The steps above actually state: "In the left pane of the New Project dialog box, choose the Visual C# > Windows > Universal or the Visual C++ > Windows > Universal node." indicating it was written in the days of UWP. – Kevin Gallahan Dec 09 '22 at 20:00