|
9 | 9 | </ResourceDictionary.MergedDictionaries> |
10 | 10 |
|
11 | 11 | <Style x:Key="LinearProgressBarBaseStyle" TargetType="{x:Type ProgressBar}"> |
12 | | - <Setter Property="IsIndeterminate" Value="False" /> |
13 | 12 | <Setter Property="Foreground" Value="{DynamicResource AssistantThemeBrush}" /> |
14 | 13 | <Setter Property="Background" Value="{DynamicResource PrimaryThemeBrush}" /> |
15 | 14 | <Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}" /> |
16 | 15 | <Setter Property="BorderThickness" Value="0" /> |
17 | 16 | <Setter Property="Padding" Value="5,0" /> |
18 | 17 | <Setter Property="SnapsToDevicePixels" Value="True" /> |
| 18 | + <Setter Property="IsIndeterminate" Value="False" /> |
19 | 19 | <Setter Property="Template"> |
20 | 20 | <Setter.Value> |
21 | 21 | <ControlTemplate TargetType="{x:Type ProgressBar}"> |
|
44 | 44 | BorderBrush="{TemplateBinding BorderBrush}" |
45 | 45 | BorderThickness="{TemplateBinding BorderThickness}" |
46 | 46 | Background="{TemplateBinding Background}" |
47 | | - CornerRadius="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ProgressBar}, Path=(common:FrameworkElementBaseAttached.CornerRadius)}"> |
| 47 | + CornerRadius="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(common:FrameworkElementBaseAttached.CornerRadius)}"> |
48 | 48 | <Grid x:Name="IconGrid" Visibility="{TemplateBinding pc:LinearProgressBarAssistant.IsShowIcon, Converter={pt:BooleanToVisibilityConverter}}"> |
49 | 49 | <Path Width="{TemplateBinding pc:LinearProgressBarAssistant.IconSize}" |
50 | 50 | Height="{TemplateBinding pc:LinearProgressBarAssistant.IconSize}" |
|
90 | 90 | <TranslateTransform /> |
91 | 91 | </TransformGroup> |
92 | 92 | </Grid.RenderTransform> |
93 | | - <Border Background="{TemplateBinding Foreground}" CornerRadius="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ProgressBar}, Path=(common:FrameworkElementBaseAttached.CornerRadius)}"> |
| 93 | + <Border Background="{TemplateBinding Foreground}" CornerRadius="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(common:FrameworkElementBaseAttached.CornerRadius)}"> |
94 | 94 | <Viewbox Margin="{TemplateBinding Padding}" |
95 | 95 | SnapsToDevicePixels="True" |
96 | 96 | HorizontalAlignment="Left" |
97 | 97 | StretchDirection="DownOnly"> |
98 | 98 | <StackPanel Orientation="Horizontal"> |
99 | 99 | <TextBlock Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Value, StringFormat={}{0:F0}%}" |
100 | | - Foreground="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ProgressBar}, Path=(pc:LinearProgressBarAssistant.TextColor)}" |
| 100 | + Foreground="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(pc:LinearProgressBarAssistant.TextColor)}" |
101 | 101 | FontSize="{TemplateBinding FontSize}" |
102 | 102 | SnapsToDevicePixels="True" |
103 | 103 | VerticalAlignment="{TemplateBinding VerticalAlignment}" |
104 | 104 | RenderTransformOrigin="0.5,0.5" |
105 | | - Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ProgressBar}, Path=(pc:LinearProgressBarAssistant.IsShowPercent), Converter={pt:BooleanToVisibilityConverter}}"> |
| 105 | + Visibility="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(pc:LinearProgressBarAssistant.IsShowPercent), Converter={pt:BooleanToVisibilityConverter}}"> |
106 | 106 | <TextBlock.RenderTransform> |
107 | 107 | <TransformGroup> |
108 | 108 | <ScaleTransform ScaleX="-1" ScaleY="1" /> |
|
173 | 173 | </Setter> |
174 | 174 | </Style> |
175 | 175 |
|
| 176 | + <Style x:Key="ProgressBarStripeBaseStyle" TargetType="{x:Type ProgressBar}"> |
| 177 | + <Setter Property="Foreground" Value="{DynamicResource AssistantThemeBrush}" /> |
| 178 | + <Setter Property="Background" Value="{DynamicResource PrimaryThemeBrush}" /> |
| 179 | + <Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}" /> |
| 180 | + <Setter Property="BorderThickness" Value="1" /> |
| 181 | + <Setter Property="IsIndeterminate" Value="True" /> |
| 182 | + <Setter Property="Template"> |
| 183 | + <Setter.Value> |
| 184 | + <ControlTemplate TargetType="{x:Type ProgressBar}"> |
| 185 | + <Grid x:Name="TemplateRoot" SnapsToDevicePixels="True" Effect="{TemplateBinding common:FrameworkElementBaseAttached.ShadowEffect}"> |
| 186 | + <Border BorderBrush="{TemplateBinding BorderBrush}" |
| 187 | + BorderThickness="{TemplateBinding BorderThickness}" |
| 188 | + Background="{TemplateBinding Background}" |
| 189 | + CornerRadius="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(common:FrameworkElementBaseAttached.CornerRadius)}" /> |
| 190 | + <Border x:Name="PART_Track" /> |
| 191 | + <AdornerDecorator x:Name="PART_Indicator" HorizontalAlignment="Left"> |
| 192 | + <Border x:Name="Animation" |
| 193 | + CornerRadius="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(common:FrameworkElementBaseAttached.CornerRadius)}" |
| 194 | + RenderTransformOrigin="0.5,0.5" |
| 195 | + Visibility="Hidden"> |
| 196 | + <Border.Background> |
| 197 | + <DrawingBrush TileMode="Tile" Viewport="0,0,20,20" ViewportUnits="Absolute"> |
| 198 | + <DrawingBrush.Transform> |
| 199 | + <TranslateTransform x:Name="animTranslate" /> |
| 200 | + </DrawingBrush.Transform> |
| 201 | + <DrawingBrush.Drawing> |
| 202 | + <GeometryDrawing> |
| 203 | + <GeometryDrawing.Brush> |
| 204 | + <LinearGradientBrush StartPoint="0,0" EndPoint="1,1" SpreadMethod="Repeat"> |
| 205 | + <LinearGradientBrush.RelativeTransform> |
| 206 | + <ScaleTransform ScaleX="0.5" ScaleY="0.5" /> |
| 207 | + </LinearGradientBrush.RelativeTransform> |
| 208 | + <GradientStop Offset="0" Color="Transparent" /> |
| 209 | + <GradientStop Offset="0.5" Color="Transparent" /> |
| 210 | + <GradientStop Offset="0.5" Color="{Binding Foreground, Converter={x:Static pt:BrushToColorConverter.Instance}, RelativeSource={RelativeSource Mode=TemplatedParent}}" /> |
| 211 | + <GradientStop Offset="1" Color="{Binding Foreground, Converter={x:Static pt:BrushToColorConverter.Instance}, RelativeSource={RelativeSource Mode=TemplatedParent}}" /> |
| 212 | + </LinearGradientBrush> |
| 213 | + </GeometryDrawing.Brush> |
| 214 | + <GeometryDrawing.Geometry> |
| 215 | + <RectangleGeometry Rect="0,0,20,20" /> |
| 216 | + </GeometryDrawing.Geometry> |
| 217 | + </GeometryDrawing> |
| 218 | + </DrawingBrush.Drawing> |
| 219 | + </DrawingBrush> |
| 220 | + </Border.Background> |
| 221 | + </Border> |
| 222 | + </AdornerDecorator> |
| 223 | + <VisualStateManager.VisualStateGroups> |
| 224 | + <VisualStateGroup x:Name="CommonStates"> |
| 225 | + <VisualState x:Name="Determinate" /> |
| 226 | + <VisualState x:Name="Indeterminate"> |
| 227 | + <Storyboard> |
| 228 | + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Animation" Storyboard.TargetProperty="Visibility" Duration="0"> |
| 229 | + <DiscreteObjectKeyFrame KeyTime="0"> |
| 230 | + <DiscreteObjectKeyFrame.Value> |
| 231 | + <Visibility>Visible</Visibility> |
| 232 | + </DiscreteObjectKeyFrame.Value> |
| 233 | + </DiscreteObjectKeyFrame> |
| 234 | + </ObjectAnimationUsingKeyFrames> |
| 235 | + <DoubleAnimation Storyboard.TargetName="animTranslate" Storyboard.TargetProperty="X" |
| 236 | + From="0" To="100" Duration="0:0:1" |
| 237 | + RepeatBehavior="Forever" /> |
| 238 | + </Storyboard> |
| 239 | + </VisualState> |
| 240 | + </VisualStateGroup> |
| 241 | + </VisualStateManager.VisualStateGroups> |
| 242 | + </Grid> |
| 243 | + <ControlTemplate.Triggers> |
| 244 | + <MultiTrigger> |
| 245 | + <MultiTrigger.Conditions> |
| 246 | + <Condition Property="IsIndeterminate" Value="True" /> |
| 247 | + <Condition Property="Orientation" Value="Vertical" /> |
| 248 | + </MultiTrigger.Conditions> |
| 249 | + <MultiTrigger.Setters> |
| 250 | + <Setter Property="LayoutTransform" TargetName="TemplateRoot"> |
| 251 | + <Setter.Value> |
| 252 | + <RotateTransform Angle="-90" /> |
| 253 | + </Setter.Value> |
| 254 | + </Setter> |
| 255 | + </MultiTrigger.Setters> |
| 256 | + </MultiTrigger> |
| 257 | + </ControlTemplate.Triggers> |
| 258 | + </ControlTemplate> |
| 259 | + </Setter.Value> |
| 260 | + </Setter> |
| 261 | + </Style> |
| 262 | + |
176 | 263 | <Style x:Key="CircularProgressBarBaseStyle" TargetType="{x:Type ProgressBar}"> |
177 | 264 | <Setter Property="Foreground" Value="{DynamicResource AssistantThemeBrush}" /> |
178 | 265 | <Setter Property="Background" Value="Transparent" /> |
|
0 commit comments