当前位置:   article > 正文

WPF两侧圆角进度条ProgressBar_wpf progressbar 圆角

wpf progressbar 圆角

WPF两侧圆角进度条ProgressBar

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>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34

调用

<ProgressBar Style="{StaticResource ProgressBarStyle}" x:Name="prob" Value="{Binding ProgressValue}"  Visibility="{Binding VisDownloadProgress}" Background="White" Foreground="#F2F2F2" VerticalAlignment="Center" Margin="0,0,20,0"/>
  • 1
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/474189
推荐阅读
相关标签