【发布时间】:2012-09-11 15:33:34
【问题描述】:
我有一个带有 ScrollViewer 的应用程序。 2 个滚动条相遇的地方是一个烦人的小方块(见下面的 img),我正试图摆脱它。当我“窥探”应用程序时,我可以找到它作为“矩形”,但我认为它是 ScrollViewer 的一部分?
我已经搜索并搜索了有关此的任何信息,但我能找到的只是通过在其顶部放置一些东西来隐藏它的建议:s
谁能指出我正确的方向来解决这个问题?
<ControlTemplate x:Key="HorizontalScrollBar"
TargetType="{x:Type ScrollBar}">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition MaxWidth="18"/>
<ColumnDefinition Width="0.00001*"/>
<ColumnDefinition MaxWidth="18"/>
</Grid.ColumnDefinitions>
<Border
Grid.ColumnSpan="3"
CornerRadius="2"
Background="Transparent" />
<RepeatButton
Grid.Column="0"
Style="{StaticResource ScrollBarLineButton}"
Width="18"
Command="ScrollBar.LineLeftCommand"
Content="M 4 0 L 4 8 L 0 4 Z" />
<Track
Name="PART_Track"
Grid.Column="1"
IsDirectionReversed="False">
<Track.DecreaseRepeatButton>
<RepeatButton
Style="{StaticResource ScrollBarPageButton}"
Command="ScrollBar.PageLeftCommand" />
</Track.DecreaseRepeatButton>
<Track.Thumb>
<Thumb
Style="{StaticResource ScrollBarThumb}"
Margin="0,1,0,1"
Background="{DynamicResource NormalBrush}"
BorderBrush="{DynamicResource NormalBorderBrush}" />
</Track.Thumb>
<Track.IncreaseRepeatButton>
<RepeatButton
Style="{StaticResource ScrollBarPageButton}"
Command="ScrollBar.PageRightCommand" />
</Track.IncreaseRepeatButton>
</Track>
<RepeatButton
Grid.Column="3"
Style="{StaticResource ScrollBarLineButton}"
Width="18"
Command="ScrollBar.LineRightCommand"
Content="M 0 0 L 4 4 L 0 8 Z"/>
</Grid>
</ControlTemplate>
【问题讨论】:
-
如何让滚动条上色?
-
我绝不是 WPF 方面的专家,我不能说我完全了解所有内容,但据我所知,它来自此控件模板
-
可能不是什么破坏了它,但 Grid.Column="3" 超出了范围。
-
感谢您指出 Blam,但正如您所说,这对问题没有帮助。我不敢相信这么简单的事情会这么烦人!!!