在 Release Preview 中,您需要再次对不同的事件做出反应 :) 现在是 SizeChanged,而不是 ViewStateChanged。
以前,您的应用会执行以下操作来处理视图状态更改:
using Windows.UI.ViewManagement;
// Register for the viewstatechanged event
ApplicationView.GetForCurrentView().ViewStateChanged += ViewStateChanged;
private void ViewStateChanged(ApplicationView sender, ApplicationViewStateChangedEventArgs e)
{
// Obtain view state from event payload
ApplicationViewState myViewState = e.ViewState;
}
现在应用程序应该这样做:
using Windows.UI.ViewManagement;
// Register for the window resize event
Window.Current.SizeChanged += WindowSizeChanged;
private void WindowSizeChanged(object sender, Windows.UI.Core.WindowSizeChangedEventArgs e)
{
// Obtain view state by explicitly querying for it
ApplicationViewState myViewState = ApplicationView.Value;
}
更多信息在这里