Question

I'm currently doing some pagination things. I would like to know if I can check whether the TextBlock inside of the wrappanel is overflowed or not? By the way I would like to ask if you know something about pagination please give me some tuts. What I'm doing is split a big sized string to pages and display them to the phone screen. Thanks.

Microsoft.Phone.Controls.WrapPanel wrapPanel = new   Microsoft.Phone.Controls.WrapPanel();
wrapPanel.Width = calculatedWidth;
wrapPanel.Height = calculatedHeight;
wrapPanel.Margin = new Thickness(pageFormat.leftMargin,pageFormat.topMargin,pageFormat.rightMargin,pageFormat.bottomMargin);

TextBlock tbl = new TextBlock();
tbl.Text = " Some text here ... ";

wrapPanel.Children.Add(tbl);
Était-ce utile?

La solution

Since Mango SDK, there is a property call TextTrimming.

So this xaml

<TextBlock Text="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" TextTrimming="WordEllipsis" Width="200" />

will produce somehting like "aaaaaaa....."

So for your code you just do it like:

Tb1.TextWrapping=TextWrapping.WordEllipsis

EDIT There is a property called Wrap which u can set both in xaml and c#. <TextBlock text={Binding Text} TextWarapping="Wrap" />

or in c# as

MyTextBlock.TextWrapping=TextWrapping.wrap;

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top