Xamarin Forms:如何将滚动查看器添加到 uwp 中的整个页面

Xamarin Forms: How to add the scroll-viewer to entire page in uwp

你好朋友我想在用户还原或减小应用程序高度或宽度时将滚动查看器添加到整个页面,然后滚动查看器应该启用。以便用户可以使用滚动查看器移动表单。 提前致谢。

当我通过滚动查看器时,它不会在我还原或降低应用程序高度时启用

<ScrollViewer>
<Grid HorizontalAlignment="Stretch" Height="1000" Margin="0,0,0,0" 
VerticalAlignment="Top">
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="7*"/>
        <ColumnDefinition Width="10*"/>
        <ColumnDefinition Width="27*"/>
        <ColumnDefinition Width="19*"/>
        <ColumnDefinition Width="38*"/>
        <ColumnDefinition Width="40*"/>
        <ColumnDefinition Width="57*"/>
        <ColumnDefinition Width="38*"/>
        <ColumnDefinition Width="56*"/>
        <ColumnDefinition Width="8*"/>
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition Height="18*"/>
        <RowDefinition Height="9*"/>
        <RowDefinition Height="3*"/>
        <RowDefinition Height="18*"/>
        <RowDefinition Height="12*"/>
        <RowDefinition Height="12*"/>
        <RowDefinition Height="8*"/>
        <RowDefinition Height="10*"/>
        <RowDefinition Height="5*"/>
        <RowDefinition Height="7*"/>
        <RowDefinition Height="7*"/>
        <RowDefinition Height="11*"/>
        <RowDefinition Height="16*"/>
        <RowDefinition Height="10*"/>
        <RowDefinition Height="54*"/>
    </Grid.RowDefinitions>

        <TextBlock FontFamily="{StaticResource inventorySemiBoldFont}" Text="Personal Information" FontSize="16" FontWeight="SemiBold" Margin="43,14,44,45" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"  />
    <TextBlock FontFamily="{StaticResource inventoryRegularFont}" Text="Prefix" Foreground="#414042" FontSize="14" FontWeight="SemiLight" Margin="43,56,37,3" Grid.Column="1" Grid.Row="3" Grid.ColumnSpan="2" HorizontalAlignment="Stretch"    />


    <Border extensions:Mouse.Cursor="Hand" Margin="49,51,16,9" Grid.Column="3" Grid.Row="3" Grid.ColumnSpan="2"  BorderThickness="1" BorderBrush="#E1E1E1"  CornerRadius="5" HorizontalAlignment="Stretch" Height="30" >
        <ComboBox Padding="8 0 0 0" extensions:Mouse.Cursor="Hand" Width="200" BorderBrush="Transparent"  BorderThickness="0" FontWeight="Light" FontSize="13" FontFamily="{StaticResource inventoryRegularFont}" UseLayoutRounding="True" TabIndex="1" Name="userPrefix" PlaceholderText="Select Prefix" PlaceholderForeground="#414042" Grid.Column="3" Grid.Row="3" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Stretch" Margin="0,0,0,0" >
            <x:String>Mr</x:String>
            <x:String>Mrs</x:String>
            <x:String>Miss</x:String>
        </ComboBox>
    </Border>



    <TextBlock FontFamily="{StaticResource inventoryRegularFont}" Padding="0"  Text="First Name" Foreground="#414042" FontSize="14" FontWeight="SemiLight" Margin="64,51,0,10" Grid.Column="5" Grid.Row="3"  />
    <Border extensions:Mouse.Cursor="Hand" Height="30"  BorderThickness="1" BorderBrush="#E1E1E1"  CornerRadius="5" Width="220" Margin="21,50,0,8" Grid.Column="6" Grid.Row="3" HorizontalAlignment="Left" VerticalAlignment="Stretch" >
        <TextBox extensions:Mouse.Cursor="Hand" MaxLength="20" Padding="6" BorderBrush="Transparent" BorderThickness="0" TabIndex="2" FontSize="13" FontFamily="{StaticResource inventoryRegularFont}" PlaceholderText="Enter First Name" Width="220"   Name="userFirstName" Text="" Grid.Column="6" Grid.Row="3" HorizontalAlignment="Center" VerticalContentAlignment="Center" TextChanging="UserFirstName_TextChanging" Margin="0,0,0,-1" />
    </Border>
    <TextBlock Text=""   Name="FirstNameError" FontSize="11" Foreground="red" Margin="21,82,0,54" Grid.Column="6" Grid.Row="3" HorizontalAlignment="Left" Width="180" Grid.RowSpan="2"/>
 <TextBlock FontFamily="{StaticResource inventoryRegularFont}" Padding="0"  Text="First Name" Foreground="#414042" FontSize="14" FontWeight="SemiLight" Margin="64,51,0,10" Grid.Column="5" Grid.Row="3"  />
    <Border extensions:Mouse.Cursor="Hand" Height="30"  BorderThickness="1" BorderBrush="#E1E1E1"  CornerRadius="5" Width="220" Margin="21,50,0,8" Grid.Column="6" Grid.Row="3" HorizontalAlignment="Left" VerticalAlignment="Stretch" >
        <TextBox extensions:Mouse.Cursor="Hand" MaxLength="20" Padding="6" BorderBrush="Transparent" BorderThickness="0" TabIndex="2" FontSize="13" FontFamily="{StaticResource inventoryRegularFont}" PlaceholderText="Enter First Name" Width="220"   Name="userFirstName" Text="" Grid.Column="6" Grid.Row="3" HorizontalAlignment="Center" VerticalContentAlignment="Center" TextChanging="UserFirstName_TextChanging" Margin="0,0,0,-1" />
    </Border>
    <TextBlock Text=""   Name="FirstNameError" FontSize="11" Foreground="red" Margin="21,82,0,54" Grid.Column="6" Grid.Row="3" HorizontalAlignment="Left" Width="180" Grid.RowSpan="2"/>

    <TextBlock FontFamily="{StaticResource inventoryRegularFont}" Padding="0" Text="Middle Name" Foreground="#414042" FontSize="14" FontWeight="SemiLight" Margin="44,48,7,6" Grid.Column="7" Grid.Row="3"  />
    <Border extensions:Mouse.Cursor="Hand" Margin="38,46,22,14" Grid.Column="8" Grid.Row="3"  Height="30" BorderThickness="1" BorderBrush="#E1E1E1" CornerRadius="5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <TextBox extensions:Mouse.Cursor="Hand" MaxLength="20" Padding="8 6 6 6" BorderBrush="Transparent" BorderThickness="0" FontSize="13" FontFamily="{StaticResource inventoryRegularFont}" TabIndex="3" PlaceholderText="Enter Middle Name" Text=""  Name="userMiddleName" Grid.Column="8" Grid.Row="3" HorizontalAlignment="Center" TextChanging="UserMiddleName_TextChanging" Margin="0,0,0,-4" Width="200" />
    </Border>

    <TextBlock Text="*" Foreground="Red" Margin="40,12,120,19" Grid.Column="1" Grid.Row="4" Grid.ColumnSpan="2"/>
    <TextBlock FontFamily="{StaticResource inventoryRegularFont}" Padding="5,0,0,0" Text="Last Name" Foreground="#414042" FontSize="14" FontWeight="SemiLight" Margin="46,16,16,15" Grid.Column="1" Grid.Row="4" Grid.ColumnSpan="2"  />
    <Border extensions:Mouse.Cursor="Hand" Margin="49,18,16,12" Grid.Column="3" Grid.Row="4" Grid.ColumnSpan="2"   BorderThickness="1" BorderBrush="#E1E1E1"  CornerRadius="5" Height="30" HorizontalAlignment="Stretch" >
        <TextBox  extensions:Mouse.Cursor="Hand" MaxLength="20" Padding="6" BorderBrush="Transparent"  BorderThickness="0" FontSize="13" TabIndex="4" FontFamily="{StaticResource inventoryRegularFont}" PlaceholderText="Enter Last Name" Height="30" Text="" Name="userLastName"  Grid.Column="3" Grid.Row="4" Grid.ColumnSpan="2" HorizontalAlignment="Stretch"  RequestedTheme="Default" UseLayoutRounding="False" TextChanging="UserLastName_TextChanging" Margin="0,0,-2,-4" />
    </Border>
    <TextBlock Text="" Name="LastNameError" FontSize="11" Foreground="red" Margin="49,49,0,55" Grid.Column="3" Grid.Row="4" HorizontalAlignment="Left" Width="180" Grid.ColumnSpan="2" RenderTransformOrigin="0.5,0.5" Grid.RowSpan="2"/>



    <TextBlock FontFamily="{StaticResource inventoryRegularFont}" Text="Gender" Foreground="#414042" FontSize="14" FontWeight="SemiLight" Margin="57,19,26,17" Grid.Column="5" Grid.Row="4"  />
    <Border extensions:Mouse.Cursor="Hand" Margin="21,10,0,14" Grid.Column="6" Grid.Row="4" HorizontalAlignment="Left" VerticalAlignment="Stretch" Height="30" BorderThickness="1" BorderBrush="#E1E1E1" CornerRadius="5" Width="220">
        <ComboBox Padding="5 0 0 0" extensions:Mouse.Cursor="Hand" BorderBrush="Transparent" BorderThickness="0" FontSize="13" FontWeight="Light" FontFamily="{StaticResource inventoryRegularFont}" AllowDrop="True"   Name="userGender" TabIndex="5"  Header="" PlaceholderForeground="#414042" PlaceholderText="Select Gender" HorizontalAlignment="Left" VerticalAlignment="Bottom" Grid.Column="6"  Grid.Row="4" Width="220" Height="38" Margin="0,0,0,-1">
            <x:String>Male</x:String>
            <x:String>Female</x:String>
            <x:String>Prefer not to say</x:String>
        </ComboBox>
    </Border>

    <TextBlock Text="*" Foreground="Red" Margin="44,10,0,23" Grid.Column="7" Grid.Row="4" HorizontalAlignment="Left" Width="13" VerticalAlignment="Stretch"/>
    <TextBlock Text="Email" FontFamily="{StaticResource inventoryRegularFont}" Foreground="#414042" FontSize="14" FontWeight="SemiLight" Margin="51,16,31,17" Grid.Column="7" Grid.Row="4" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"  />
    <Border extensions:Mouse.Cursor="Hand" Margin="38,14,22,16" Grid.Column="8" Grid.Row="4" HorizontalAlignment="Stretch" Height="30" BorderThickness="1" BorderBrush="#E1E1E1" CornerRadius="5">
        <TextBox extensions:Mouse.Cursor="Hand" MaxLength="50" Padding="6" BorderBrush="Transparent" BorderThickness="0" FontSize="13" FontFamily="{StaticResource inventoryRegularFont}" PlaceholderText="Enter Email" TabIndex="6" Text="" Height="30" Name="userEmail"  Grid.Column="8" Grid.Row="4" HorizontalAlignment="Stretch" TextChanging="UserEmail_TextChanging" Margin="0,0,-2,-4" VerticalAlignment="Stretch" />
    </Border>
    <TextBlock Text="" Name="EmailError" FontSize="11" Foreground="red" Margin="38,47,0,55" Grid.Column="8" Grid.Row="4" HorizontalAlignment="Left" Width="180" Grid.RowSpan="2"/>

    <TextBlock Text="*" Foreground="Red" Margin="41,10,0,23" Grid.Column="1" Grid.Row="5" HorizontalAlignment="Left" Width="40" Grid.ColumnSpan="2" VerticalAlignment="Stretch"/>
    <TextBlock Text="Password" FontFamily="{StaticResource inventoryRegularFont}" Padding="5 0 0 0" Foreground="#414042" FontSize="14" FontWeight="SemiLight" Margin="46,14,57,19" Grid.Column="1" Grid.Row="5" Grid.ColumnSpan="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"  />
    <!--<PasswordBox  TabIndex="7" Height=" 20" Width=" 180"    Name="userPassword" Grid.ColumnSpan="2" Margin="49,12,0,16" Grid.Column="3" Grid.Row="5" HorizontalAlignment="Left" />-->
    <Border extensions:Mouse.Cursor="Hand" Margin="49,13,16,17"  Grid.Column="3" Grid.Row="5" HorizontalAlignment="Stretch" Height="30" BorderThickness="1" BorderBrush="#E1E1E1" CornerRadius="5" Grid.ColumnSpan="2">
        <TextBox extensions:Mouse.Cursor="Hand" MaxLength="20" Padding="6" BorderBrush="Transparent" BorderThickness="0" FontSize="13" PlaceholderText="Enter Password" FontFamily="{StaticResource inventoryRegularFont}" TabIndex="7" Text="" Height=" 20"   Name="userPassword" Grid.ColumnSpan="2" Grid.Column="3" Grid.Row="5" HorizontalAlignment="Stretch" TextChanging="UserPassword_TextChanging" Margin="0,-2,-1,-2" VerticalAlignment="Stretch" />
    </Border>
    <TextBlock TextWrapping="wrap" Text="" Name="PasswordError" FontSize="11" Foreground="red" Margin="49,44,0,25" Grid.Column="3" Grid.Row="5" HorizontalAlignment="Left" Width="180" Grid.ColumnSpan="2" Grid.RowSpan="2" />
    <TextBlock FontFamily="{StaticResource inventoryRegularFont}" Text="Select Role" Foreground="#414042" FontSize="14" FontWeight="SemiLight" Margin="68,19,277,7" Grid.Column="5" Grid.Row="5" Grid.ColumnSpan="2"  />
    <Border extensions:Mouse.Cursor="Hand"  Margin="21,10,0,13" Grid.Column="6" Grid.Row="5" HorizontalAlignment="Left" Height="30" BorderThickness="1" BorderBrush="#E1E1E1" CornerRadius="5" Width="220" Grid.ColumnSpan="2" VerticalAlignment="Stretch">
        <ComboBox Padding="5 0 0 0" extensions:Mouse.Cursor="Hand" SelectedValuePath="rid" BorderBrush="Transparent" BorderThickness="0" FontSize="13" FontWeight="Light" FontFamily="{StaticResource inventoryRegularFont}" TabIndex="8"  Name="userRoleId" Header="" PlaceholderForeground="#414042" PlaceholderText="Select Role" Width="220" HorizontalAlignment="Left" VerticalAlignment="Stretch"  Grid.Column="6" Grid.Row="5" GotFocus="UserRoleId_GotFocus" Margin="0,-10,0,-2">
            <ComboBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Name ="roleName" Text="{Binding rname}" Tag="{Binding rid}"/>
                </DataTemplate>
            </ComboBox.ItemTemplate>
        </ComboBox>
    </Border>
    <TextBlock Text="" Name="RoleError" FontSize="11" Foreground="red" Margin="21,52,0,31" Grid.Column="6" Grid.Row="5" HorizontalAlignment="Left" Width="180" Grid.RowSpan="2" VerticalAlignment="Stretch"/>

    <TextBlock Text="*" Foreground="Red" Margin="44,13,0,20" Grid.Column="7" Grid.Row="5" HorizontalAlignment="Left" Width="13"/>
    <TextBlock Text="Organization" FontFamily="{StaticResource inventoryRegularFont}" Foreground="#414042" FontSize="14" FontWeight="SemiLight" Margin="51,19,31,14" Grid.Column="7" Grid.Row="5"  />
    <Border extensions:Mouse.Cursor="Hand"  Margin="38,13,22,17" Grid.Column="8" Grid.Row="5" HorizontalAlignment="Stretch" Height="30" BorderThickness="1" BorderBrush="#E1E1E1" CornerRadius="5">
        <ComboBox Padding="5 0 0 0" extensions:Mouse.Cursor="Hand" SelectedValuePath="rid" BorderBrush="Transparent" BorderThickness="0" FontSize="13" FontWeight="Light" FontFamily="{StaticResource inventoryRegularFont}" TabIndex="8"  Name="cmbOrganization" Header="" PlaceholderForeground="#414042" PlaceholderText="Select Organization" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"  Grid.Column="6" Grid.Row="5"  Margin="-1,-13,-1,1" GotFocus="CmbOrganization_GotFocus">
            <ComboBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Name ="OrganisationName" Text="{Binding name}" Tag="{Binding id}"/>
                </DataTemplate>
            </ComboBox.ItemTemplate>
        </ComboBox>
    </Border>
    <TextBlock Text="" Name="OrganizationError" FontSize="11" Foreground="red" Margin="40,48,0,34" Grid.Column="8" Grid.Row="5" HorizontalAlignment="Left" Width="180" Grid.RowSpan="2" VerticalAlignment="Stretch"/>



    <TextBlock FontFamily="{StaticResource inventorySemiBoldFont}" Padding="0" Text="Contact Information" Foreground="#414042" FontSize="16" FontWeight="SemiBold" Margin="43,6,50,10" Grid.Column="1" Grid.Row="6" Grid.ColumnSpan="3"  />

    <TextBlock FontFamily="{StaticResource inventoryRegularFont}" Padding="0" Text="Street Address" Foreground="#414042" FontSize="14" FontWeight="SemiLight" Margin="43,13,38,17" Grid.Column="1" Grid.Row="8" Grid.RowSpan="2" Grid.ColumnSpan="2"  />
    <Border extensions:Mouse.Cursor="Hand" Margin="49,18,16,12" Grid.ColumnSpan="2" Grid.RowSpan="2" Grid.Column="3" Grid.Row="8" HorizontalAlignment="Stretch" Height="30" BorderThickness="1" BorderBrush="#E1E1E1" CornerRadius="5">
        <TextBox extensions:Mouse.Cursor="Hand" MaxLength="100" Padding="8 6 6 6" BorderBrush="Transparent" BorderThickness="0" FontSize="13" FontFamily="{StaticResource inventoryRegularFont}" PlaceholderText="Enter Street Address" TabIndex="12" Name="userAddress" Text="" Grid.ColumnSpan="2" Grid.Column="3" Grid.Row="8" HorizontalAlignment="Center" Width="201" Grid.RowSpan="2" Margin="0,0,0,-4" />
    </Border>


    <TextBlock FontFamily="{StaticResource inventoryRegularFont}" Text="City" Foreground="#414042" FontSize="14" FontWeight="SemiLight" Margin="44,14,32,5" Grid.Column="7" Grid.Row="7"  />
    <Border extensions:Mouse.Cursor="Hand" Grid.Column="8" Grid.Row="7" Margin="38,10,22,10"  HorizontalAlignment="Stretch" Height="30" BorderThickness="1" BorderBrush="#E1E1E1" CornerRadius="5">
        <ComboBox Padding="5 0 0 0" extensions:Mouse.Cursor="Hand" BorderBrush="Transparent" BorderThickness="0" FontSize="13" TabIndex="11"  FontFamily="{StaticResource inventoryRegularFont}"   Header="" Name="userCity" ItemsSource="{x:Bind CityList}" PlaceholderText="Select City" PlaceholderForeground="#414042" FontWeight="Light" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="8" Grid.Row="7"  Tapped="LoadCities" Margin="0,-6,-2,-2">
            <ComboBox.ItemTemplate>
                <DataTemplate x:DataType="local:CityData" >
                    <TextBlock Name="{x:Bind cityId}" Text="{x:Bind cityName}" />
                </DataTemplate>
            </ComboBox.ItemTemplate>
        </ComboBox>
    </Border>
    <TextBlock Text=""   Name="CityError" FontSize="11" Foreground="red" Margin="44,44,0,17" Grid.Column="8" Grid.Row="7" HorizontalAlignment="Left" Width="183" Grid.RowSpan="2" VerticalAlignment="Stretch"  />




    <TextBlock FontFamily="{StaticResource inventoryRegularFont}" Padding="0" Text="State" Foreground="#414042" FontSize="14" FontWeight="SemiLight" Margin="64,13,12,24" Grid.Column="5" Grid.Row="7" Grid.RowSpan="2"  />
    <Border extensions:Mouse.Cursor="Hand" Margin="21,10,0,10" Grid.Column="6" Grid.Row="7"  HorizontalAlignment="Left" Height="30" BorderThickness="1" BorderBrush="#E1E1E1" CornerRadius="5" Width="220" VerticalAlignment="Stretch">
        <ComboBox Padding="5 0 0 0" extensions:Mouse.Cursor="Hand" BorderBrush="Transparent" BorderThickness="0" FontSize="13" FontWeight="Light" FontFamily="{StaticResource inventoryRegularFont}" TabIndex="10"  Header="" Width=" 220" Name="userState" ItemsSource="{x:Bind StateList}" PlaceholderText="Select State" PlaceholderForeground="#414042" HorizontalAlignment="Left" VerticalAlignment="Stretch" Grid.Column="6" Grid.Row="7" SelectionChanged="GetCityList" Tapped="LoadStates" Margin="0,-11,0,-2" >
            <ComboBox.ItemTemplate>
                <DataTemplate x:DataType="local:StateData" >
                    <TextBlock Name="{x:Bind StateId}" Text="{x:Bind StateName}" />
                </DataTemplate>
            </ComboBox.ItemTemplate>
        </ComboBox>
    </Border>

    <TextBlock FontFamily="{StaticResource inventoryRegularFont}" Padding="0" Text="Middle Name" Foreground="#414042" FontSize="14" FontWeight="SemiLight" Margin="44,48,7,6" Grid.Column="7" Grid.Row="3"  />
    <Border extensions:Mouse.Cursor="Hand" Margin="38,46,22,14" Grid.Column="8" Grid.Row="3"  Height="30" BorderThickness="1" BorderBrush="#E1E1E1" CornerRadius="5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <TextBox extensions:Mouse.Cursor="Hand" MaxLength="20" Padding="8 6 6 6" BorderBrush="Transparent" BorderThickness="0" FontSize="13" FontFamily="{StaticResource inventoryRegularFont}" TabIndex="3" PlaceholderText="Enter Middle Name" Text=""  Name="userMiddleName" Grid.Column="8" Grid.Row="3" HorizontalAlignment="Center" TextChanging="UserMiddleName_TextChanging" Margin="0,0,0,-4" Width="200" />
    </Border>
