diff --git a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/EditKeyboardWindow.cpp b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/EditKeyboardWindow.cpp index bd86772840..069e0ac89b 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/EditKeyboardWindow.cpp +++ b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/EditKeyboardWindow.cpp @@ -354,7 +354,14 @@ inline void CreateEditKeyboardWindowImpl(HINSTANCE hInst, KBMEditor::KeyboardMan xamlContainer.Children().Append(header); xamlContainer.Children().Append(helperText); xamlContainer.Children().Append(scrollViewer); - xamlContainer.UpdateLayout(); + try + { + // If a layout update has been triggered by other methods (e.g.: adapting to zoom level), this may throw an exception. + xamlContainer.UpdateLayout(); + } + catch (...) + { + } desktopSource.Content(xamlContainer); ////End XAML Island section diff --git a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/EditShortcutsWindow.cpp b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/EditShortcutsWindow.cpp index 464327b702..716b398177 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/EditShortcutsWindow.cpp +++ b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/EditShortcutsWindow.cpp @@ -325,7 +325,14 @@ inline void CreateEditShortcutsWindowImpl(HINSTANCE hInst, KBMEditor::KeyboardMa xamlContainer.Children().Append(header); xamlContainer.Children().Append(helperText); xamlContainer.Children().Append(scrollViewer); - xamlContainer.UpdateLayout(); + try + { + // If a layout update has been triggered by other methods (e.g.: adapting to zoom level), this may throw an exception. + xamlContainer.UpdateLayout(); + } + catch (...) + { + } desktopSource.Content(xamlContainer); diff --git a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/KeyboardManagerState.cpp b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/KeyboardManagerState.cpp index 037fa2edf8..c3a92f4e94 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/KeyboardManagerState.cpp +++ b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/KeyboardManagerState.cpp @@ -171,8 +171,22 @@ void KeyboardManagerState::UpdateDetectShortcutUI() AddKeyToLayout(currentShortcutUI2.as(), shortcut[i]); } } - currentShortcutUI1.as().UpdateLayout(); - currentShortcutUI2.as().UpdateLayout(); + try + { + // If a layout update has been triggered by other methods (e.g.: adapting to zoom level), this may throw an exception. + currentShortcutUI1.as().UpdateLayout(); + } + catch (...) + { + } + try + { + // If a layout update has been triggered by other methods (e.g.: adapting to zoom level), this may throw an exception. + currentShortcutUI2.as().UpdateLayout(); + } + catch (...) + { + } }); } @@ -189,7 +203,14 @@ void KeyboardManagerState::UpdateDetectSingleKeyRemapUI() currentSingleKeyUI.as().Children().Clear(); hstring key = winrt::to_hstring(keyboardMap.GetKeyName(detectedRemapKey).c_str()); AddKeyToLayout(currentSingleKeyUI.as(), key); - currentSingleKeyUI.as().UpdateLayout(); + try + { + // If a layout update has been triggered by other methods (e.g.: adapting to zoom level), this may throw an exception. + currentSingleKeyUI.as().UpdateLayout(); + } + catch (...) + { + } }); } diff --git a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/ShortcutControl.cpp b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/ShortcutControl.cpp index ef502d9671..ac57a8967c 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/ShortcutControl.cpp +++ b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/ShortcutControl.cpp @@ -42,7 +42,14 @@ ShortcutControl::ShortcutControl(StackPanel table, StackPanel row, const int col shortcutControlLayout.as().Children().Append(typeShortcut.as