Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7410413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:13:52+00:00 2026-05-29T06:13:52+00:00

I am working on a data template for a list box. One of the

  • 0

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…

<ListBox x:Name="lstTest" ScrollViewer.HorizontalScrollBarVisibility="Disabled" HorizontalContentAlignment="Stretch">
    <ListBox.ItemTemplate>
        <DataTemplate>
            <StackPanel Orientation="Horizontal">
                <StackPanel Orientation="Vertical">
                    <Label Content="{Binding Path=Name}"></Label>
                    <TextBlock TextWrapping="Wrap"  Text="{Binding Path=Description}"></TextBlock>
                </StackPanel>
                <DockPanel LastChildFill="True">
                    <Label Content="{Binding Path=AuctionDate}"></Label>
                </DockPanel>
            </StackPanel>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>

Sample Item…

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
}

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.

I would appreciate any help you can provide with this…

Thank You!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T06:13:53+00:00Added an answer on May 29, 2026 at 6:13 am

    Your problem is with the StackPanel.

    Remove it and replace it with a grid. It’s been the source of grief for myself as well.

    I did something like to this to mimic your situation and it works for me:

    <Grid>
        <ListBox ScrollViewer.HorizontalScrollBarVisibility="Disabled">
           <ListBox.ItemTemplate>
              <DataTemplate>
                 <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <TextBlock Text="{Binding RecordID}" />
                    <TextBlock Grid.Column="1" Text="{Binding Description}" TextWrapping="Wrap" />
                    <TextBlock Grid.Colunm="2" Text="{Binding AuctionDate}" />
                 </Grid>
              </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    <Grid>
    

    See this answer. And this answer as well.

    Good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working with a data frame where one of the columns consists of
I try to make Ext.Data.Store working... With a normal proxy it works great: var
I have a ListBox data bound to an ObservableCollection<Employee> . It is working well.
I am working on a project and I want to have a list box
The following is the data I am working on: __DATA__ Node 1: 98 debug
im working with core-data for the first time, and my app is handling a
I'm working on a data distribution application which receives data from a source and
I'm working with XML data from an application where we get XML like this:
I'm working on a data model for SIP routing information. Let's take as example
I an a graduate student of nuclear physics currently working on a data analysis

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.