(WinUI 3) Visual State Manager throwing System.Runtime.InteropServices.COMException
I use the
VisualStateMangaer.GoToState()
VisualStateMangaer.GoToState()
method twice, with the same parameters. Strangely, it only works in one of the situations and throws an exception in the other. What am I missing here?
private void DialogLoaded (object sender, RoutedEventArgs e){ VisualStateManager.GoToState(this, InternetConnected() ? "IsbnEnabled" : "IsbnDisabled", false); // This works perfectly fine. NetworkInformation.NetworkStatusChanged += delegate { bool connected = InternetConnected(); VisualStateManager.GoToState(this, connected ? "IsbnEnabled" : "IsbnDisabled", false); // This one throws a System.Runtime.InteropServices.COMException with no message. };}
private void DialogLoaded (object sender, RoutedEventArgs e){ VisualStateManager.GoToState(this, InternetConnected() ? "IsbnEnabled" : "IsbnDisabled", false); // This works perfectly fine. NetworkInformation.NetworkStatusChanged += delegate { bool connected = InternetConnected(); VisualStateManager.GoToState(this, connected ? "IsbnEnabled" : "IsbnDisabled", false); // This one throws a System.Runtime.InteropServices.COMException with no message. };}