我在WPF中有一个应用程序,我希望在我的文本框中只看到字符串的结尾。
XAML:
<Grid Height="109" Width="126">
<Grid.RowDefinitions>
<RowDefinition Height="166*" />
<RowDefinition Height="145*" />
</Grid.RowDefinitions>
<TextBlock Text="10000004" TextTrimming="CharacterEllipsis" TextWrapping="NoWrap" Width="40" Background="LightBlue"/>
<TextBlock Text="10000005" TextTrimming="CharacterEllipsis" TextWrapping="NoWrap" Width="40" Grid.Row="1" Background="LightGreen"/>
</Grid>
答案 0 :(得分:1)
As you probably have seen on MSDN,您需要使用自己的TextTrimmingProperty依赖项属性创建/扩展。
Look at this扩展TextBlock,以便您可以创建自己的TextTrimmingProperty以使其工作方式不同。
答案 1 :(得分:0)
int Len = 4; //put this equcal to how many digits you need from last...
//path is the actual string
string endText = path.Substring(path.Length - Len, path.Length)