Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF - xaml Scrollbar in a tab

I wish to implement a scroll bar in a tab here is the following tab code i have:

 <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 it is a scalable tab using a slider, but all i want is the scroll bar to display as another option instead of scaling the page all the time just for usability.

here is the code i have with the scroll bar implemented but it doesn't display.

<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 pretty sure by adding the code: ScrollViewer.VerticalScrollBarVisibility="Auto" it should work?

Any help would be greatly appreciated.

like image 269
Silentdarkness Avatar asked Feb 18 '23 02:02

Silentdarkness


1 Answers

You will have to wrap the TabControl in a ScrollViewer as 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

like image 193
sa_ddam213 Avatar answered Feb 27 '23 14:02

sa_ddam213