代码之家  ›  专栏  ›  技术社区  ›  CannibalSmith

如何正确设计一个奇特的垂直进度条?

  •  7
  • CannibalSmith  · 技术社区  · 16 年前

    我正在尝试制作一个时尚的进度条,但它的垂直版本有问题。一幅画胜过千言万语:

    http://img402.imageshack.us/img402/2033/progressq.gif

    到目前为止,我所做的一切都是错误的。我怎样才能做到正确?我更喜欢只使用XAML的解决方案,除非它速度慢或者在进度条每秒更新很多次时导致闪烁。

    1 回复  |  直到 14 年前
        1
  •  5
  •   Aviad P.    16 年前

    这里有一个选择:

    <Border BorderBrush="Black" BorderThickness="2" CornerRadius="3" Padding="3">
        <Grid Width="20" Height="100">
            <Grid Height="{Binding ProgressValue}" VerticalAlignment="Bottom">
                <Grid Height="100" VerticalAlignment="Bottom">
                    <Grid.Background>
                        <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                            <GradientStop Color="Yellow" Offset="0.0" />
                            <GradientStop Color="Red" Offset="0.25" />
                            <GradientStop Color="Blue" Offset="0.75" />
                            <GradientStop Color="LimeGreen" Offset="1.0" />
                        </LinearGradientBrush>
                    </Grid.Background>
                </Grid>
            </Grid>
        </Grid>
    </Border>
    

    请注意顶部的第三行,即绑定进度值的位置。