What happens when you have text that does not fit its container? Let’s see.
<Grid x:Name="LayoutRoot" Background="White" Margin="40">
<TextBlock Name="tb" Height="20" HorizontalAlignment="Left"
Text="This sentence is too long to fit in here"
Width="100">
</Grid>
If you run the application, you will observe that the text gets chopped off when it overflows the edge of its container.
To resolve this issue, you could either use the TextWrapping option to wrap the text or instead visually depict that the text is too big for its container. We usually depict this using the trailing three ellipsis(…)
Silverlight 4 introduces the TextTrimming property which adds an ellipses(…) when the text overflows the edge of its container. Here’s how to use this property.
<Grid x:Name="LayoutRoot" Background="White" Margin="40">
<TextBlock Name="tb" Height="20" HorizontalAlignment="Left"
Text="This sentence is too long to fit in here"
Width="100" TextTrimming="WordEllipsis"/>
</Grid>
Now running the same piece of code with the TextTrimming property will produce this output with the trailing ellipses
Note: TextTrimming property was available in WPF.
Tweet
1 comment:
hai mate...your article so usefully
may be you think for submit your article to here...
http://scriptandstyle.com/
theres so many article from famous web...may be you want to think my idea...xixixi ;))
for promote my brother
Post a Comment