Piotr X
Piotr X

Reputation: 127

Display the content in the ListView and the text is cut off

I display the content in the ListView and the text is cut off. It is impossible to move the horizontal scroll bar further, even though this text is longer. Do you have any idea how to solve this? Thank you very much.

   <Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="*"/>
        <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>
    <Grid Margin="20">
        <ListView x:Name="ProductDetails"
                 ItemsSource="{Binding ProductDetailsCollection}"
                 HorizontalContentAlignment="Stretch"
                 VerticalAlignment="Stretch"
                  />
    </Grid>

enter image description here

Upvotes: 1

Views: 1331

Answers (1)

Juan Carlos Rodriguez
Juan Carlos Rodriguez

Reputation: 784

To solve this problem you could create a new Style in your window like this:

<Style TargetType="ListViewItem">
     <Setter Property="HorizontalContentAlignment" Value="Stretch" />
     <Setter Property="HorizontalAlignment" Value="Stretch" />
     <Setter Property="Width" Value="Auto" />
</Style>

It should adjust the text and prevent the cut off.

If you already have a custom style for your ListView or your ListViewItem check you aren't overriding properties like the one I posted

Upvotes: 4

Related Questions