title: WPF: ListBoxItem TextTrimming
body: <p>I'm working with <code>WPF</code>, and I stack in one issue. Now I have <code>ListBox</code>. <code>ListBox</code> <code>ItemsPanel</code> is <code>StackPanel</code>. When <code>StackPanel</code> <code>Orientation</code> is <code>Vertical</code> it works correctly!<br/>
  <strong>Demo:</strong><br/>
  <img src="https://i.stack.imgur.com/vyida.png" alt="enter image description here"></p>
  
  <p><strong>XAML code:</strong><br/></p>
  
  <pre><code> &lt;Grid&gt;
          &lt;Grid.Resources&gt;
              &lt;XmlDataProvider x:Key="xmlData" XPath="/records"&gt;
                  &lt;x:XData&gt;
                      &lt;records xmlns=""&gt;
                          &lt;entry text="Veeeeeeeeeeeeeeeeeeery looooooooooooooooooooooong text"/&gt;
                          &lt;entry text="A little bit shorter text" /&gt;
                          &lt;entry text="Normal text"/&gt;
                      &lt;/records&gt;
                  &lt;/x:XData&gt;
              &lt;/XmlDataProvider&gt;
          &lt;/Grid.Resources&gt;
          &lt;ListBox 
               ItemsSource="{Binding Source={StaticResource xmlData}, XPath=entry}" 
               ScrollViewer.HorizontalScrollBarVisibility="Disabled"&gt;
              &lt;ListBox.ItemsPanel&gt;
                  &lt;ItemsPanelTemplate&gt;
                      &lt;StackPanel Orientation="Vertical"&gt;&lt;/StackPanel&gt;
                  &lt;/ItemsPanelTemplate&gt;
              &lt;/ListBox.ItemsPanel&gt;
              &lt;ListBox.ItemTemplate&gt;
                  &lt;DataTemplate&gt;
                      &lt;TextBlock Text="{Binding XPath=@text}" TextTrimming="CharacterEllipsis"/&gt;
                  &lt;/DataTemplate&gt;
              &lt;/ListBox.ItemTemplate&gt;
          &lt;/ListBox&gt;
      &lt;/Grid&gt;
  </code></pre>
  
  <p>But I need to set <code>StackPanel Orientation Horizontal</code>. When I'm setting Horizontal <code>TextBlock</code> text is not trimming.
  Any Ideas to solve this issue?</p>
  
  <p>Thanks Jamaxack!</p>