views:

19

answers:

1

Hi,

I am struggling with a weird scrollviewer issue in tab control.

One of my xaml page having a tabcontol and again tab item will contain a xaml with another tab control. Inside the second tab control i have a scrollviewer which in turn holds a treeview.

once user searches for specific data treeview will populated with search result. I fixed the height of the treeview at 500. Now i'm getting scrollbar which is not functioning on mouse click or scrollbar up /down arrow clicks. But it's working fine with mouse scrollwheel.

I tested the same scenario in test application which is working fine in both ways but the same impementation is not working in application.

Following is my scrollviewer xaml code.

<ScrollViewer Grid.Row="1" VerticalAlignment="Top" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Width="Auto" Height="Auto">           
        <TreeView Name="tv" Margin="0,5,0,0" VerticalAlignment="Top" HorizontalAlignment="Stretch" PreviewMouseLeftButtonDown="tv_PreviewMouseLeftButtonDown"  BorderThickness="0"  Width="630" Height="525" Background="White" >                
       <TreeView.ContextMenu>
                <ContextMenu Name="treeClick">
                    <MenuItem Name="treeMenu" Header="Select Employee" Click="menu_Click" />
                </ContextMenu>
            </TreeView.ContextMenu>
        </TreeView>
   </ScrollViewer>

Please guide me with some solution.

Thanks In Advance

Regards KSR

A: 

Try removing the VerticalAlignment and HorizontalAlignment attributes from the TreeView - Normally you shouldn't alter the default placements when you place a control inside a scrollviewer. I also don't understand why the ScrollViewer is set to VerticalAlignment="Top" - shouldn't it stretch across the grid-cell it is placed in?

Goblin