Wpf list line height

I created a list in wpf and I dynamically add items to the list by clicking a button. I was wondering how can I set the total height for each row in the list to a specific value?

I searched the web and found this similar example, but I'm not really sure how to integrate this solution into mine. Hope someone can help. Thank you guys.

How do I set the row height of a WPF ListView?

<Window x:Class="stadio.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Stadio" Height="350" Width="525" Background="#FF212121">
    <Grid>
        <ListBox x:Name="uiFileList" BorderThickness="0" Background="{x:Null}" Foreground="Gainsboro" Margin="6"/>

    </Grid>
</Window>

      

+3


source to share


1 answer


Should be very similar to the example you found that demonstrates the same thing, but using a listview. You only need to change ListView...

to ListBox...

:



<ListBox x:Name="uiFileList" BorderThickness="0" 
         Background="{x:Null}" Foreground="Gainsboro" 
         Margin="6">
    <ListBox.ItemContainerStyle>
        <Style TargetType="ListBoxItem">
            <Setter Property="Height" Value="50" />
        </Style>
    </ListBox.ItemContainerStyle>
</ListBox>

      

+9


source







All Articles