ストーリーボードの自動返信プロパティを修正する方法はありますか?私は...コントロールのプロパティにバインドしたいのですが、方法を見つけることができませんストーリーボード自動逆転バインディング
私のコード今のところ:
public class MyProgressBar : ProgressBar
{
public bool IndeterminateAutoReverse
{
get { return (bool)GetValue(IndeterminateAutoReverseProperty); }
set { SetValue(IndeterminateAutoReverseProperty, value); }
}
// DependencyProperty as the backing store for IndeterminateAutoReverse
public static readonly DependencyProperty IndeterminateAutoReverseProperty = DependencyProperty.Register(
"IndeterminateAutoReverse",
typeof(bool),
typeof(MyProgressBar),
new PropertyMetadata(true)
);
}
とテーマでスタイル\ Generic.xaml:
<Style TargetType="{x:Type local:MyProgressBar}">
<Setter Property="Foreground" Value="#FF06B025" />
<Setter Property="Background" Value="#FFE6E6E6" />
<Setter Property="BorderBrush" Value="#FFBCBCBC" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:MyProgressBar}">
<Grid x:Name="TemplateRoot">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Indeterminate">
<Storyboard x:Name="TheStoryBoard" RepeatBehavior="Forever" AutoReverse="{Binding IndeterminateAutoReverse, RelativeSource={RelativeSource TemplatedParent}}">
<PointAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransformOrigin)"
Storyboard.TargetName="Animation">
<EasingPointKeyFrame KeyTime="0" Value="-0.5,0.5" />
<EasingPointKeyFrame KeyTime="0:0:1" Value="0.5,0.5" />
<EasingPointKeyFrame KeyTime="0:0:2" Value="1.5,0.5" />
</PointAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}" />
<Rectangle x:Name="PART_Track" />
<Grid x:Name="PART_Indicator"
ClipToBounds="true"
HorizontalAlignment="Left">
<Rectangle x:Name="Indicator"
Fill="{TemplateBinding Foreground}" />
<Rectangle x:Name="Animation"
Fill="{TemplateBinding Foreground}"
RenderTransformOrigin="0.5,0.5">
<Rectangle.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.25" />
</TransformGroup>
</Rectangle.RenderTransform>
</Rectangle>
</Grid>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsIndeterminate" Value="true">
<Setter Property="Visibility" TargetName="Indicator" Value="Collapsed" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
これにより
、オートリバースは常にfalseです...
のControlTemplateはそのようトリガwithing私もそれを変更しようとしました:
<ControlTemplate.Triggers>
<Trigger Property="IsIndeterminate" Value="true">
<Setter Property="Visibility" argetName="Indicator" Value="Collapsed" />
</Trigger>
<Trigger Property="IndeterminateAutoReverse" Value="true">
<Setter Property="AutoReverse" TargetName="TheStoryBoard" Value="True" />
</Trigger>
</ControlTemplate.Triggers>
しかし、それはコンパイルされません...
ご存じですか?
あなたのコンパイルエラー名を持つ – robertos
子供を共有してください "TheStoryBoard" VisualTreeには見られません。 – Sugz