使用:
<ProgressBar x:Name="templateProgress" Template="{StaticResource templateThermometer}" Value="60" Minimum="0" Maximum="100" Orientation="Vertical" Width="30" Height="280" Grid.Column="1"/>
设置Value值没反应!
模板:
<ControlTemplate x:Key="templateThermometer" TargetType="{x:Type ProgressBar}">
<!-- Define two brushes for the thermometer liquid -->
<ControlTemplate.Resources>
<LinearGradientBrush x:Key="brushStem" StartPoint="0 0" EndPoint="1 0">
<GradientStop Offset="0" Color="Red" />
<GradientStop Offset="0.3" Color="Pink" />
<GradientStop Offset="1" Color="Red" />
</LinearGradientBrush>
<RadialGradientBrush x:Key="brushBowl" GradientOrigin="0.3 0.3">
<GradientStop Offset="0" Color="Pink" />
<GradientStop Offset="1" Color="Red" />
</RadialGradientBrush>
</ControlTemplate.Resources>
<!-- Two-row Grid divides thermometer into stem and bowl -->
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- Second grid divides stem area in three columns -->
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="25*" />
<ColumnDefinition Width="50*" />
<ColumnDefinition Width="25*" />
</Grid.ColumnDefinitions>
<!-- 温度计管管 -->
<Border Grid.Column="1" BorderBrush="SpringGreen" BorderThickness="3 3 3 0" CornerRadius="6 6 0 0" >
<!-- Track -->
<Decorator Name="PART_Track">
<!-- 指示进度 -->
<Border Name="PART_Indicator" CornerRadius="6 6 0 0" VerticalAlignment="Bottom" Background="{StaticResource brushStem}" >
</Border>
</Decorator>
</Border>
</Grid>
<!-- 温度计水银槽外边框为一个圆 -->
<Ellipse Grid.Row="1" Width="{TemplateBinding Width}" Height="{TemplateBinding Width}" Stroke="Black" StrokeThickness="3" />
<Grid Grid.Row="1" >
<Grid.RowDefinitions>
<RowDefinition Height="50*" />
<RowDefinition Height="50*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="25*" />
<ColumnDefinition Width="50*" />
<ColumnDefinition Width="25*" />
</Grid.ColumnDefinitions>
<!-- 温度计管管和水银槽之间的连接处 -->
<!--
<Border Grid.Row="0" Grid.Column="1" BorderBrush="RoyalBlue" BorderThickness="3 0 3 0" Background="{StaticResource brushStem}" Opacity="0.5"/>
-->
<Border Grid.Row="0" Grid.Column="1" BorderBrush="Blue" BorderThickness="3 0 3 0" Opacity="0.5"/>
</Grid>
<!-- 水银槽背景 -->
<Ellipse Grid.Row="1" Width="{TemplateBinding Width}" Height="{TemplateBinding Width}" Stroke="Transparent" StrokeThickness="6" Fill="{StaticResource brushBowl}" Opacity="0.7"/>
</Grid>
</ControlTemplate>
------解决思路----------------------
和交互不交互没关系,这控件默认的外观效果是由视觉状态控制的,楼主给删掉了,也看不错楼主这是什么平台(sl还是windowsphone RT)的进度指示器了,被改的面目全非。
------解决思路----------------------
想改的话,先去看看ProgressBar的默认模板吧。
用Blend生成一个就行了。