我有以下ProgressBar
风格:
<Style x:Key="{x:Type ProgressBar}" TargetType="{x:Type ProgressBar}">
<Setter Property="Background" Value="{StaticResource ControlBackground}" />
<Setter Property="BorderBrush" Value="{StaticResource ActiveControlBorderBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="MinHeight" Value="23" />
<Setter Property="MinWidth" Value="75" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ProgressBar}">
<Grid MinHeight="{TemplateBinding MinHeight}"
MinWidth="{TemplateBinding MinWidth}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Determinate" />
<VisualState x:Name="Indeterminate">
<Storyboard>
<ObjectAnimationUsingKeyFrames Duration="00:00:00"
Storyboard.TargetName="PART_Indicator"
Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="00:00:00">
<DiscreteObjectKeyFrame.Value>
<SolidColorBrush>Transparent</SolidColorBrush>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border x:Name="PART_Track"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" />
<Border x:Name="PART_Indicator"
Background="{TemplateBinding BorderBrush}"
HorizontalAlignment="Left" />
<Grid x:Name="Animation" ClipToBounds="True">
<Border x:Name="PART_GlowRect"
Width="100"
Background="{StaticResource ActiveControlBorderBrush}"
HorizontalAlignment="Left"
Margin="-100,0,0,0" />
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
如果我设置IsIndeterminate
为True
on ProgressBar
; 我可以看到Indicator
搬进来,designer
但看不到runtime
。任何人都知道为什么它不起作用runtime
?
编辑:
使用 Visual Studio Professional 2012 / 应用程序是 WPF .NET 3.5