/// <summary> 当页面被卸载时执行 </summary> private void Page_Unloaded(object sender, RoutedEventArgs e) { TilesView.RemoveHandler(UIElement.KeyDownEvent, keyDownHandler); keyDownHandler = null; }
/// <summary> 当页面加载完毕时执行 </summary> private void Page_Loaded(object sender, RoutedEventArgs e) { this.keyDownHandler = new KeyEventHandler(TilesView_KeyDown); TilesView.AddHandler(UIElement.KeyDownEvent, keyDownHandler, true); }