From eef9a539caff59dbadf66167950caea82d06bb92 Mon Sep 17 00:00:00 2001 From: Tian L <60599517+tian-lt@users.noreply.github.com> Date: Thu, 22 Apr 2021 17:16:44 +0800 Subject: [PATCH] fixes up the crash of type casting (#21) --- src/Calculator/Common/KeyboardShortcuManager.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Calculator/Common/KeyboardShortcuManager.cs b/src/Calculator/Common/KeyboardShortcuManager.cs index ea818e0b..fc4e9104 100644 --- a/src/Calculator/Common/KeyboardShortcuManager.cs +++ b/src/Calculator/Common/KeyboardShortcuManager.cs @@ -1,9 +1,10 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using CalculatorApp.ViewModel; using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Diagnostics; using System.Linq; using Windows.Foundation.Collections; @@ -621,7 +622,7 @@ namespace CalculatorApp var categoryName = AppResourceProvider.GetInstance().GetResourceString("DateCalculationModeText"); appViewModel.CategoryName = categoryName; - var menuItems = ((IObservableVector)navView.MenuItemsSource); + var menuItems = ((ObservableCollection)navView.MenuItemsSource); var flatIndex = NavCategory.GetFlatIndex(ViewMode.Date); navView.SelectedItem = menuItems[flatIndex]; return; @@ -710,7 +711,7 @@ namespace CalculatorApp { var navView = item as MUXC.NavigationView; // CSHARP_MIGRATION: TODO: check if this line is still needed - var menuItems = ((IObservableVector)navView.MenuItemsSource); + var menuItems = ((ObservableCollection)navView.MenuItemsSource); if (menuItems != null) { var vm = (navView.DataContext as ApplicationViewModel);