优化更新代码,添加界面功能并整合
This commit is contained in:
113
WPFluent/Controls/ProgressBar/ProgressBar.xaml
Normal file
113
WPFluent/Controls/ProgressBar/ProgressBar.xaml
Normal file
@@ -0,0 +1,113 @@
|
||||
<!--
|
||||
This Source Code Form is subject to the terms of the MIT License.
|
||||
If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
|
||||
Copyright (C) Leszek Pomianowski and WPF UI Contributors.
|
||||
All Rights Reserved.
|
||||
-->
|
||||
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<Style TargetType="{x:Type ProgressBar}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ProgressBarForeground}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ProgressBarBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ProgressBarBorderBrush}" />
|
||||
<Setter Property="Height" Value="4" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||
<Setter Property="OverridesDefaultStyle" Value="True" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ProgressBar}">
|
||||
<Grid Name="TemplateRoot" SnapsToDevicePixels="True">
|
||||
<Grid.Style>
|
||||
<Style TargetType="Grid">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Orientation}" Value="Horizontal">
|
||||
<Setter Property="LayoutTransform">
|
||||
<Setter.Value>
|
||||
<RotateTransform Angle="0" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Orientation}" Value="Vertical">
|
||||
<Setter Property="LayoutTransform">
|
||||
<Setter.Value>
|
||||
<RotateTransform Angle="-90" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Grid.Style>
|
||||
<Border
|
||||
Margin="1,1,1,1"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="1.5" />
|
||||
<Rectangle Name="PART_Track" Margin="1,1,1,1" />
|
||||
<Border
|
||||
Name="PART_Indicator"
|
||||
Margin="1,1,1,1"
|
||||
HorizontalAlignment="Left"
|
||||
Background="{TemplateBinding Foreground}"
|
||||
CornerRadius="2" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsIndeterminate" Value="True">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ProgressBar}">
|
||||
<Grid Name="TemplateRoot">
|
||||
<Grid.Style>
|
||||
<Style TargetType="Grid">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Orientation}" Value="Horizontal">
|
||||
<Setter Property="LayoutTransform">
|
||||
<Setter.Value>
|
||||
<RotateTransform Angle="0" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Orientation}" Value="Vertical">
|
||||
<Setter Property="LayoutTransform">
|
||||
<Setter.Value>
|
||||
<RotateTransform Angle="-90" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Grid.Style>
|
||||
<Border
|
||||
Margin="1,1,1,1"
|
||||
Background="{DynamicResource ProgressBarIndeterminateBackground}"
|
||||
BorderBrush="{DynamicResource ProgressBarIndeterminateBackground}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="4" />
|
||||
<Rectangle Name="PART_Track" Margin="1,1,1,1" />
|
||||
<Decorator
|
||||
Name="PART_Indicator"
|
||||
Margin="1,1,1,1"
|
||||
HorizontalAlignment="Left">
|
||||
<Grid Name="Animation" ClipToBounds="True">
|
||||
<Border
|
||||
Name="PART_GlowRect"
|
||||
Width="200"
|
||||
Margin="0,0,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
Background="{TemplateBinding Foreground}"
|
||||
CornerRadius="2" />
|
||||
</Grid>
|
||||
</Decorator>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
Reference in New Issue
Block a user