mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 03:37:59 +01:00
Make Edit Shortcut/Single Key window scrollable (#2409)
* Make Edit Shortcut/Single Key window scrollable * Don't scroll header and buttons * added margin beneath the add button
This commit is contained in:
committed by
GitHub
parent
8f2a33dcaa
commit
8f8bfb9446
@@ -73,9 +73,6 @@ void createEditKeyboardWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMan
|
||||
// Update the xaml island window size becuase initially is 0,0
|
||||
SetWindowPos(hWndXamlIslandEditKeyboardWindow, 0, 0, 0, 400, 400, SWP_SHOWWINDOW);
|
||||
|
||||
// Creating the Xaml content. xamlContainer is the parent UI element
|
||||
Windows::UI::Xaml::Controls::StackPanel xamlContainer;
|
||||
|
||||
// Header for the window
|
||||
Windows::UI::Xaml::Controls::RelativePanel header;
|
||||
header.Margin({ 10, 10, 10, 30 });
|
||||
@@ -291,15 +288,29 @@ void createEditKeyboardWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMan
|
||||
plusSymbol.FontFamily(Xaml::Media::FontFamily(L"Segoe MDL2 Assets"));
|
||||
plusSymbol.Glyph(L"\xE109");
|
||||
addRemapKey.Content(plusSymbol);
|
||||
addRemapKey.Margin({ 10 });
|
||||
addRemapKey.Margin({ 10, 0, 0, 25 });
|
||||
addRemapKey.Click([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) {
|
||||
SingleKeyRemapControl::AddNewControlKeyRemapRow(keyRemapTable, keyboardRemapControlObjects);
|
||||
});
|
||||
|
||||
StackPanel mappingsPanel;
|
||||
mappingsPanel.Children().Append(keyRemapInfoHeader);
|
||||
mappingsPanel.Children().Append(keyRemapTable);
|
||||
mappingsPanel.Children().Append(addRemapKey);
|
||||
|
||||
ScrollViewer scrollViewer;
|
||||
scrollViewer.Content(mappingsPanel);
|
||||
|
||||
// Creating the Xaml content. xamlContainer is the parent UI element
|
||||
RelativePanel xamlContainer;
|
||||
xamlContainer.SetBelow(scrollViewer, header);
|
||||
xamlContainer.SetAlignLeftWithPanel(header, true);
|
||||
xamlContainer.SetAlignRightWithPanel(header, true);
|
||||
xamlContainer.SetAlignLeftWithPanel(scrollViewer, true);
|
||||
xamlContainer.SetAlignRightWithPanel(scrollViewer, true);
|
||||
xamlContainer.Children().Append(header);
|
||||
xamlContainer.Children().Append(keyRemapInfoHeader);
|
||||
xamlContainer.Children().Append(keyRemapTable);
|
||||
xamlContainer.Children().Append(addRemapKey);
|
||||
xamlContainer.Children().Append(scrollViewer);
|
||||
|
||||
xamlContainer.UpdateLayout();
|
||||
desktopSource.Content(xamlContainer);
|
||||
|
||||
|
||||
@@ -74,9 +74,6 @@ void createEditShortcutsWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMa
|
||||
// Update the xaml island window size becuase initially is 0,0
|
||||
SetWindowPos(hWndXamlIslandEditShortcutsWindow, 0, 0, 0, 400, 400, SWP_SHOWWINDOW);
|
||||
|
||||
// Creating the Xaml content. xamlContainer is the parent UI element
|
||||
Windows::UI::Xaml::Controls::StackPanel xamlContainer;
|
||||
|
||||
// Header for the window
|
||||
Windows::UI::Xaml::Controls::RelativePanel header;
|
||||
header.Margin({ 10, 10, 10, 30 });
|
||||
@@ -216,14 +213,27 @@ void createEditShortcutsWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMa
|
||||
plusSymbol.FontFamily(Xaml::Media::FontFamily(L"Segoe MDL2 Assets"));
|
||||
plusSymbol.Glyph(L"\xE109");
|
||||
addShortcut.Content(plusSymbol);
|
||||
addShortcut.Margin({ 10 });
|
||||
addShortcut.Margin({ 10, 0, 0, 25 });
|
||||
addShortcut.Click([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) {
|
||||
ShortcutControl::AddNewShortcutControlRow(shortcutTable, keyboardRemapControlObjects);
|
||||
});
|
||||
|
||||
StackPanel mappingsPanel;
|
||||
mappingsPanel.Children().Append(shortcutTable);
|
||||
mappingsPanel.Children().Append(addShortcut);
|
||||
|
||||
ScrollViewer scrollViewer;
|
||||
scrollViewer.Content(mappingsPanel);
|
||||
|
||||
RelativePanel xamlContainer;
|
||||
xamlContainer.SetBelow(scrollViewer, header);
|
||||
xamlContainer.SetAlignLeftWithPanel(header, true);
|
||||
xamlContainer.SetAlignRightWithPanel(header, true);
|
||||
xamlContainer.SetAlignLeftWithPanel(scrollViewer, true);
|
||||
xamlContainer.SetAlignRightWithPanel(scrollViewer, true);
|
||||
xamlContainer.Children().Append(header);
|
||||
xamlContainer.Children().Append(shortcutTable);
|
||||
xamlContainer.Children().Append(addShortcut);
|
||||
xamlContainer.Children().Append(scrollViewer);
|
||||
|
||||
xamlContainer.UpdateLayout();
|
||||
desktopSource.Content(xamlContainer);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user