Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

Text being trimmed in a Label when rotated

$
0
0

Hi. This is my first post here in Xamarin Forums, so please excuse me (and do let me know!) if this question is not placed where it should or whatever. I'm also pretty new with Xamarin itself, so maybe this will be a silly question, but anyway.

I have a problem with a Label inside a Grid in a ViewCell. So basically 1) I've created a ViewCell subclass, 2) I use a Grid to position all controls and 3) in Grid.Row="0" GridColumn="0" I have a Label. This 0x0 position has Height="65" and Width="20". So far so good. The Label has a Rotation="-90". No problem with this (the text is correctly rotated). The problem is only a portion of the text in that Label is shown, even where there is space for all of it.

I think I've understood why it happens, but I don't know how to fix it. Let's say the text in the Label is "ABCDEFGH". If I place that Label non rotated (so, the standard way) in a grid cell that's 65-width 20-height, all the text is shown. But if I rotate the Label (-90º) and try to place it in a 20-width 65-height then only "AB..." is shown. I'd say the Label checks how much space it has before being rotated. It sees a 20-width and so it decides only "AB..." can be shown. Even when after being rotated it has a 65-space to show all the text.

I've tried something like setting the Grid's ColumnDefinition to 65-width (so the Label sees it and decides "ABCDEFGH" can be shown) and then, in an event like OnSizeAllocated(...) changing it back to 20. But of course there's not such event in a ViewCell and I haven't found any that could be used for this.

Not sure if I've exposed the situation clearly enough. Any help will be much appreciated.


Viewing all articles
Browse latest Browse all 75885

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>