Windows phone 7 检查包装袋是否溢出?

Windows phone 7 检查包装袋是否溢出?,windows-phone-7,wrappanel,Windows Phone 7,Wrappanel,我目前正在做一些分页的事情。我想知道我是否可以检查包装内的文本块是否溢出?顺便问一下,我想问你是否知道一些关于分页的知识,请给我一些辅导。我正在做的是将一个大字符串拆分为多个页面,并将它们显示在手机屏幕上。谢谢 Microsoft.Phone.Controls.WrapPanel wrapPanel = new Microsoft.Phone.Controls.WrapPanel(); wrapPanel.Width = calculatedWidth; wrapPanel.Height =

我目前正在做一些分页的事情。我想知道我是否可以检查包装内的文本块是否溢出?顺便问一下,我想问你是否知道一些关于分页的知识,请给我一些辅导。我正在做的是将一个大字符串拆分为多个页面,并将它们显示在手机屏幕上。谢谢

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);

自Mango SDK以来,存在一个属性调用

所以这个xaml

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

将产生类似“aaaaaaaaa…”的东西

因此,对于您的代码,您只需按照以下方式执行:

Tb1.TextWrapping=TextWrapping.WordEllipsis

编辑 有一个名为Wrap的属性,可以在xaml和c#中设置。

或者用c#as


MyTextBlock.TextWrapping=TextWrapping.wrap

很抱歉,你误解了我的想法。我想在textblock控件中包装文本,直到它超过固定大小(宽度和高度)。我不打算在这里删减文字。