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

  • Home
  • SEARCH
  • 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 381207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:03:47+00:00 2026-05-12T15:03:47+00:00

I have a listview with an itemtemplate: <ListView x:Name=messages HorizontalAlignment=Left Background={x:Null} BorderBrush={x:Null} Foreground=Black> <ListView.ItemTemplate>

  • 0

I have a listview with an itemtemplate:

<ListView x:Name="messages" HorizontalAlignment="Left" 
    Background="{x:Null}" BorderBrush="{x:Null}" Foreground="Black">
    <ListView.ItemTemplate>
        <DataTemplate>
            <TextBlock Style="{DynamicResource h3}" Text="{Binding}"
                Margin="10" MaxWidth="850"/>
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>

This listview is in a vertical stackpanel. So its width is the same as the stackpanel’s width.

The listview must show messages that could be very long. I’m trying to make sure that when a message is too long for the available width, the textblock gets extra height and the text gets displayed on 2 lines.

I can google a lot of ways to have this achieved with a fixed height, but since I don’t know in advance if I’ll need more than 1 line, I’d like to make sure it happens automaticly.
I don’t want every item to have the height of 2 lines, only when it’s needed.

How can I achieve this?

  • 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-12T15:03:48+00:00Added an answer on May 12, 2026 at 3:03 pm

    Have you tried the TextWrapping property? It seems that it would do what you want.

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

Sidebar

Related Questions

I have horizontal wpf listview <ListView Name=indexList ItemsSource={Binding} HorizontalAlignment=Stretch VerticalAlignment=Top BorderBrush=Transparent Background=CadetBlue Width=450> <ListView.ItemsPanel>
I have the following XAML: <ListView x:Name=debitOrderItems ItemsSource={Binding DebitOrderItems}> <ListView.ItemTemplate> <DataTemplate> <CheckBox x:Name=checkbox Content={Binding}
I have a textbox in a listview itemtemplate. I want to change the background
I have a ListView on my checkout page with an ItemTemplate which build up
I have a setup, something confusing like this: <ListView> <ItemTemplate> <div id=Content> <asp: TextBox
I have ListView that has the following EditItemTemplate: <EditItemTemplate> <tr style=> <td> <asp:LinkButton ID=UpdateButton
I have a ListView in my WPF UserControl using an ItemTemplate to display the
I have a listview which has an ItemTemplate and EditTemplate. When I switch an
I have a listview and a label in the ItemTemplate, i have set the
I have a ListView with an ItemTemplate item as below: <asp:Label runat=server ID=lblChangeOrders><%#Eval(sum)%></asp:Label> What

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.