如何使我的滚动条样式使用我的文本框样式的滚动查看器?设置文本框的滚动条样式
<Style x:Key="MyTextBoxStyle" BasedOn="{x:Null}" TargetType="{x:Type TextBox}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBoxBase}">
<Grid>
<Rectangle x:Name="_rct" Stroke="#FFA8AFBE" RadiusX="8" RadiusY="8" Fill="White" />
<Border Name="Border" BorderThickness="2" CornerRadius="8" BorderBrush="#FFA8AFBE" Background="White">
<ScrollViewer Margin="6" x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
我的滚动条风格:
<Style x:Key="MyScrollBarStyle" TargetType="{x:Type ScrollBar}">
<Setter Property="Background" Value="#ff007eb1"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Style.Triggers>
<Trigger Property="Orientation" Value="Vertical">
<Setter Property="Width" Value="5"/>
<Setter Property="Height" Value="Auto" />
<Setter Property="Template" Value="{StaticResource VerticalScrollBar}" />
</Trigger>
<Trigger Property="Orientation" Value="Horizontal">
<Setter Property="Width" Value="Auto"/>
<Setter Property="Height" Value="5" />
<Setter Property="Template" Value="{StaticResource HorizontalScrollBar}" />
</Trigger>
</Style.Triggers>
</Style>
你是什么意思的“滚动条样式?”是否显示滚动条?或者是其他东西? – cdhowie 2010-11-10 02:44:01
我已更新我的问题 – Robert 2010-11-10 02:57:32
啊,我明白了。不幸的是,我也不知道。 :) – cdhowie 2010-11-10 03:00:26