Search This Blog

Wednesday, January 6, 2016

ListBoxItem Example WPF

WPF > Controls  > ContentControl > ListBoxItem

ListBoxItem represents a selectable item in a ListBox.

Example




<Window x:Class="WpfApplication3.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <ListBox HorizontalAlignment="Left" Height="100" VerticalAlignment="Top" Width="100">
            <ListBoxItem Content="1"/>
            <ListBoxItem Content="2"/>
        </ListBox>
    </Grid>
</Window>