Wpf 滑块样式中的文本
这是我的Wpf 滑块样式中的文本,wpf,slider,styles,Wpf,Slider,Styles,这是我的幻灯片样式样式: <Style x:Key="SliderThumbStyle" TargetType="{x:Type Thumb}"> <Setter Property="OverridesDefaultStyle" Value="True"/> <Setter Property="Template"> <Setter.Value> <Cont
幻灯片样式
样式
:
<Style x:Key="SliderThumbStyle" TargetType="{x:Type Thumb}">
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Thumb}">
<Grid>
<Border Name="outerBorder"
Background="{DynamicResource LabelDisableForegroundColor}"
BorderBrush="{DynamicResource LabelDisableForegroundColor}"
Height="20"
Width="20"
Opacity="1"
BorderThickness="2"
CornerRadius="8"/>
<TextBlock x:Name="sliderValue"
FontSize="11"
Foreground="Silver"
Text="{Binding }"
VerticalAlignment="Center"
HorizontalAlignment="Center"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
如果
拇指
是滑块
的可视子对象,则此操作应该有效:
<TextBlock Text="{Binding Value, RelativeSource={RelativeSource AncestorType=Slider}}" />
如果
拇指
是滑块的可视子对象,则此操作应该有效:
<TextBlock Text="{Binding Value, RelativeSource={RelativeSource AncestorType=Slider}}" />