垂直进度条Wpf

win*_*sgm 1 wpf xaml progress-bar

我正在尝试在WPF中实现一个垂直进度条,并且遇到了一些困难.我正在关注格雷格D的垂直进度条模板.net的答案,但这对我不起作用.我试过使用外部风格和内联,没有运气.这很烦人,因为它似乎是一个相对简单的答案.

这是我的XAML;

<ProgressBar Name="VolumeMeter" Orientation="Vertical" Margin="4,30,0,0" 
Value="50" HorizontalAlignment="Left" VerticalAlignment="Top" Height="300" Width="10">
    <ProgressBar.Template>
    <ControlTemplate>

            <Border BorderBrush="Green" x:Name="Root" BorderThickness="1">
                <Grid Name="PART_Track" Background="Red">
                    <Rectangle Name="PART_Indicator" Fill="Blue"/>
                </Grid>
            </Border>

            <ControlTemplate.Triggers>
            <Trigger Property="Orientation" Value="Vertical">//Error Here

                <!-- Rotate the progressbar so the left edge is the bottom edge -->
                <Setter TargetName="Root" Property="LayoutTransform">
                    <Setter.Value>
                        <RotateTransform Angle="270" />
                    </Setter.Value>
                </Setter>

                <Setter TargetName="Root" Property="Width"
                Value="{Binding RelativeSource={RelativeSource TemplatedParent}, 
Path=Height}"/>
                <Setter TargetName="Root" Property="Height"
                Value="{Binding RelativeSource={RelativeSource TemplatedParent}, 
Path=Width}"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    </ProgressBar.Template>
</ProgressBar>
Run Code Online (Sandbox Code Playgroud)

我得到的错误就<Trigger Property="Orientation" Value="Vertical">在线上,我正在接受;

在"System.Windows.Controls.Control"类型上找不到模板属性"Orientation".

H.B*_*.B. 6

设置TargetTypeControlTemplate.