/
githubmirror
/
PowerToys
Обзор
Документация
Войти
/
githubmirror
/
PowerToys
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/common/Common.UI.Controls/Controls/ShortcutWithTextLabelControl/ShortcutWithTextLabelControl.xaml
67 строк
4 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:tk="using:CommunityToolkit.WinUI" xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"> <Style BasedOn="{StaticResource DefaultShortcutWithTextLabelControlStyle}" TargetType="local:ShortcutWithTextLabelControl" /> <Style x:Key="DefaultShortcutWithTextLabelControlStyle" TargetType="local:ShortcutWithTextLabelControl"> <Setter Property="KeyVisualStyle" Value="{StaticResource DefaultKeyVisualStyle}" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="local:ShortcutWithTextLabelControl"> <Grid ColumnSpacing="8"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <ItemsControl x:Name="ShortcutsControl" VerticalAlignment="Bottom" AutomationProperties.AccessibilityView="Raw" IsTabStop="False" ItemsSource="{TemplateBinding Keys}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <StackPanel Orientation="Horizontal" Spacing="4" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <StackPanel Orientation="Vertical"> <local:KeyVisual tk:FrameworkElementExtensions.AncestorType="local:ShortcutWithTextLabelControl" AutomationProperties.AccessibilityView="Raw" Content="{Binding}" IsTabStop="False" Style="{Binding (tk:FrameworkElementExtensions.Ancestor).KeyVisualStyle, RelativeSource={RelativeSource Self}}" /> </StackPanel> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> <tkcontrols:MarkdownTextBlock x:Name="LabelControl" Grid.Column="1" VerticalAlignment="Center" Config="{TemplateBinding MarkdownConfig}" Text="{TemplateBinding Text}" /> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="LabelPlacementStates"> <VisualState x:Name="LabelAfter" /> <VisualState x:Name="LabelBefore"> <VisualState.Setters> <Setter Target="LabelControl.(Grid.Column)" Value="0" /> <Setter Target="ShortcutsControl.(Grid.Column)" Value="1" /> </VisualState.Setters> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> </ResourceDictionary>