I thought this was clever. It apparently wasn't

This commit is contained in:
Mike Griese
2024-06-03 11:19:58 -05:00
parent 6c0508611f
commit 75ee4559a3
3 changed files with 13 additions and 14 deletions

View File

@@ -1104,13 +1104,13 @@ namespace winrt::TerminalApp::implementation
_searchBox().Select(filter.size(), 0);
}
double SuggestionsControl::FontHeight()
{
return winrt::unbox_value_or<double>(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));
}
// double SuggestionsControl::FontHeight()
// {
// return winrt::unbox_value_or<double>(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));
// }
}

View File

@@ -50,8 +50,8 @@ namespace winrt::TerminalApp::implementation
til::typed_event<winrt::TerminalApp::SuggestionsControl, Microsoft::Terminal::Settings::Model::Command> DispatchCommandRequested;
til::typed_event<Windows::Foundation::IInspectable, Microsoft::Terminal::Settings::Model::Command> PreviewAction;
double FontHeight();
void FontHeight(double height);
// double FontHeight();
// void FontHeight(double height);
til::property_changed_event PropertyChanged;
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, NoMatchesText, PropertyChanged.raise);
@@ -59,7 +59,7 @@ namespace winrt::TerminalApp::implementation
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);
WINRT_OBSERVABLE_PROPERTY(double, FontHeight, PropertyChanged.raise, 12.0);
private:
struct winrt_object_hash

View File

@@ -25,7 +25,6 @@
<UserControl.Resources>
<ResourceDictionary>
<x:Double x:Key="ListFontSize">12</x:Double>
<DataTemplate x:Key="ListItemTemplate"
x:DataType="local:FilteredCommand">
<ListViewItem MinHeight="0"
@@ -33,7 +32,7 @@
HorizontalContentAlignment="Stretch"
AutomationProperties.AcceleratorKey="{x:Bind Item.KeyChordText, Mode=OneWay}"
AutomationProperties.Name="{x:Bind Item.Name, Mode=OneWay}"
FontSize="{ThemeResource ListFontSize}" />
FontSize="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=FontSize}" />
</DataTemplate>
<DataTemplate x:Key="GeneralItemTemplate"
@@ -200,7 +199,7 @@
CanReorderItems="False"
ChoosingItemContainer="_choosingItemContainer"
ContainerContentChanging="_containerContentChanging"
FontSize="32"
FontSize="{x:Bind FontHeight}"
IsItemClickEnabled="True"
ItemClick="_listItemClicked"
ItemsSource="{x:Bind FilteredActions}"