WPF按钮文本尽可能换行然后滚动
随着其容器的宽度缩小,我试图让 Button 1 换行其文本,直到它无法再这样做为止,此时水平滚动条启动。现在,该按钮意识到它有足够的空间,因为滚动查看器并且根本不换行。
<ScrollViewer HorizontalScrollBarVisibility="Auto"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <Button> <TextBlock Text="Button 1 - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." TextWrapping="Wrap" /> </Button> <Button Content="Button 2" Grid.Column="1" /> </Grid> </ScrollViewer>
有什么想法吗?
As its container's width shrinks, I'm trying to get Button 1 to wrap its text until it can no longer do so, at which point the horizontal scrollbar kicks in. Right now, the button recognizes that it's got plenty of space due to the scrollviewer and doesn't wrap at all.
<ScrollViewer HorizontalScrollBarVisibility="Auto"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <Button> <TextBlock Text="Button 1 - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." TextWrapping="Wrap" /> </Button> <Button Content="Button 2" Grid.Column="1" /> </Grid> </ScrollViewer>
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
就这样吧伙计:
There you go man: