CoreWindow.SizeChanged is not supported by the language

Gavin Williams 761 Reputation points
2020-08-25T13:13:27.607+00:00

I have red squigglies over the event and being told that CoreWindow.SizeChanged is not supported by the language. What do i do?

Universal Windows Platform (UWP)
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Nico Zhu (Shanghai Wicresoft Co,.Ltd.) 12,866 Reputation points
    2020-08-25T14:36:00.487+00:00

    Hello, welcome to Microsoft Q&A,

    CoreWindow.SizeChanged is not supported by the language

    CoreWindow.SizeChanged is under Windows.UI.Core namespace that available in UWP platform. Please make sure your app is uwp app, and you need get CoreWindow with Window.Current.CoreWindow

    public MainPage()  
    {  
        this.InitializeComponent();  
        Window.Current.CoreWindow.SizeChanged += CoreWindow_SizeChanged;  
    }  
      
    private void CoreWindow_SizeChanged(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.WindowSizeChangedEventArgs args)  
    {  
         
    }  
    

    Thanks
    Nico Zhu


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.