I'm new to WPF and I find it a bit difficult to understand the Scroll Viewer.
My application is going to run in a 1080x1920 (Portrait mode).
I'm developing the code in a laptop where when I run the project the whole screen is not visible. So I wanted to add a Vertical scroll bar to this Grid, the scroll bar is visible but it doesn't scroll in my laptop.
<Grid>
<StackPanel Style="{StaticResource TabbedInsideStackPanelStyle}" Height="1450">
<StackPanel Orientation="Horizontal" Style="{StaticResource StackPanelStyle}">
<TextBlock Text="Enter the Speed" Style="{StaticResource LabelStyle}"/>
<TextBox x:Name="SpeedTextBox" FontSize="28" Width="100" Margin="10,0,0,0" LostFocus="SpeedTextBox_LostFocus"></TextBox>
</StackPanel>
<!--Multiple Stack panels-->
</Grid>
Here is the code I tried to bring up the Vertical scrollbar. But it doesn't work good.
<ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Hidden">
<Grid>
<StackPanel Style="{StaticResource TabbedInsideStackPanelStyle}" Height="1450">
<StackPanel Orientation="Horizontal" Style="{StaticResource StackPanelStyle}">
<TextBlock Text="Enter the Speed" Style="{StaticResource LabelStyle}"/>
<TextBox x:Name="SpeedTextBox" FontSize="28" Width="100" Margin="10,0,0,0" LostFocus="SpeedTextBox_LostFocus"></TextBox>
</StackPanel>
<!--Multiple Stack panels-->
</Grid>
</ScrollViewer>
EDIT: The complete skeleton of my code where the above grid exists.
<Window x:Class="TestWindow.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:TestWindow"
Title="Test Window" Height="1850" Width="1080"
WindowStartupLocation="CenterScreen">
<StackPanel>
<TabControl Margin="0,10,0,0">
<TabItem Header="Speed Control" Style="{StaticResource DefaultTabItem}">
<ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Hidden">
<Grid>
<StackPanel Style="{StaticResource TabbedInsideStackPanelStyle}" Height="1450">
<StackPanel Orientation="Horizontal" Style="{StaticResource StackPanelStyle}">
<TextBlock Text="Enter the Speed" Style="{StaticResource LabelStyle}"/>
<TextBox x:Name="SpeedTextBox" FontSize="28" Width="100" Margin="10,0,0,0" LostFocus="SpeedTextBox_LostFocus"></TextBox>
</StackPanel>
<!--Multiple Stack panels-->
</Grid>
</ScrollViewer>
</TabItem>
</TabControl>
</StackPanel>
</Window>
Please share your suggestions. Thank you.