/
githubmirror
/
PowerToys
Обзор
Документация
Войти
/
githubmirror
/
PowerToys
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/common/Common.UI.Controls/Controls/KeyVisual/KeyCharPresenter.xaml
107 строк
6 KB
Niels Laute
Creating a Common.UI.Controls lib (#45542)
12 фев 2026, 18:45
Не верифицирован
12 фев 2026, 18:45
75bf642
Код
Авторство
О чём код?
<?xml version="1.0" encoding="utf-8" ?> <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:Microsoft.PowerToys.Common.UI.Controls" xmlns:ui="using:CommunityToolkit.WinUI"> <Style BasedOn="{StaticResource DefaultKeyCharPresenterStyle}" TargetType="local:KeyCharPresenter" /> <Style x:Key="DefaultKeyCharPresenterStyle" TargetType="local:KeyCharPresenter"> <Setter Property="FontWeight" Value="Normal" /> <Setter Property="HorizontalAlignment" Value="Left" /> <Setter Property="IsTabStop" Value="False" /> <Setter Property="AutomationProperties.AccessibilityView" Value="Raw" /> <Setter Property="HorizontalContentAlignment" Value="Center" /> <Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="VerticalAlignment" Value="Center" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="local:KeyCharPresenter"> <Grid Height="{TemplateBinding FontSize}"> <TextBlock HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontWeight="{TemplateBinding FontWeight}" Text="{TemplateBinding Content}" TextLineBounds="Tight" /> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="WindowsKeyCharPresenterStyle" BasedOn="{StaticResource DefaultKeyCharPresenterStyle}" TargetType="local:KeyCharPresenter"> <!-- Scale to visually align the height of the Windows logo and text --> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="local:KeyCharPresenter"> <Grid Height="{TemplateBinding FontSize}"> <Viewbox> <PathIcon Data="M9 20H0V11H9V20ZM20 20H11V11H20V20ZM9 9H0V0H9V9ZM20 9H11V0H20V9Z" /> </Viewbox> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="OfficeKeyCharPresenterStyle" BasedOn="{StaticResource DefaultKeyCharPresenterStyle}" TargetType="local:KeyCharPresenter"> <!-- Scale to visually align the height of the Office logo and text --> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="local:KeyCharPresenter"> <Grid Height="{TemplateBinding FontSize}"> <Viewbox> <PathIcon Data="M1792 405v1238q0 33-10 62t-28 54-44 41-57 27l-555 159q-23 6-47 6-31 0-58-8t-53-24l-363-205q-20-11-31-29t-12-42q0-35 24-59t60-25h470V458L735 584q-43 15-69 53t-26 83v651q0 41-20 73t-55 53l-167 91q-23 12-46 12-40 0-68-28t-28-68V587q0-51 26-96t71-71L949 81q41-23 89-23 17 0 30 2t30 8l555 153q31 9 56 27t44 42 29 54 10 61zm-128 1238V405q0-22-13-38t-34-23l-273-75-64-18-64-18v1586l401-115q21-6 34-22t13-39z" /> </Viewbox> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="CopilotKeyCharPresenterStyle" BasedOn="{StaticResource DefaultKeyCharPresenterStyle}" TargetType="local:KeyCharPresenter"> <!-- Scale to visually align the height of the Copilot logo and text --> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="local:KeyCharPresenter"> <Grid Height="{TemplateBinding FontSize}"> <Viewbox> <PathIcon Data="M0 1213q0-60 10-124t27-130 35-129 38-121q18-55 41-119t54-129 70-125 87-106 106-74 129-28h661q59 0 114 17t96 64q30 34 46 72t33 81l22 58q11 29 34 52 23 25 56 31t65 9h4q157 0 238 83t82 240q0 60-10 125t-27 130-35 128-38 121q-18 55-41 119t-54 129-70 125-87 106-106 74-129 28H790q-61 0-107-15t-82-44-61-72-46-98q-11-29-24-60t-35-55q-23-25-51-31t-60-9h-4q-157 0-238-83T0 1213zm598-957q-50 0-93 25t-79 68-67 94-54 108-42 106-31 91q-17 51-35 110t-33 119-26 121-10 114q0 102 43 149t147 47h163q39 0 74-12t64-35 50-53 34-67q19-58 35-115t35-117q35-117 70-232t72-233q23-73 47-147t63-141H598zm452 285q69-29 143-29h281q-18-29-29-59t-21-58-21-54-30-44-46-30-69-11q-32 0-60 9t-48 35q-17 23-31 53t-27 63-23 65-19 60zm-296 867h101q39 0 74-12t66-34 52-52 33-68l58-191 42-140q21-70 43-140 11-36 28-69t43-62h-101q-39 0-74 12t-66 34-52 52-33 68q-15 48-29 96t-29 96q-21 70-41 140t-44 140q-11 36-28 68t-43 62zm814-768q-39 0-74 12t-64 35-50 53-34 68q-56 174-107 347t-106 349q-23 74-47 147t-63 141h427q50 0 93-25t79-68 67-94 54-108 42-106 31-91q16-51 34-110t34-119 26-121 10-114q0-102-43-149t-147-47h-162zm-570 867q-69 29-143 29H564q17 28 29 58t22 58 24 54 32 45 48 30 71 11q31 0 60-8t49-35q15-19 29-50t28-65 24-69 18-58z" /> </Viewbox> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="GlyphKeyCharPresenterStyle" BasedOn="{StaticResource DefaultKeyCharPresenterStyle}" TargetType="local:KeyCharPresenter"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="local:KeyCharPresenter"> <Grid> <Viewbox> <FontIcon HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" FontSize="{TemplateBinding FontSize}" FontWeight="{TemplateBinding FontWeight}" Glyph="{TemplateBinding Content}" /> </Viewbox> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> </ResourceDictionary>