Using a ListBoxItem as a ContentControl : ListBoxItem « UI Controls « Silverlight






Using a ListBoxItem as a ContentControl

Using a ListBoxItem as a ContentControl
   

<UserControl x:Class='SilverlightApplication3.MainPage'
    xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' 
    xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
    xmlns:d='http://schemas.microsoft.com/expression/blend/2008' 
    xmlns:mc='http://schemas.openxmlformats.org/markup-compatibility/2006' 
    mc:Ignorable='d' 
    d:DesignWidth='640' d:DesignHeight='480'>
    <Grid x:Name="LayoutRoot" Background="White">
        <ListBox x:Name="myListBox" Margin="10">
            <ListBox.Items>
                <ListBoxItem>
                    <StackPanel Height="80" Orientation="Horizontal">
                        <Canvas Width="87" Height="77">
                            <Image Source="http://server.com/month.png" />
                            <TextBlock Width="77" TextAlignment="Center" FontFamily="Arial" FontWeight="Bold" FontSize="32" Padding="30" Text="1" />
                        </Canvas>
                        <TextBlock FontFamily="Arial" FontWeight="Bold" FontSize="44" Padding="20">Sunday</TextBlock>
                    </StackPanel>
                </ListBoxItem>
                <ListBoxItem>
                    <StackPanel Height="80" Orientation="Horizontal">
                        <Canvas Width="87" Height="77">
                            <Image Source="http://server.com/month.png" />
                            <TextBlock Width="77" TextAlignment="Center" FontFamily="Arial" FontWeight="Bold" FontSize="32" Padding="30" Text="2" />
                        </Canvas>
                        <TextBlock FontFamily="Arial" FontWeight="Bold" FontSize="44" Padding="20">Monday</TextBlock>
                    </StackPanel>
                </ListBoxItem>
                <ListBoxItem>
                    <StackPanel Height="80" Orientation="Horizontal">
                        <Canvas Width="87" Height="77">
                            <Image Source="http://server.com/month.png" />
                            <TextBlock Width="77" TextAlignment="Center" FontFamily="Arial" FontWeight="Bold" FontSize="32" Padding="30" Text="3" />
                        </Canvas>
                        <TextBlock FontFamily="Arial" FontWeight="Bold" FontSize="44" Padding="20">Tuesday</TextBlock>
                    </StackPanel>
                </ListBoxItem>
                <ListBoxItem>
                    <StackPanel Height="80" Orientation="Horizontal">
                        <Canvas Width="87" Height="77">
                            <Image Source="http://server.com/month.png" />
                            <TextBlock Width="77" TextAlignment="Center" FontFamily="Arial" FontWeight="Bold" FontSize="32" Padding="30" Text="4" />
                        </Canvas>
                        <TextBlock FontFamily="Arial" FontWeight="Bold" FontSize="44" Padding="20">Wednesday</TextBlock>
                    </StackPanel>
                </ListBoxItem>
            </ListBox.Items>
        </ListBox>
    </Grid>
</UserControl>

   
    
    
  








Related examples in the same category

1.Customizing the Default ListBoxItem UICustomizing the Default ListBoxItem UI
2.ListBoxItem styleListBoxItem style
3.Using an ItemsPresenterto display the Itemsof an ItemsControlUsing an ItemsPresenterto display the Itemsof an ItemsControl
4.Declaring the ItemsPanel to arrange the Items of an ItemsControlDeclaring the ItemsPanel to arrange the Items of an ItemsControl