赞
踩
xaml样式
<Style x:Key="ProgressBarStyle" TargetType="{x:Type ProgressBar}"> <Setter Property="Foreground" Value="#F2F2F2"/> <Setter Property="Background" Value="White"/> <Setter Property="BorderBrush" Value="Transparent"/> <Setter Property="BorderThickness" Value="0"/> <Setter Property="Width" Value="60"/> <Setter Property="Height" Value="30"/> <Setter Property="Value" Value="{Binding ProgressValue}"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ProgressBar}"> <Grid x:Name="Root" > <Border Height="30" Width="60" Background="Transparent" BorderBrush="#1C7FFF" BorderThickness="1" CornerRadius="17" FocusVisualStyle="{x:Null}" HorizontalAlignment="Center" VerticalAlignment="Center"> <Rectangle HorizontalAlignment="Left" Width="{Binding ProgressValue}" Fill="#C7DBF5" > <Rectangle.Clip> <RectangleGeometry Rect="0,0,58,28" RadiusY="18" RadiusX="18"/> </Rectangle.Clip> </Rectangle> </Border> <TextBlock Foreground="#4796FC" HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Binding PCT}" /> </Grid> <ControlTemplate.Triggers> <Trigger Property="Orientation" Value="Vertical"> <Setter Property="LayoutTransform" TargetName="Root" > <Setter.Value> <RotateTransform Angle="-90" /> </Setter.Value> </Setter> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style>
调用
<ProgressBar Style="{StaticResource ProgressBarStyle}" x:Name="prob" Value="{Binding ProgressValue}" Visibility="{Binding VisDownloadProgress}" Background="White" Foreground="#F2F2F2" VerticalAlignment="Center" Margin="0,0,20,0"/>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。