0

This is my Xaml code. I want the subject to be trimmed. But there is no effect of wordellipsis.

<StackPanel Orientation="Vertical" Grid.Column="2" Margin="10, 0, 20, 0">

 <TextBlock TextTrimming="WordEllipsis" Margin="0,2,0,2" Foreground="#666666"
  Text="{Binding Subject}"  FontSize="16" FontFamily="Segoe UI" FontWeight="Bold"/>
 .....
</StackPanel>

What am I doing wrong ?

Arpit Gupta
  • 65
  • 1
  • 9
  • 2
    Are you restricting the length of the `TextBlock` in some way? You have to do that to invoke the trimming. Whether it be for instance using other parts of your layout to restrict its width, or just for example setting a `MaxWidth` directly to the `TextBlock` itself. – Chris W. Dec 13 '13 at 15:02
  • Yes, I set the max width and trimming worked – Arpit Gupta Dec 13 '13 at 15:07
  • Shall I change my question to the answer? ;) – Chris W. Dec 13 '13 at 15:17

1 Answers1

0

You can not limit the width of stack panel. I mean you can set maxwidth of stack panel and In UI maybe you will see that stackpanel's width is not increasing but actually it's with is increasing. What to do is just try to use Grid or If you need to use StackPanel, put a Grid in side of stackpanel and put your textblock inside of your grid. After that you need to give maxwidth to your grid...

Ahmet Çok
  • 15
  • 4