更改scrollviewer内的滚动条

时间:2017-02-28 09:05:05

标签: c# wpf xaml scrollbar scrollviewer

在scrollviewer中有一个网格,它有一个垂直滚动条。但是滚动条不清晰,滚动条底部有2条小水平线。

<ScrollViewer VerticalScrollBarVisibility="Auto" >
    <Grid VerticalAlignment="Stretch">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Button Name="DetailsBackButton" Style="{StaticResource BackButtonStyle}" Click="AttachementDetailsBackButton_Click" Grid.Row="0" Visibility="Collapsed" />
        <Grid Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <ListBox x:Name="DetailsListbox" BorderBrush="#d2d4d5" BorderThickness="1" FontFamily="Arial" FontSize="12px" ItemsSource="{Binding}"  Grid.Row="0" Visibility="Collapsed" Width="{Binding RelativeSource={RelativeSource TemplatedParent},Path=ActualHeight}" Style="{DynamicResource ListBoxDefaultStyle}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Grid >
                            <Grid.RowDefinitions>
                                <RowDefinition />
                                <RowDefinition />
                            </Grid.RowDefinitions>
                            <TextBlock Text="{Binding Title}" Grid.Row="0"  Style="{DynamicResource AttachmentTitleText}" MouseLeftButtonDown="AttachmentTitle_MouseLeftButtonDown" >
                            </TextBlock>
                            <Border Style="{DynamicResource AreaButtonBorder}" Grid.Row="1"/>
                        </Grid>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ListBox>
            <WebBrowser Name="WebBrowser" Style="{DynamicResource WebBrowserStyle}" Visibility="Visible" Grid.Row="1" Navigating="FullTextWebBrowser_Navigating" LoadCompleted="WebBrowser_LoadCompleted"  />

        </Grid>
    </Grid>
</ScrollViewer>

而且,如果我稍微滚动它,这两条水平线将会熄灭。怎么解决这个问题?或者是否有任何方法可以在scrollviewer中默认向下移动滚动条? 感谢。enter image description here

0 个答案:

没有答案