/
githubmirror
/
Files
Обзор
Документация
Войти
/
githubmirror
/
Files
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Files.App.Controls/Storage/StorageRing/StorageRing.xaml
189 строк
9 KB
Martin Anderson
Code Quality: Update StorageRing.xaml - Replace Storyboard with VisualState Setters (#18532)
03 июн 2026, 17:39
Не верифицирован
03 июн 2026, 17:39
a6d6df6
Код
Авторство
О чём код?
<!-- Copyright (c) Files Community. Licensed under the MIT License. --> <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:Files.App.Controls" xmlns:primitives="using:Files.App.Controls.Primitives"> <ResourceDictionary.ThemeDictionaries> <ResourceDictionary x:Key="Default"> <x:Double x:Key="StorageRingValueRingThickness">3</x:Double> <x:Double x:Key="StorageRingTrackRingThickness">1</x:Double> <Thickness x:Key="StorageRingPadding">0</Thickness> <Thickness x:Key="StorageRingMargin">0</Thickness> <PenLineCap x:Key="StorageRingValueStartCap">Round</PenLineCap> <PenLineCap x:Key="StorageRingValueEndCap">Round</PenLineCap> <PenLineCap x:Key="StorageRingTrackStartCap">Round</PenLineCap> <PenLineCap x:Key="StorageRingTrackEndCap">Round</PenLineCap> <StaticResource x:Key="StorageRingBackgroundBrush" ResourceKey="ControlFillColorTransparentBrush" /> <StaticResource x:Key="StorageRingValueBrush" ResourceKey="AccentFillColorDefaultBrush" /> <StaticResource x:Key="StorageRingValueCautionBrush" ResourceKey="SystemFillColorCautionBrush" /> <StaticResource x:Key="StorageRingValueCriticalBrush" ResourceKey="SystemFillColorCriticalBrush" /> <StaticResource x:Key="StorageRingValueDisabledBrush" ResourceKey="AccentFillColorDisabledBrush" /> <StaticResource x:Key="StorageRingTrackBrush" ResourceKey="ControlStrongStrokeColorDefaultBrush" /> <StaticResource x:Key="StorageRingTrackCautionBrush" ResourceKey="ControlStrongStrokeColorDefaultBrush" /> <StaticResource x:Key="StorageRingTrackCriticalBrush" ResourceKey="ControlStrongStrokeColorDefaultBrush" /> <StaticResource x:Key="StorageRingTrackDisabledBrush" ResourceKey="ControlStrongStrokeColorDisabledBrush" /> </ResourceDictionary> <ResourceDictionary x:Key="HighContrast"> <x:Double x:Key="StorageRingValueRingThickness">4</x:Double> <x:Double x:Key="StorageRingTrackRingThickness">2</x:Double> <Thickness x:Key="StorageRingPadding">0</Thickness> <Thickness x:Key="StorageRingMargin">0</Thickness> <PenLineCap x:Key="StorageRingValueStartCap">Round</PenLineCap> <PenLineCap x:Key="StorageRingValueEndCap">Round</PenLineCap> <PenLineCap x:Key="StorageRingTrackStartCap">Round</PenLineCap> <PenLineCap x:Key="StorageRingTrackEndCap">Round</PenLineCap> <StaticResource x:Key="StorageRingBackgroundBrush" ResourceKey="SystemControlBackgroundBaseLowBrush" /> <StaticResource x:Key="StorageRingValueBrush" ResourceKey="SystemColorHighlightColorBrush" /> <StaticResource x:Key="StorageRingValueCautionBrush" ResourceKey="SystemColorHotlightColorBrush" /> <StaticResource x:Key="StorageRingValueCriticalBrush" ResourceKey="SystemColorHotlightColorBrush" /> <StaticResource x:Key="StorageRingValueDisabledBrush" ResourceKey="SystemColorGrayTextBrush" /> <StaticResource x:Key="StorageRingTrackBrush" ResourceKey="SystemColorWindowTextColorBrush" /> <StaticResource x:Key="StorageRingTrackCautionBrush" ResourceKey="SystemColorWindowTextColorBrush" /> <StaticResource x:Key="StorageRingTrackCriticalBrush" ResourceKey="SystemColorWindowTextColorBrush" /> <StaticResource x:Key="StorageRingTrackDisabledBrush" ResourceKey="SystemColorGrayTextBrush" /> </ResourceDictionary> <ResourceDictionary x:Key="Light"> <x:Double x:Key="StorageRingValueRingThickness">3</x:Double> <x:Double x:Key="StorageRingTrackRingThickness">1</x:Double> <Thickness x:Key="StorageRingPadding">0</Thickness> <Thickness x:Key="StorageRingMargin">0</Thickness> <PenLineCap x:Key="StorageRingValueStartCap">Round</PenLineCap> <PenLineCap x:Key="StorageRingValueEndCap">Round</PenLineCap> <PenLineCap x:Key="StorageRingTrackStartCap">Round</PenLineCap> <PenLineCap x:Key="StorageRingTrackEndCap">Round</PenLineCap> <StaticResource x:Key="StorageRingBackgroundBrush" ResourceKey="ControlFillColorTransparentBrush" /> <StaticResource x:Key="StorageRingValueBrush" ResourceKey="AccentFillColorDefaultBrush" /> <StaticResource x:Key="StorageRingValueCautionBrush" ResourceKey="SystemFillColorCautionBrush" /> <StaticResource x:Key="StorageRingValueCriticalBrush" ResourceKey="SystemFillColorCriticalBrush" /> <StaticResource x:Key="StorageRingValueDisabledBrush" ResourceKey="AccentFillColorDisabledBrush" /> <StaticResource x:Key="StorageRingTrackBrush" ResourceKey="ControlStrongStrokeColorDefaultBrush" /> <StaticResource x:Key="StorageRingTrackCautionBrush" ResourceKey="ControlStrongStrokeColorDefaultBrush" /> <StaticResource x:Key="StorageRingTrackCriticalBrush" ResourceKey="ControlStrongStrokeColorDefaultBrush" /> <StaticResource x:Key="StorageRingTrackDisabledBrush" ResourceKey="ControlStrongStrokeColorDisabledBrush" /> </ResourceDictionary> </ResourceDictionary.ThemeDictionaries> <Style BasedOn="{StaticResource DefaultStorageRingStyle}" TargetType="local:StorageRing" /> <Style x:Key="DefaultStorageRingStyle" TargetType="local:StorageRing"> <Setter Property="BorderBrush" Value="Transparent" /> <Setter Property="BorderThickness" Value="0" /> <Setter Property="Background" Value="{ThemeResource StorageRingTrackBrush}" /> <Setter Property="Foreground" Value="{ThemeResource StorageRingValueBrush}" /> <Setter Property="ValueRingThickness" Value="{ThemeResource StorageRingValueRingThickness}" /> <Setter Property="TrackRingThickness" Value="{ThemeResource StorageRingTrackRingThickness}" /> <Setter Property="Width" Value="16" /> <Setter Property="Height" Value="16" /> <Setter Property="MinAngle" Value="0" /> <Setter Property="MaxAngle" Value="360" /> <Setter Property="StartAngle" Value="0" /> <Setter Property="Minimum" Value="0" /> <Setter Property="Maximum" Value="100" /> <Setter Property="Value" Value="25" /> <Setter Property="Padding" Value="{ThemeResource StorageRingPadding}" /> <Setter Property="Margin" Value="{ThemeResource StorageRingMargin}" /> <Setter Property="LargeChange" Value="10" /> <Setter Property="SmallChange" Value="0.1" /> <Setter Property="UseLayoutRounding" Value="True" /> <Setter Property="MinWidth" Value="12" /> <Setter Property="MinHeight" Value="12" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="local:StorageRing"> <Border x:Name="RingRootPanel" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" MinWidth="{TemplateBinding MinWidth}" MinHeight="{TemplateBinding MinHeight}" Padding="{TemplateBinding Padding}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"> <Grid x:Name="PART_Container" HorizontalAlignment="Center" VerticalAlignment="Center" Background="{ThemeResource StorageRingBackgroundBrush}" BackgroundSizing="OuterBorderEdge"> <primitives:RingShape x:Name="PART_TrackRingShape" IsCircle="True" MaxAngle="{TemplateBinding MaxAngle}" MinAngle="{TemplateBinding MinAngle}" Stroke="{TemplateBinding Background}" StrokeEndLineCap="{ThemeResource StorageRingTrackEndCap}" StrokeStartLineCap="{ThemeResource StorageRingTrackStartCap}" StrokeThickness="{TemplateBinding TrackRingThickness}" SweepDirection="Clockwise" UseLayoutRounding="True" /> <primitives:RingShape x:Name="PART_ValueRingShape" IsCircle="True" MaxAngle="{TemplateBinding MaxAngle}" MinAngle="{TemplateBinding MinAngle}" Stroke="{TemplateBinding Foreground}" StrokeEndLineCap="{ThemeResource StorageRingValueEndCap}" StrokeStartLineCap="{ThemeResource StorageRingValueStartCap}" StrokeThickness="{TemplateBinding ValueRingThickness}" SweepDirection="Clockwise" UseLayoutRounding="True" /> </Grid> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="ControlStates"> <VisualState x:Name="Safe" /> <VisualState x:Name="Caution"> <VisualState.Setters> <Setter Target="PART_ValueRingShape.Stroke" Value="{ThemeResource StorageRingValueCautionBrush}" /> <Setter Target="PART_TrackRingShape.Stroke" Value="{ThemeResource StorageRingTrackCautionBrush}" /> </VisualState.Setters> </VisualState> <VisualState x:Name="Critical"> <VisualState.Setters> <Setter Target="PART_ValueRingShape.Stroke" Value="{ThemeResource StorageRingValueCriticalBrush}" /> <Setter Target="PART_TrackRingShape.Stroke" Value="{ThemeResource StorageRingTrackCriticalBrush}" /> </VisualState.Setters> </VisualState> <VisualState x:Name="Disabled"> <VisualState.Setters> <Setter Target="PART_ValueRingShape.Stroke" Value="{ThemeResource ControlStrongStrokeColorDisabledBrush}" /> <Setter Target="PART_TrackRingShape.Stroke" Value="{ThemeResource ControlStrongStrokeColorDisabledBrush}" /> </VisualState.Setters> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> </ResourceDictionary>