[U8.1] [XAML] [VB]避免水平滚动&调整 [英] [U8.1][XAML][VB]Avoiding Horizontal Scrolling & Resizing

查看:71
本文介绍了[U8.1] [XAML] [VB]避免水平滚动&调整的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ScrollViewer如下:

< ScrollViewer x:Name =" scrPlayers" Grid.Row = QUOT 1 QUOT; Horizo​​ntalScrollMode = QUOT;禁用" Horizo​​ntalScrollBarVisibility = QUOT;隐藏" VerticalScrollMode = QUOT;自动" VerticalScrollBarVisibility =" Hidden">< / ScrollViewer> 




我希望此ScrollViewer只能垂直滚动,我希望将内容限制为ScrollViewer的宽度。在进行一些测试时,ScrollViewer的初始宽度和它的内容是相同的(这就是我想要的)。但是,一旦
内容宽度开始增加(由于TextBox中的文本量增加),即使ScrollViewer的宽度保持不变,内容的宽度也会开始增加。我有Horizo​​ntalScrollMode =" Disabled",我认为
会强制将内容宽度限制为ScrollViewer的宽度。我需要做什么才能将内容的宽度保持为ScrollViewer的宽度?谢谢。



Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

解决方案

Nathan Sokalski,


欢迎来到开发通用Windows应用论坛! 

您使用的是哪种应用程序类型?请阅读粘贴帖子,特别是 
发布指南:主题行标签
 &absp; Windows 10 SDK和工具的已知问题   


在我看来,您的问题的一个解决方法是让ScrolViewer中的TextBox使用与ScrollViewer相同的宽度,之后请设置
<一个文本框的href ="https://msdn.microsoft.com/en-us/windows.ui.xaml.controls.textbox.textwrapping">
TextWrapping 属性为"Wrap",通过这种方式,您可以强制将TextBox内容的宽度限制为ScrollViewer的宽度。


最好的问候,

Amy Peng


I have a ScrollViewer as follows:

<ScrollViewer x:Name="scrPlayers" Grid.Row="1" HorizontalScrollMode="Disabled" HorizontalScrollBarVisibility="Hidden" VerticalScrollMode="Auto" VerticalScrollBarVisibility="Hidden"></ScrollViewer>


I want this ScrollViewer to only scroll vertically, I want the content to be restricted to the width of the ScrollViewer. When doing some testing, the initial widths of the ScrollViewer and it's content are the same (which is what I want). However, once the content width starts to increase (because of the amount of text in a TextBox increasing), the width of the content starts to increase, even though the width of the ScrollViewer stays the same. I have HorizontalScrollMode="Disabled", which I thought would force the content width to be restricted to the width of the ScrollViewer. What do I need to do to keep the width of the content to the width of the ScrollViewer? Thanks.


Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

解决方案

Hi Nathan Sokalski,

Welcome to the Developing Universal Windows apps forum! 
Which application type are you using? Please read the sticky posts, especially the Guide to posting: subject line tags and Known Issues for Windows 10 SDK and Tools  

In my mind, one workaround for your issue is to let the TextBox which is inside the ScrolViewer use the same width as the ScrollViewer, after that please set the TextWrapping property of the TextBox as "Wrap", in this way you can force the TextBox content width to be restricted to the width of the ScrollViewer.

Best Regards,
Amy Peng


这篇关于[U8.1] [XAML] [VB]避免水平滚动&amp;调整的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