简体   繁体   English

如何在 Xamarin.Forms 中显示 Label 的结尾?

[英]How can I show end of Label in Xamarin.Forms?

Is there any way how can style my Label in Xamarin.Forms to expand in row to the space it really needs (even beyond screens width) and then show the end of it?有什么办法可以在 Xamarin.Forms 中设置我的 Label 的样式以在行中扩展到它真正需要的空间(甚至超出屏幕宽度)然后显示

To explain it better, here is the picture of two situations:为了更好地解释它,这里是两种情况的图片:

带有两个标签控件的屏幕

Let's asume that black box are the screen bounds.让我们假设黑框是屏幕边界。 Blue and red boxes are Label's bounds.蓝色和红色框是标签的界限。 Both Labels has set Text property to "AB C DEFGHIJKLMNOPQ R STUVWXYZ".两个标签都将 Text 属性设置为“AB C DEFGHIJKLMNOPQ R STUVWXYZ”。

Label in blue box is pretty easy and standard to achieve.蓝盒中的 Label 非常容易实现并且是标准的。

My concerns is regarding the Label in red box.我担心的是红框中的 Label。 Can this be done through XAML or need some code-behind calculations and setting?这可以通过 XAML 完成还是需要一些代码隐藏计算和设置?

use the LineBreakMode property使用LineBreakMode属性

<Label LineBreakMode="HeadTruncation" ... />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将 Label 绑定到 function 结果为 Xamarin.Z645024253191292AE688A8A - How can you bind a Label to a function result in Xamarin.Forms Xamarin.forms如何在列表中彼此相邻显示项目 - Xamarin.forms How can I show items next each other in a list 如何在 Xamarin.forms 中的框架边缘显示阴影? - How can I show shadows on the edges of my Frame in Xamarin.forms? xamarin.forms如何在标题栏中显示视图 - xamarin.forms how to show a view in the titlebar 如何从 Android MainActivity.cs 文件中更改 Xamarin.forms 中页面 Label 的文本? - How can I change the text of a page's Label in Xamarin.forms from the Android MainActivity.cs file? 如何在Xamarin.Forms中为ToolbarItem创建自定义渲染器? - How can I make a custom renderer for ToolbarItem in Xamarin.Forms? 如何在Xamarin.Forms中为轮播实现活动指示器? - How can I implement an Activity Indicator for a Carousel in Xamarin.Forms? 如何在Xamarin.Forms的TabbedPage的选项卡中放置按钮? - How can I place a button in the the tabs of a TabbedPage in Xamarin.Forms? 如何使用 XAML 在 Xamarin.Forms 的 ListView 中选择一个项目 - How can I select an item in a ListView in Xamarin.Forms with XAML 如何从 Xamarin.Forms 获得连续的地理定位? - How can I get a continous geolication from Xamarin.Forms?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM