From 6c0508611ffc2385016b7facb0bf17bc1215ebb6 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Mon, 3 Jun 2024 11:10:04 -0500 Subject: [PATCH] Try to get the sxnui font size to match the control, but this is w e i r d --- src/cascadia/TerminalApp/SuggestionsControl.cpp | 9 +++++++++ src/cascadia/TerminalApp/SuggestionsControl.h | 4 ++++ src/cascadia/TerminalApp/SuggestionsControl.idl | 1 + src/cascadia/TerminalApp/SuggestionsControl.xaml | 9 +++++---- src/cascadia/TerminalApp/TerminalPage.cpp | 2 ++ 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/cascadia/TerminalApp/SuggestionsControl.cpp b/src/cascadia/TerminalApp/SuggestionsControl.cpp index 902cd06ebb..5dc523b1cd 100644 --- a/src/cascadia/TerminalApp/SuggestionsControl.cpp +++ b/src/cascadia/TerminalApp/SuggestionsControl.cpp @@ -1104,4 +1104,13 @@ namespace winrt::TerminalApp::implementation _searchBox().Select(filter.size(), 0); } + double SuggestionsControl::FontHeight() + { + return winrt::unbox_value_or(Resources().Lookup(winrt::box_value(L"ListFontSize")), 12.0); + } + void SuggestionsControl::FontHeight(double height) + { + Resources().Insert(winrt::box_value(L"ListFontSize"), winrt::box_value(height)); + } + } diff --git a/src/cascadia/TerminalApp/SuggestionsControl.h b/src/cascadia/TerminalApp/SuggestionsControl.h index 77596ce307..12a4b93bb0 100644 --- a/src/cascadia/TerminalApp/SuggestionsControl.h +++ b/src/cascadia/TerminalApp/SuggestionsControl.h @@ -50,12 +50,16 @@ namespace winrt::TerminalApp::implementation til::typed_event DispatchCommandRequested; til::typed_event PreviewAction; + double FontHeight(); + void FontHeight(double height); + til::property_changed_event PropertyChanged; WINRT_OBSERVABLE_PROPERTY(winrt::hstring, NoMatchesText, PropertyChanged.raise); WINRT_OBSERVABLE_PROPERTY(winrt::hstring, SearchBoxPlaceholderText, PropertyChanged.raise); WINRT_OBSERVABLE_PROPERTY(winrt::hstring, ControlName, PropertyChanged.raise); WINRT_OBSERVABLE_PROPERTY(winrt::hstring, ParentCommandName, PropertyChanged.raise); WINRT_OBSERVABLE_PROPERTY(winrt::hstring, ParsedCommandLineText, PropertyChanged.raise); + // WINRT_OBSERVABLE_PROPERTY(double, FontHeight, PropertyChanged.raise, 12.0); private: struct winrt_object_hash diff --git a/src/cascadia/TerminalApp/SuggestionsControl.idl b/src/cascadia/TerminalApp/SuggestionsControl.idl index 103d3e17d2..6bfa3da9e5 100644 --- a/src/cascadia/TerminalApp/SuggestionsControl.idl +++ b/src/cascadia/TerminalApp/SuggestionsControl.idl @@ -28,6 +28,7 @@ namespace TerminalApp String SearchBoxPlaceholderText { get; }; String ControlName { get; }; String ParentCommandName { get; }; + Double FontHeight{ get; set; }; Windows.UI.Xaml.FrameworkElement SelectedItem { get; }; diff --git a/src/cascadia/TerminalApp/SuggestionsControl.xaml b/src/cascadia/TerminalApp/SuggestionsControl.xaml index 49525aa4ad..30b95a2108 100644 --- a/src/cascadia/TerminalApp/SuggestionsControl.xaml +++ b/src/cascadia/TerminalApp/SuggestionsControl.xaml @@ -25,15 +25,15 @@ + 12 - + FontSize="{ThemeResource ListFontSize}" /> (ActualWidth()), gsl::narrow_cast(ActualHeight()) }; + sxnUi.FontHeight(characterSize.Height); + sxnUi.Open(mode, commandsCollection, filterText,