/
githubmirror
/
Files
Обзор
Документация
Войти
/
githubmirror
/
Files
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Files.App/UserControls/Menus/ToggleMenuFlyoutItemWithThemedIcon.xaml
169 строк
8 KB
Yair
Code Quality: Updated license header
31 дек 2024, 05:03
31 дек 2024, 05:03
8436c6d
Код
Авторство
О чём код?
<!-- Copyright (c) Files Community. Licensed under the MIT License. --> <ToggleMenuFlyoutItem x:Class="Files.App.UserControls.ToggleMenuFlyoutItemWithThemedIcon" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:controls="using:Files.App.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="using:Files.App.UserControls" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" d:DesignHeight="300" d:DesignWidth="400" HighContrastAdjustment="None" mc:Ignorable="d"> <ToggleMenuFlyoutItem.Style> <Style TargetType="local:ToggleMenuFlyoutItemWithThemedIcon"> <Setter Property="Padding" Value="{ThemeResource MenuFlyoutItemThemePadding}" /> <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" /> <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="local:ToggleMenuFlyoutItemWithThemedIcon"> <Grid x:Name="LayoutRoot" Margin="{StaticResource MenuFlyoutItemMargin}" Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{StaticResource ControlCornerRadius}"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*" /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <FontIcon x:Name="CheckGlyph" Margin="0,0,16,0" FontFamily="{ThemeResource SymbolThemeFontFamily}" FontSize="12" Foreground="{ThemeResource MenuFlyoutSubItemChevron}" Glyph="" Opacity="0" /> <Viewbox x:Name="IconRoot" Grid.Column="1" Width="16" Height="16" HorizontalAlignment="Left" VerticalAlignment="Center" Visibility="Collapsed"> <ContentPresenter x:Name="IconContent" Content="{TemplateBinding Icon}" /> </Viewbox> <Viewbox Grid.Column="1" Width="16" Height="16" Margin="0" HorizontalAlignment="Left" VerticalAlignment="Center"> <controls:ThemedIcon IsEnabled="{TemplateBinding IsEnabled}" Style="{TemplateBinding ThemedIconStyle}" /> </Viewbox> <TextBlock x:Name="TextBlock" Grid.Column="1" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Foreground="{TemplateBinding Foreground}" Text="{TemplateBinding Text}" TextTrimming="Clip" /> <TextBlock x:Name="KeyboardAcceleratorTextBlock" Grid.Column="2" MinWidth="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.KeyboardAcceleratorTextMinWidth}" Margin="24,0,0,0" HorizontalAlignment="Right" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" AutomationProperties.AccessibilityView="Raw" Foreground="{ThemeResource MenuFlyoutItemKeyboardAcceleratorTextForeground}" Style="{ThemeResource CaptionTextBlockStyle}" Text="{TemplateBinding KeyboardAcceleratorTextOverride}" Visibility="Collapsed" /> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="CommonStates"> <VisualState x:Name="Normal" /> <VisualState x:Name="PointerOver"> <VisualState.Setters> <Setter Target="LayoutRoot.Background" Value="{ThemeResource MenuFlyoutItemBackgroundPointerOver}" /> <Setter Target="TextBlock.Foreground" Value="{ThemeResource MenuFlyoutItemForegroundPointerOver}" /> <Setter Target="CheckGlyph.Foreground" Value="{ThemeResource MenuFlyoutItemForegroundPointerOver}" /> <Setter Target="IconContent.Foreground" Value="{ThemeResource MenuFlyoutItemForegroundPointerOver}" /> <Setter Target="KeyboardAcceleratorTextBlock.Foreground" Value="{ThemeResource MenuFlyoutItemKeyboardAcceleratorTextForegroundPointerOver}" /> </VisualState.Setters> </VisualState> <VisualState x:Name="Pressed"> <VisualState.Setters> <Setter Target="LayoutRoot.Background" Value="{ThemeResource MenuFlyoutItemBackgroundPressed}" /> <Setter Target="TextBlock.Foreground" Value="{ThemeResource MenuFlyoutItemForegroundPressed}" /> <Setter Target="CheckGlyph.Foreground" Value="{ThemeResource MenuFlyoutSubItemForegroundPressed}" /> <Setter Target="IconContent.Foreground" Value="{ThemeResource MenuFlyoutItemForegroundPressed}" /> <Setter Target="KeyboardAcceleratorTextBlock.Foreground" Value="{ThemeResource MenuFlyoutItemKeyboardAcceleratorTextForegroundPressed}" /> </VisualState.Setters> </VisualState> <VisualState x:Name="Disabled"> <VisualState.Setters> <Setter Target="LayoutRoot.Background" Value="{ThemeResource MenuFlyoutItemBackgroundDisabled}" /> <Setter Target="TextBlock.Foreground" Value="{ThemeResource MenuFlyoutItemForegroundDisabled}" /> <Setter Target="CheckGlyph.Foreground" Value="{ThemeResource MenuFlyoutSubItemForegroundDisabled}" /> <Setter Target="IconContent.Foreground" Value="{ThemeResource MenuFlyoutItemForegroundDisabled}" /> <Setter Target="KeyboardAcceleratorTextBlock.Foreground" Value="{ThemeResource MenuFlyoutItemKeyboardAcceleratorTextForegroundDisabled}" /> </VisualState.Setters> </VisualState> </VisualStateGroup> <VisualStateGroup x:Name="CheckStates"> <VisualState x:Name="Unchecked" /> <VisualState x:Name="Checked"> <VisualState.Setters> <Setter Target="CheckGlyph.Opacity" Value="1" /> </VisualState.Setters> </VisualState> <VisualState x:Name="UncheckedWithIcon"> <VisualState.Setters> <Setter Target="TextBlock.Margin" Value="{ThemeResource MenuFlyoutItemPlaceholderThemeThickness}" /> <Setter Target="IconRoot.Visibility" Value="Visible" /> </VisualState.Setters> </VisualState> <VisualState x:Name="CheckedWithIcon"> <VisualState.Setters> <Setter Target="TextBlock.Margin" Value="{ThemeResource MenuFlyoutItemPlaceholderThemeThickness}" /> <Setter Target="IconRoot.Visibility" Value="Visible" /> <Setter Target="CheckGlyph.Opacity" Value="1" /> </VisualState.Setters> </VisualState> </VisualStateGroup> <!-- Narrow padding is only applied when flyout was invoked with pen, mouse or keyboard. --> <!-- Default padding is applied for all other cases including touch. --> <VisualStateGroup x:Name="PaddingSizeStates"> <VisualState x:Name="DefaultPadding" /> <VisualState x:Name="NarrowPadding"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="Padding"> <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource MenuFlyoutItemThemePaddingNarrow}" /> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup> <VisualStateGroup x:Name="KeyboardAcceleratorTextVisibility"> <VisualState x:Name="KeyboardAcceleratorTextCollapsed" /> <VisualState x:Name="KeyboardAcceleratorTextVisible"> <VisualState.Setters> <Setter Target="KeyboardAcceleratorTextBlock.Visibility" Value="Visible" /> </VisualState.Setters> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> </ToggleMenuFlyoutItem.Style> </ToggleMenuFlyoutItem>