<TextBlock  Text="Country" FontFamily="{StaticResource inventoryRegularFont}" Foreground="#414042" FontSize="14" FontWeight="SemiLight" Margin="43,10,39,14" Grid.Column="1" Grid.Row="7" Grid.ColumnSpan="2"  />
    <Border extensions:Mouse.Cursor="Hand" Grid.Column="3" Margin="49,14,16,6" Grid.Row="7" HorizontalAlignment="Stretch" Height="30" BorderThickness="1" BorderBrush="#E1E1E1" CornerRadius="5" Grid.ColumnSpan="2">
        <ComboBox Padding="5 0 0 0" extensions:Mouse.Cursor="Hand" BorderBrush="Transparent" BorderThickness="0" FontSize="13" FontWeight="Light" FontFamily="{StaticResource inventoryRegularFont}" TabIndex="9"   Name="userCountry" Canvas.ZIndex="1" ItemsSource="{x:Bind CountryList}"  PlaceholderText="Select Country" PlaceholderForeground="#414042" Grid.ColumnSpan="2" HorizontalAlignment="Stretch"  VerticalAlignment="Stretch" Grid.Column="3" Grid.Row="7" SelectionChanged="GetStateList" Tapped="ClearError" Margin="0,0,-2,-2">
            <ComboBox.ItemTemplate>
                <DataTemplate x:DataType="local:CountryData">
                    <TextBlock Name="{x:Bind CountryId}" Text="{x:Bind CountryName}" />
                </DataTemplate>
            </ComboBox.ItemTemplate>
        </ComboBox>
    </Border>

    <TextBlock Text="" Name="CountryError" FontSize="11" Foreground="red" Grid.Column="3" Margin="46,42,0,17" Grid.Row="7"  HorizontalAlignment="Left" Width="180" Grid.ColumnSpan="2" RenderTransformOrigin="0.5,0.5" Grid.RowSpan="2" VerticalAlignment="Stretch"/>

    <TextBlock Text=""  Name="StatesError" FontSize="11" Foreground="red" Margin="25,41,83,17" Grid.Column="6" Grid.Row="7" Grid.RowSpan="2"  />


    <TextBlock FontFamily="{StaticResource inventoryRegularFont}" Text="ZIP" Foreground="#414042" FontSize="14" FontWeight="SemiLight" Margin="64,17,57,16" Grid.Column="5" Grid.Row="8" Grid.RowSpan="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"  />
    <Border extensions:Mouse.Cursor="Hand" Margin="21,17,0,11" Grid.Column="6" Grid.Row="8" HorizontalAlignment="Left" Height="30" BorderThickness="1" BorderBrush="#E1E1E1" CornerRadius="5" Width="220" Grid.RowSpan="2" VerticalAlignment="Stretch">
        <TextBox extensions:Mouse.Cursor="Hand" MaxLength="6" Padding="6" BorderBrush="Transparent" BorderThickness="0" FontSize="13" FontFamily="{StaticResource inventoryRegularFont}" InputScope="Number" PlaceholderText="Enter ZIP Code" TabIndex="13" Height="30"  Width="220" Name="userZip" Text="" Grid.Column="6" Grid.Row="8" HorizontalAlignment="Left" Grid.RowSpan="2" TextChanging="UserZip_TextChanging"  />
    </Border>
    <TextBlock FontFamily="{StaticResource inventoryRegularFont}" Padding="0" Text="Phone Number" Foreground="#414042" FontSize="14" FontWeight="SemiLight" Margin="44,16,37,21" Grid.Column="7" Grid.Row="8" Grid.RowSpan="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"  />
    <Border extensions:Mouse.Cursor="Hand" Margin="38,18,22,12" Grid.Column="8" Grid.Row="8" HorizontalAlignment="Stretch" Height="30" BorderThickness="1" BorderBrush="#E1E1E1" CornerRadius="5" Grid.RowSpan="2">
        <TextBox  extensions:Mouse.Cursor="Hand" MaxLength="13" Padding="6" FontSize="13" BorderBrush="Transparent" BorderThickness="0" FontFamily="{StaticResource inventoryRegularFont}"  TabIndex="14" PlaceholderText="Enter Phone Number" Height="30" Name="userPhone" Grid.Column="8" Grid.Row="8" HorizontalAlignment="Stretch" Grid.RowSpan="2" TextChanging="UserPhone_TextChanging" Margin="0,0,-2,-4" />
    </Border>
         <TextBlock FontFamily="{StaticResource inventorySemiBoldFont}" Text="Assign Department" FontSize="16" FontWeight="SemiBold" Grid.ColumnSpan="3" Margin="43,17,72,43" Grid.Column="1" Grid.Row="10" Grid.RowSpan="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />



        <Button extensions:Mouse.Cursor="Hand" Style="{StaticResource  AssignButtonStyle}" Margin="0,18,0,7" FontFamily="{StaticResource inventorySemiBoldFont}" FontSize="13"    TabIndex="15" x:Name="BtnAssign" Background="#00BFF3" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"  BorderBrush="White" BorderThickness="0.1"    Content="ASSIGN" Foreground="White"    HorizontalAlignment="Center" VerticalAlignment="Stretch" Grid.Row="11" Grid.Column="1"  Click="SelectDepartment" Grid.ColumnSpan="2" />


 <ScrollViewer MinWidth =" 1200"    ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollBarVisibility="Visible"  Margin="38,53,0,31" Grid.Row="11" Grid.ColumnSpan="8" Grid.RowSpan="3" Grid.Column="1">
            <controls:WrapPanel MinWidth =" 1200"   Orientation="Horizontal"  ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollBarVisibility="Visible"      Name="SPSelectdedDepartment" Grid.Row="12" Grid.ColumnSpan="8" Grid.RowSpan="2" Grid.Column="1" Width="1310"  MaxWidth ="1357" HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" />
    </ScrollViewer>

</Grid>

A ScrollViewer enables content to be displayed in a smaller area than its actual size. When the content of the ScrollViewer is not entirely visible, the ScrollViewer displays scrollbars that the user can use to move the content areas that is visible. The area that includes all of the content of the ScrollViewer is the extent. The visible area of the content is the viewport.

请查看ScrollViewer官方document

A ScrollViewer enables content to be displayed in a smaller area than its actual size. When the content of the ScrollViewer is not entirely visible, the ScrollViewer displays scrollbars that the user can use to move the content areas that is visible. The area that includes all of the content of the ScrollViewer is the extent. The visible area of the content is the viewport.

因此,如果内容大小大于 ScrollViewer 的实际大小,滚动条将显示。我发现你把网格高度设置为1000,如果ScrollViewer高度小于1000,ScrollViewer会垂直滚动。为确保 ScrollViewer 填充页面内容,您需要将 ScrollViewer VerticalAlignmentHorizontalAlignment 设置为 Stretch.

<ScrollViewer  VerticalAlignment="Stretch"  HorizontalAlignment="Stretch" />