WPF - xaml scrollbar on tab

I want to implement a scrollbar on a tab, here is the following tab code:

<TabControl x:Name="tabs" Grid.Column="2" Margin="5 0"> <TabControl.LayoutTransform> <ScaleTransform ScaleX="{Binding ElementName=zoomSlider, Path=Value}" ScaleY="{Binding ElementName=zoomSlider, Path=Value}" /> </TabControl.LayoutTransform> </TabControl> 

However, I know this is a scalable tab with a slider, but all I need is a scroll bar to display as another parameter, rather than scaling the page all the time just for ease of use.

here is the code that I have with the scrollbar but not showing.

 <TabControl x:Name="tabs" Grid.Column="2" Margin="5 0" ScrollViewer.VerticalScrollBarVisibility="Auto"> <TabControl.LayoutTransform> <ScaleTransform ScaleX="{Binding ElementName=zoomSlider, Path=Value}" ScaleY="{Binding ElementName=zoomSlider, Path=Value}" /> </TabControl.LayoutTransform> </TabControl> 

im sure adding code: ScrollViewer.VerticalScrollBarVisibility = "Auto" should it work?

Any help would be greatly appreciated.

+4
source share
1 answer

You will have to wrap the TabControl in a ScrollViewer , since TabControl does not have a ScrollViewer by default

 <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"> <TabControl x:Name="tabs" Grid.Column="2" Margin="5 0" > <TabControl.LayoutTransform> <ScaleTransform ScaleX="{Binding ElementName=zoomSlider, Path=Value}" ScaleY="{Binding ElementName=zoomSlider, Path=Value}" /> </TabControl.LayoutTransform> </TabControl> </ScrollViewer> 

Result:

enter image description here

+8
source

All Articles