committed by
GitHub
8 changed files with 321 additions and 100 deletions
@ -1,81 +1,176 @@ |
|||||
<Styles xmlns="https://github.com/avaloniaui"> |
<Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
||||
|
<Design.PreviewWith> |
||||
|
<Border Padding="20"> |
||||
|
<StackPanel> |
||||
|
<ProgressBar VerticalAlignment="Center" IsIndeterminate="True" /> |
||||
|
<ProgressBar HorizontalAlignment="Left" IsIndeterminate="True" Orientation="Vertical" /> |
||||
|
</StackPanel> |
||||
|
</Border> |
||||
|
</Design.PreviewWith> |
||||
<Style Selector="ProgressBar"> |
<Style Selector="ProgressBar"> |
||||
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush4}"/> |
<Setter Property="Foreground" Value="{DynamicResource SystemControlHighlightAccentBrush}" /> |
||||
<Setter Property="Foreground" Value="{DynamicResource ThemeAccentBrush}"/> |
<Setter Property="Background" Value="{DynamicResource SystemControlBackgroundBaseLowBrush}" /> |
||||
|
<Setter Property="BorderThickness" Value="{DynamicResource ProgressBarBorderThemeThickness}" /> |
||||
|
<Setter Property="BorderBrush" Value="{DynamicResource SystemControlHighlightTransparentBrush}" /> |
||||
|
<Setter Property="Maximum" Value="100" /> |
||||
|
<Setter Property="MinHeight" Value="{DynamicResource ProgressBarThemeMinHeight}" /> |
||||
|
<Setter Property="VerticalAlignment" Value="Center" /> |
||||
<Setter Property="Template"> |
<Setter Property="Template"> |
||||
<ControlTemplate> |
<ControlTemplate> |
||||
<Grid> |
<Border x:Name="ProgressBarRoot" ClipToBounds="True" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{DynamicResource ControlCornerRadius}"> |
||||
<Border Background="{TemplateBinding Background}" |
<Panel> |
||||
BorderBrush="{TemplateBinding BorderBrush}" |
<Panel x:Name="DeterminateRoot"> |
||||
BorderThickness="{TemplateBinding BorderThickness}"> |
<Border CornerRadius="{DynamicResource ControlCornerRadius}" x:Name="PART_Indicator" Margin="{TemplateBinding Padding}" Background="{TemplateBinding Foreground}" /> |
||||
<Border Name="PART_Indicator" Background="{TemplateBinding Foreground}"/> |
</Panel> |
||||
</Border> |
<Panel x:Name="IndeterminateRoot"> |
||||
<LayoutTransformControl |
<Border x:Name="IndeterminateProgressBarIndicator" CornerRadius="{DynamicResource ControlCornerRadius}" Margin="{TemplateBinding Padding}" Background="{TemplateBinding Foreground}" /> |
||||
HorizontalAlignment="Center" |
<Border x:Name="IndeterminateProgressBarIndicator2" CornerRadius="{DynamicResource ControlCornerRadius}" Margin="{TemplateBinding Padding}" Background="{TemplateBinding Foreground}" /> |
||||
VerticalAlignment="Center" |
</Panel> |
||||
IsVisible="{Binding ShowProgressText, RelativeSource={RelativeSource TemplatedParent}}" |
</Panel> |
||||
Name="PART_LayoutTransformControl"> |
</Border> |
||||
<TextBlock |
|
||||
Foreground="{DynamicResource ThemeForegroundBrush}" |
|
||||
Text="{Binding Value, RelativeSource={RelativeSource TemplatedParent}, StringFormat={}{0:0}%}" /> |
|
||||
</LayoutTransformControl> |
|
||||
</Grid> |
|
||||
</ControlTemplate> |
</ControlTemplate> |
||||
</Setter> |
</Setter> |
||||
</Style> |
</Style> |
||||
<Style Selector="ProgressBar:horizontal /template/ Border#PART_Indicator"> |
<Style Selector="ProgressBar:horizontal /template/ Border#PART_Indicator"> |
||||
<Setter Property="HorizontalAlignment" Value="Left"/> |
<Setter Property="HorizontalAlignment" Value="Left" /> |
||||
<Setter Property="VerticalAlignment" Value="Stretch"/> |
<Setter Property="VerticalAlignment" Value="Stretch" /> |
||||
</Style> |
</Style> |
||||
<Style Selector="ProgressBar:vertical /template/ Border#PART_Indicator"> |
<Style Selector="ProgressBar:vertical /template/ Border#PART_Indicator"> |
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/> |
<Setter Property="HorizontalAlignment" Value="Stretch" /> |
||||
<Setter Property="VerticalAlignment" Value="Bottom"/> |
<Setter Property="VerticalAlignment" Value="Bottom" /> |
||||
</Style> |
</Style> |
||||
<Style Selector="ProgressBar:horizontal"> |
<Style Selector="ProgressBar:horizontal"> |
||||
<Setter Property="MinWidth" Value="200"/> |
<Setter Property="MinWidth" Value="200" /> |
||||
<Setter Property="MinHeight" Value="16"/> |
<Setter Property="MinHeight" Value="4" /> |
||||
</Style> |
</Style> |
||||
<Style Selector="ProgressBar:vertical"> |
<Style Selector="ProgressBar:vertical"> |
||||
<Setter Property="MinWidth" Value="16"/> |
<Setter Property="MinWidth" Value="4" /> |
||||
<Setter Property="MinHeight" Value="200"/> |
<Setter Property="MinHeight" Value="200" /> |
||||
</Style> |
</Style> |
||||
<Style Selector="ProgressBar:vertical /template/ LayoutTransformControl#PART_LayoutTransformControl"> |
<Style Selector="ProgressBar:vertical /template/ LayoutTransformControl#PART_LayoutTransformControl"> |
||||
<Setter Property="LayoutTransform"> |
<Setter Property="LayoutTransform"> |
||||
<Setter.Value> |
<Setter.Value> |
||||
<RotateTransform Angle="90"/> |
<RotateTransform Angle="90" /> |
||||
</Setter.Value> |
</Setter.Value> |
||||
</Setter> |
</Setter> |
||||
</Style> |
</Style> |
||||
<Style Selector="ProgressBar:horizontal:indeterminate /template/ Border#PART_Indicator"> |
<!-- FadeInAnimation mockup--> |
||||
|
<Style Selector="ProgressBar /template/ Panel#DeterminateRoot"> |
||||
|
<Setter Property="Transitions"> |
||||
|
<Transitions> |
||||
|
<DoubleTransition Property="Opacity" Duration="0:0:0.197" /> |
||||
|
</Transitions> |
||||
|
</Setter> |
||||
|
</Style> |
||||
|
<Style Selector="ProgressBar /template/ Panel#IndeterminateRoot"> |
||||
|
<Setter Property="Transitions"> |
||||
|
<Transitions> |
||||
|
<DoubleTransition Property="Opacity" Duration="0:0:0.197" /> |
||||
|
</Transitions> |
||||
|
</Setter> |
||||
|
</Style> |
||||
|
<Style Selector="ProgressBar /template/ Panel#DeterminateRoot"> |
||||
|
<Setter Property="Opacity" Value="1" /> |
||||
|
</Style> |
||||
|
<Style Selector="ProgressBar /template/ Panel#IndeterminateRoot"> |
||||
|
<Setter Property="Opacity" Value="0" /> |
||||
|
</Style> |
||||
|
<Style Selector="ProgressBar:indeterminate /template/ Panel#DeterminateRoot"> |
||||
|
<Setter Property="Opacity" Value="0" /> |
||||
|
</Style> |
||||
|
<Style Selector="ProgressBar:indeterminate /template/ Panel#IndeterminateRoot"> |
||||
|
<Setter Property="Opacity" Value="1" /> |
||||
|
</Style> |
||||
|
<Style Selector="ProgressBar:horizontal:indeterminate /template/ Border#IndeterminateProgressBarIndicator"> |
||||
|
<Style.Animations> |
||||
|
<Animation Duration="0:0:2" IterationCount="Infinite"> |
||||
|
<KeyFrame KeyTime="0:0:0" KeySpline="0.4,0,0.6,1"> |
||||
|
<Setter Property="TranslateTransform.X" Value="{Binding $parent[ProgressBar].TemplateProperties.ContainerAnimationStartPosition}" /> |
||||
|
</KeyFrame> |
||||
|
<KeyFrame KeyTime="0:0:1.5" KeySpline="0.4,0,0.6,1"> |
||||
|
<Setter Property="TranslateTransform.X" Value="{Binding $parent[ProgressBar].TemplateProperties.ContainerAnimationEndPosition}" /> |
||||
|
</KeyFrame> |
||||
|
<KeyFrame KeyTime="0:0:2" KeySpline="0.4,0,0.6,1"> |
||||
|
<Setter Property="TranslateTransform.X" Value="{Binding $parent[ProgressBar].TemplateProperties.ContainerAnimationEndPosition}" /> |
||||
|
</KeyFrame> |
||||
|
</Animation> |
||||
|
</Style.Animations> |
||||
|
</Style> |
||||
|
<Style Selector="ProgressBar:horizontal:indeterminate /template/ Border#IndeterminateProgressBarIndicator2"> |
||||
|
<Style.Animations> |
||||
|
<Animation Duration="0:0:2" IterationCount="Infinite"> |
||||
|
<KeyFrame KeyTime="0:0:0" KeySpline="0.4,0,0.6,1"> |
||||
|
<Setter Property="TranslateTransform.X" Value="{Binding $parent[ProgressBar].TemplateProperties.Container2AnimationStartPosition}" /> |
||||
|
</KeyFrame> |
||||
|
<KeyFrame KeyTime="0:0:0.75" KeySpline="0.4,0,0.6,1"> |
||||
|
<Setter Property="TranslateTransform.X" Value="{Binding $parent[ProgressBar].TemplateProperties.Container2AnimationStartPosition}" /> |
||||
|
</KeyFrame> |
||||
|
<KeyFrame KeyTime="0:0:2" KeySpline="0.4,0,0.6,1"> |
||||
|
<Setter Property="TranslateTransform.X" Value="{Binding $parent[ProgressBar].TemplateProperties.Container2AnimationEndPosition}" /> |
||||
|
</KeyFrame> |
||||
|
</Animation> |
||||
|
</Style.Animations> |
||||
|
</Style> |
||||
|
<Style Selector="ProgressBar:vertical:indeterminate /template/ Border#IndeterminateProgressBarIndicator"> |
||||
<Style.Animations> |
<Style.Animations> |
||||
<Animation Duration="0:0:3" |
<Animation Duration="0:0:2" IterationCount="Infinite"> |
||||
IterationCount="Infinite" |
<KeyFrame KeyTime="0:0:0" KeySpline="0.4,0,0.6,1"> |
||||
Easing="LinearEasing"> |
<Setter Property="TranslateTransform.Y" Value="{Binding $parent[ProgressBar].TemplateProperties.ContainerAnimationStartPosition}" /> |
||||
<KeyFrame Cue="0%"> |
</KeyFrame> |
||||
<Setter Property="TranslateTransform.X" |
<KeyFrame KeyTime="0:0:1.5" KeySpline="0.4,0,0.6,1"> |
||||
Value="{Binding IndeterminateStartingOffset, RelativeSource={RelativeSource TemplatedParent}}" /> |
<Setter Property="TranslateTransform.Y" Value="{Binding $parent[ProgressBar].TemplateProperties.ContainerAnimationEndPosition}" /> |
||||
</KeyFrame> |
</KeyFrame> |
||||
<KeyFrame Cue="100%"> |
<KeyFrame KeyTime="0:0:2" KeySpline="0.4,0,0.6,1"> |
||||
<Setter Property="TranslateTransform.X" |
<Setter Property="TranslateTransform.Y" Value="{Binding $parent[ProgressBar].TemplateProperties.ContainerAnimationEndPosition}" /> |
||||
Value="{Binding IndeterminateEndingOffset, RelativeSource={RelativeSource TemplatedParent}}" /> |
|
||||
</KeyFrame> |
</KeyFrame> |
||||
</Animation> |
</Animation> |
||||
</Style.Animations> |
</Style.Animations> |
||||
</Style> |
</Style> |
||||
<Style Selector="ProgressBar:vertical:indeterminate /template/ Border#PART_Indicator"> |
<Style Selector="ProgressBar:vertical:indeterminate /template/ Border#IndeterminateProgressBarIndicator2"> |
||||
<Style.Animations> |
<Style.Animations> |
||||
<Animation Duration="0:0:3" |
<Animation Duration="0:0:2" IterationCount="Infinite"> |
||||
IterationCount="Infinite" |
<KeyFrame KeyTime="0:0:0" KeySpline="0.4,0,0.6,1"> |
||||
Easing="LinearEasing"> |
<Setter Property="TranslateTransform.Y" Value="{Binding $parent[ProgressBar].TemplateProperties.Container2AnimationStartPosition}" /> |
||||
<KeyFrame Cue="0%"> |
|
||||
<Setter Property="TranslateTransform.Y" |
|
||||
Value="{Binding IndeterminateStartingOffset, RelativeSource={RelativeSource TemplatedParent}}" /> |
|
||||
</KeyFrame> |
</KeyFrame> |
||||
<KeyFrame Cue="100%"> |
<KeyFrame KeyTime="0:0:0.75" KeySpline="0.4,0,0.6,1"> |
||||
<Setter Property="TranslateTransform.Y" |
<Setter Property="TranslateTransform.Y" Value="{Binding $parent[ProgressBar].TemplateProperties.Container2AnimationStartPosition}" /> |
||||
Value="{Binding IndeterminateEndingOffset, RelativeSource={RelativeSource TemplatedParent}}" /> |
</KeyFrame> |
||||
|
<KeyFrame KeyTime="0:0:2" KeySpline="0.4,0,0.6,1"> |
||||
|
<Setter Property="TranslateTransform.Y" Value="{Binding $parent[ProgressBar].TemplateProperties.Container2AnimationEndPosition}" /> |
||||
</KeyFrame> |
</KeyFrame> |
||||
</Animation> |
</Animation> |
||||
</Style.Animations> |
</Style.Animations> |
||||
</Style> |
</Style> |
||||
|
<Style Selector="ProgressBar:horizontal /template/ Border#IndeterminateProgressBarIndicator"> |
||||
|
<Setter Property="Width" Value="{Binding $parent[ProgressBar].TemplateProperties.ContainerWidth}" /> |
||||
|
<Setter Property="RenderTransform"> |
||||
|
<Setter.Value> |
||||
|
<TranslateTransform X="{Binding $parent[ProgressBar].TemplateProperties.ContainerAnimationStartPosition}" /> |
||||
|
</Setter.Value> |
||||
|
</Setter> |
||||
|
</Style> |
||||
|
<Style Selector="ProgressBar:horizontal /template/ Border#IndeterminateProgressBarIndicator2"> |
||||
|
<Setter Property="Width" Value="{Binding $parent[ProgressBar].TemplateProperties.Container2Width}" /> |
||||
|
<Setter Property="RenderTransform"> |
||||
|
<Setter.Value> |
||||
|
<TranslateTransform X="{Binding $parent[ProgressBar].TemplateProperties.Container2AnimationStartPosition}" /> |
||||
|
</Setter.Value> |
||||
|
</Setter> |
||||
|
</Style> |
||||
|
<Style Selector="ProgressBar:vertical /template/ Border#IndeterminateProgressBarIndicator"> |
||||
|
<Setter Property="Height" Value="{Binding $parent[ProgressBar].TemplateProperties.ContainerWidth}" /> |
||||
|
<Setter Property="RenderTransform"> |
||||
|
<Setter.Value> |
||||
|
<TranslateTransform Y="{Binding $parent[ProgressBar].TemplateProperties.ContainerAnimationStartPosition}" /> |
||||
|
</Setter.Value> |
||||
|
</Setter> |
||||
|
</Style> |
||||
|
<Style Selector="ProgressBar:vertical /template/ Border#IndeterminateProgressBarIndicator2"> |
||||
|
<Setter Property="Height" Value="{Binding $parent[ProgressBar].TemplateProperties.Container2Width}" /> |
||||
|
<Setter Property="RenderTransform"> |
||||
|
<Setter.Value> |
||||
|
<TranslateTransform Y="{Binding $parent[ProgressBar].TemplateProperties.Container2AnimationStartPosition}" /> |
||||
|
</Setter.Value> |
||||
|
</Setter> |
||||
|
</Style> |
||||
</Styles> |
</Styles> |
||||
|
|||||
Loading…
Reference in new issue