我如何将图像放在进度条上?

时间:2013-03-18 07:10:52

标签: wpf progress-bar wpf-4.0

我把进度条但看起来不合适

<ProgressBar Height="30" Width="300"  VerticalAlignment="Center" BorderThickness="0" HorizontalAlignment="Center" Foreground="#0A8098" BorderBrush="Transparent"  Name="pbProcessing" >
                    <ProgressBar.Background>
                        <ImageBrush ImageSource="/ClientApplication;component/Images/ProgressBackground.png"/>
                    </ProgressBar.Background>
                    <ProgressBar.Clip>
                        <RectangleGeometry RadiusX="20.5" RadiusY="20.5" Rect="0,0,300,19"/>
                    </ProgressBar.Clip>
                </ProgressBar>

但我表示 progress bar

知道如何将图像正确放在进度条上吗?谢谢。

1 个答案:

答案 0 :(得分:0)

试试这个

<ProgressBar Value="30" Height="30" Width="300"  VerticalAlignment="Center"    BorderThickness="0" HorizontalAlignment="Center" Foreground="#0A8098" BorderBrush="Transparent"  Name="pbProcessing" >
        <ProgressBar.Template>
            <ControlTemplate>
            <Grid>
                <Image Name="PART_Track" Source="bird1.jpg"  Stretch="Fill"/>
                    <Rectangle Name="PART_Indicator"   
                        Fill="BlanchedAlmond"    
                        HorizontalAlignment="Left"/>
                </Grid>
            </ControlTemplate>
        </ProgressBar.Template>
    </ProgressBar>