texttrimming

Get Displayed Text from TextBlock

偶尔善良 提交于 2019-11-27 20:06:34
I have a simple TextBlock defined like this <StackPanel> <Border Width="106" Height="25" Margin="6" BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left"> <TextBlock Name="myTextBlock" TextTrimming="CharacterEllipsis" Text="TextBlock: Displayed text"/> </Border> </StackPanel> Which outputs like this This will get me "TextBlock: Displayed text" string text = myTextBlock.Text; But is there a way to get the text that's actually displayed on the screen? Meaning "TextBlock: Display..." Thanks You can do this by first retrieving the Drawing object that represents the appearance of the

Get Displayed Text from TextBlock

爷,独闯天下 提交于 2019-11-26 20:09:57
问题 I have a simple TextBlock defined like this <StackPanel> <Border Width="106" Height="25" Margin="6" BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left"> <TextBlock Name="myTextBlock" TextTrimming="CharacterEllipsis" Text="TextBlock: Displayed text"/> </Border> </StackPanel> Which outputs like this This will get me "TextBlock: Displayed text" string text = myTextBlock.Text; But is there a way to get the text that's actually displayed on the screen? Meaning "TextBlock: Display...