Reputation: 5550
Let's say I have two TextBlock
on the same page and both binding to the same variable:
<TextBlock Text={Binding [someViewModel].someText}/>
<TextBlock Text={Binding [someViewModel].someText}/>
//someText = "testingText"
I'm wondering if it's possible to have the first textblock to show "tes......" and the second textblock showing "testingText"?
Upvotes: 1
Views: 72
Reputation: 8634
Try this
<StackPanel>
<TextBlock Text="testingtext" MaxWidth="20" TextTrimming="CharacterEllipsis" HorizontalAlignment="Left"></TextBlock>
<TextBlock Text="testingtext" ></TextBlock>
</StackPanel>
output
Upvotes: 2
Reputation: 402
Make an IValueConverter
for one of the bindings which converts the String to the custom format you want.
Upvotes: 1