wpf listbox row height

14,154

Should be very identical to the example you found which demonstrate the same but using 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>
Share:
14,154
JokerMartini
Author by

JokerMartini

I'm a CG Technical Artists for a visual effects company in Los Angeles, California. I started out as a CG Artist but quickly grew a strong interest in developing my programming skills. Over the years I have learned several programming languages and created several plugins and tools. I love to learn, collaborate, and share ideas with others. Feel free to check out my work at www.JokerMartini.com. You can also find my source code for various tools at github.com/jokermartini For any personal questions email me from using my contact information from my website.

Updated on June 06, 2022

Comments

  • JokerMartini
    JokerMartini almost 2 years

    I've created a listbox in wpf and I'm adding items to the listbox dynamically upon a button be clicked. I was wondering how I can set the overall height for each row in the listbox to a specific value?

    I've search around online and found this similar example but I'm not entirely sure how to integrate this solution into mine. Hopefully someone can help. Thank you guys.

    How to set WPF ListView row height?

    <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>