Note that there are some explanatory texts on larger screens.

plurals
  1. POListbox Data Template Text Overflow
    primarykey
    data
    text
    <p>I am working on a data template for a list box. One of the data bound fields contains a long description and I don't know how to make sure that the text just wraps at the edge of the list box item. This is my xaml code...</p> <pre><code>&lt;ListBox x:Name="lstTest" ScrollViewer.HorizontalScrollBarVisibility="Disabled" HorizontalContentAlignment="Stretch"&gt; &lt;ListBox.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;StackPanel Orientation="Horizontal"&gt; &lt;StackPanel Orientation="Vertical"&gt; &lt;Label Content="{Binding Path=Name}"&gt;&lt;/Label&gt; &lt;TextBlock TextWrapping="Wrap" Text="{Binding Path=Description}"&gt;&lt;/TextBlock&gt; &lt;/StackPanel&gt; &lt;DockPanel LastChildFill="True"&gt; &lt;Label Content="{Binding Path=AuctionDate}"&gt;&lt;/Label&gt; &lt;/DockPanel&gt; &lt;/StackPanel&gt; &lt;/DataTemplate&gt; &lt;/ListBox.ItemTemplate&gt; &lt;/ListBox&gt; </code></pre> <p>Sample Item...</p> <pre><code>new AuctionItem { RecordId = 1, Name = "Auction G", Description = "Morbi eu nisl sed magna vestibulum ultrices quis eu enim. Nunc semper libero at tellus tincidunt eu elementum turpis rhoncus. Mauris condimentum semper pulvinar. Integer vel ante ipsum, at pulvinar sapien. Donec vestibulum ultricies dui sed viverra. Sed a augue diam, et mollis libero. Phasellus eget rutrum nibh.", AuctionDate = DateTime.Now } </code></pre> <p>What I am asking is this even the correct structure for what I am trying to achieve? I would like the date to be on the right side of the item. I would like the name to be at the top left and bellow the name I would like the description. I can make the description fixed size but I would like the listbox items to resize with the listbox correctly. </p> <p>I would appreciate any help you can provide with this...</p> <p>Thank You!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload