在我的应用程序中,我希望在弹出软键盘时启用滚动功能! 我尝试在 TextBox_GotFocus 事件中更改滚动查看器的高度。
这是xaml代码,
<Grid x:Name="ContentPanel" Margin="0,152,24,21">
<ScrollViewer x:Name="ScrollViwer" VerticalScrollBarVisibility="Auto" Height="560">
<Grid>
<TextBlock HorizontalAlignment="Left" Height="65" Margin="18,10,0,0" TextWrapping="Wrap" Text="Code" VerticalAlignment="Top" Width="180" FontSize="20"/>
<TextBlock HorizontalAlignment="Left" Height="65" Margin="18,113,0,0" TextWrapping="Wrap" Text="Symbol" VerticalAlignment="Top" Width="180" FontSize="20"/>
<TextBlock HorizontalAlignment="Left" Height="65" Margin="18,221,0,0" TextWrapping="Wrap" Text="Decimal" VerticalAlignment="Top" Width="180" FontSize="20"/>
<TextBlock HorizontalAlignment="Left" Height="65" Margin="18,335,0,0" TextWrapping="Wrap" Text="Format" VerticalAlignment="Top" Width="188" FontSize="20"/>
<TextBox x:Name="CodeTextBox" Tap="CodeTextBox_Tap_1" BorderThickness="1" HorizontalAlignment="Left" Height="77" Margin="8,36,0,0" Background="Transparent" TextWrapping="Wrap" VerticalAlignment="Top" Width="438"/>
<TextBox x:Name="SymbolTextBox" BorderThickness="1" GotFocus="TextBox_GotFocus" HorizontalAlignment="Left" KeyDown="Symbol_KeyDown" TextChanged="SymbolText_Changed_1" Height="77" Margin="8,144,0,0" TextWrapping="Wrap" Background="Transparent" VerticalAlignment="Top" Width="438"/>
<Border Background="Transparent" HorizontalAlignment="Left" BorderBrush="#c5c5c5" BorderThickness="1" Height="59" Margin="18,257,0,0" VerticalAlignment="Top" Width="414">
<TextBlock x:Name="DecimalTextBox" Foreground="Black" HorizontalAlignment="Left" Tap="DeacimalTextBox_Tap_1" Height="77" Margin="5,10,0,-28" TextWrapping="Wrap" VerticalAlignment="Top" Width="409" FontSize="24"/>
</Border>
<Border Background="Transparent" BorderBrush="#c5c5c5" BorderThickness="1" HorizontalAlignment="Left" Height="59" Margin="18,372,0,0" VerticalAlignment="Top" Width="414">
<TextBlock x:Name="FormatTextBox" Foreground="Black" Tap="FormatTextBox_Tap_1" HorizontalAlignment="Left" Height="77" Margin="5,10,0,-28" TextWrapping="Wrap" VerticalAlignment="Top" Width="409" FontSize="24"/>
</Border>
</Grid>
</ScrollViewer>
<ListBox x:Name="DecimalPlacesListBox" Background="#cccccc" Visibility="Collapsed" SelectionChanged="DecimalPlaces_SelectionChanged" HorizontalAlignment="Left" Height="140" Margin="18,316,0,0" VerticalAlignment="Top" Width="414">
</Grid>
</Grid>
但它变得一文不值。 如何在键盘弹出时启用滚动!
答案 0 :(得分:1)
我尝试更改滚动查看器的宽度? - 你想创建水平滚动吗?
如果是垂直 - 更改scrollviewer中的Children的大小,而不是scrollviewer