1
votes

I have a wpf treeview and a scrollview on a form. but the horizontal and vertical scrollbar only works smoothly when my mouse cursor is outside of the treeview area. when my mouse is within the treeview area, i must click on each scrollbar manaually to scroll. Is there a way i can enable smooth scrolling on a wpf treeview?

Here is the code for the treeview and scrollview

<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">

    <StackPanel x:Name="CanScrolGrid" Margin="10 10" Background="Green">

        <TreeView VirtualizingPanel.IsVirtualizing="True" 

                  Background="Orange"
                  BorderThickness="0"
                     ItemsSource="{StaticResource MyData}"
                  Margin="7"
                     />
    </StackPanel>

    </ScrollViewer>
1
I don't know a solution for your scrolling Problem, but you should not put a TreeView into a ScrollView because like this it will expand endless and never start virtualizing... maybe your scrolling Problem is related to this.Markus
thanks for your reply. I have remove the scrollviewer but it doesnt seem to solve the problemJohn

1 Answers

-1
votes

Have you tried setting

VirtualizingPanel.ScrollUnit="Pixel"