我正在使用某些Microsoft Sample Code,但它似乎有一个ScrollViewer
,似乎没有按预期工作(或者我期望并希望它如何)。
<common:LayoutAwarePage
x:Class="ControlChannelHttpClient.Scenario1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:ControlChannelHttpClient"
xmlns:common="using:SDKTemplate.Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid x:Name="LayoutRoot" Background="White" HorizontalAlignment="Left" VerticalAlignment="Top">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid x:Name="Input" Grid.Row="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Margin="0">
<TextBlock TextWrapping="Wrap" Style="{StaticResource BasicTextStyle}">
This scenario demonstrates how to use the ControlChannelTrigger object with HttpClient.
This app demonstrates an HTTP client. A server is provided with this sample.
The client and server must be deployed on separate machines. Once the server is set up,
the client can set up the ControlChannelTrigger with the HttpClient by clicking Connect.
This sends an HTTP request to the server. Note that the server by default responds by completing the
HTTP request after a delay of 25 seconds. This delay is to ensure the client app can have enough time
to enter suspended state and then receive the incoming HTTP response from the server.
</TextBlock>
<Grid x:Name="ClientSettings" Margin="5">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="Server Name: " TextWrapping="Wrap" VerticalAlignment="Center" Style="{StaticResource BasicTextStyle}" />
<TextBox Grid.Row="1" Grid.ColumnSpan="2" x:Name="ServerUri" Text="http://Server-HostName/CCTHttpServerSample/default.aspx" HorizontalAlignment="Left" VerticalAlignment="Center" />
<StackPanel Orientation="Horizontal" Grid.Row="2">
<Button x:Name="ConnectButton" Content="Connect" Click="ConnectButton_Click" />
<Button x:Name="ClearButton" Content="Clear Log" Click="ClearButton_Click" />
</StackPanel>
</Grid>
</StackPanel>
<!-- Add Storyboards to the visual states below as necessary for supporting the various layouts for the input section -->
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState x:Name="InputDefaultLayout"/>
<VisualState x:Name="InputBelow768Layout"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
<Grid x:Name="Output" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Row="1">
<ScrollViewer
HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto"
HorizontalScrollMode="Disabled"
VerticalScrollMode="Enabled"
ZoomMode="Disabled"
Margin="10,4,10,0">
<TextBlock x:Name="DebugTextBlock"
TextWrapping="Wrap"
Style="{StaticResource BasicTextStyle}"
IsTextSelectionEnabled="True" />
</ScrollViewer>
<!-- Add Storyboards to the visual states below as necessary for supporting the various layouts for the output section -->
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState x:Name="OutputDefaultLayout"/>
<VisualState x:Name="OutputBelow768Layout"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</Grid>
我希望底部的ScrolViewer
(并希望它)在TextBlock
周围放置一个滚动条,当它需要它时。
示例显示了TextBlock
中的调试,但是当它填充时,整个布局变得可滚动而不是TextBlock
。
TextBlock
周围?
答案 0 :(得分:0)
只需要一个高度。 Height="200"
<ScrollViewer
HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto"
HorizontalScrollMode="Disabled"
VerticalScrollMode="Enabled"
ZoomMode="Disabled"
Margin="10,4,10,0">
<TextBlock x:Name="DebugTextBlock"
TextWrapping="Wrap"
Style="{StaticResource BasicTextStyle}"
IsTextSelectionEnabled="True" Height="200"/>
</ScrollViewer>
<!-- Add Storyboards to the visual states below as necessary for supporting the various layouts for the output section -->
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState x:Name="OutputDefaultLayout"/>
<VisualState x:Name="OutputBelow768Layout"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
这最初不起作用的原因是由于父布局具有ScrollViewer
,使得此滚动视图嵌套。