1.) Is there an easy way to trim a string in a listbox, so it doesn't exceed the width of the listbox?
2.) If there is no easy way, I think I have figured out a hard way using the TextRenderer method with a Converter, however I am running into problems figuring out what Font is being used by that itemtemplate textblock.
Sample XAML I am using for my ItemTemplate:
Code:<ListBox.ItemTemplate> <DataTemplate> <StackPanel> <TextBlock Text="{Binding Path=Name}" Foreground="LightBlue"/> <TextBlock Text="{Binding Path=Description, Converter={StaticResource ShortenString}, ConverterParameter={StaticResource me}}" FontSize="10" Foreground="White"/> <TextBlock Text="{Binding Path=Tags, Converter={StaticResource ListToString}}" FontSize="10" Foreground="White"/> </StackPanel> </DataTemplate> </ListBox.ItemTemplate>




Reply With Quote