WPF
Раскадровка продвинет ползунок. Мне нужно получить текущее числовое значение ползунка при движении раскадровки. Это кажется трудным.
Это код, который я бы хотел иметь, НО ЗНАЧЕНИЕ НЕ ДОСТУПНО.
Мой вопрос, как я могу получить фактическое значение слайдера, пока он анимируется ???
ТИА
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard>
<Storyboard Duration="0:0:10">
<DoubleAnimation Storyboard.TargetProperty="(RangeBase.Value)"
Storyboard.TargetName="PART_RecordingProgressBar"
From="{Binding ElementName=PART_RecordingProgressBar, Path=Value, Mode=OneWay}"
To="{Binding ElementName=PART_RecordingProgressBar, Path=Maximum, Mode=OneWay}"
FillBehavior="HoldEnd"
***THIS FAILS! **** Value ="{Binding Path= CurrentValue, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWayToSource}"
>
</DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
Вот XAML (с большим удалением):
<Style TargetType="{x:Type local:AudioRecorder}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:AudioRecorder}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Grid>
<StackPanel Orientation="Horizontal">
<Button x:Name="FastForward" Height="20">
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Border>
<Viewbox Stretch="Fill">
<Path Stroke="Black" Data=" F1
M 0 0 V40 L 34.6 20 Z
M 17.3 0 V40 L 51.9 20 Z" Fill="LightBlue" />
</Viewbox>
</Border>
</ControlTemplate>
</Button.Template>
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard>
<Storyboard Duration="0:0:10">
<DoubleAnimation Storyboard.TargetProperty="(RangeBase.Value)"
Storyboard.TargetName="PART_RecordingProgressBar"
From="{Binding ElementName=PART_RecordingProgressBar, Path=Value, Mode=OneWay}"
To="{Binding ElementName=PART_RecordingProgressBar, Path=Maximum, Mode=OneWay}"
FillBehavior="HoldEnd"
Value ="{Binding Path= CurrentValue, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWayToSource}"
>
</DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
<Popup Name="Popup"
Placement="Bottom" PlacementTarget="{Binding ElementName=OpenRecorder}"
AllowsTransparency="True" Focusable="False" StaysOpen="True" IsOpen="False" PopupAnimation="None">
<Grid Name="DropDown" SnapsToDevicePixels="True" MinWidth="{TemplateBinding ActualWidth}">
<Slider x:Name="PART_RecordingProgressBar"
IsMoveToPointEnabled="True"
Maximum="{Binding Path=CurrentTrackLength, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
Value="{Binding Path=CurrentTrackPosition, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
HorizontalAlignment="Left" Height="22" Margin="15,423,0,0" VerticalAlignment="Top" Width="375" />
</Grid>
</Border>
<Button Name="closeButton" Content="Exit" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="73"/>
</Grid>
</Popup>
</Grid>
</Border>
<ControlTemplate.Triggers>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>