Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 6th, 2012  |  syntax: None  |  size: 1.58 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Separator line between items in ListBox
  2. <style type='text/css'>
  3. option { border-top: solid 1px gray; }
  4. </style>
  5.  
  6. ...
  7.  
  8. <asp:ListBox ...></asp:ListBox>
  9.        
  10. <style type='text/css'>
  11. select.table option { border-top: solid 1px gray; }
  12. </style>
  13.  
  14. ...
  15.  
  16. <asp:ListBox CssClass="table" ...></asp:ListBox>
  17.        
  18. <DataTemplate>
  19.                 <Border BorderThickness="0,10,0,10" BorderBrush="Black">
  20.                         <Grid Width="auto" HorizontalAlignment="Stretch" >
  21.                             <Grid.ColumnDefinitions>
  22.                                 <ColumnDefinition Width="auto" />
  23.                                 <ColumnDefinition Width="*" />
  24.                                 <ColumnDefinition Width="48" />
  25.                             </Grid.ColumnDefinitions>
  26.                             <TextBlock VerticalAlignment="Center" FontSize="36" FontWeight="Bold" Grid.Column="0" Foreground="Black" Text="{Binding Path=Title}" Name="title"/>
  27.                             <TextBlock VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Column="1" Foreground="Black" Text="{Binding Path=Location}" Name="location"/>
  28.                             <Image VerticalAlignment="Center" Grid.Column="2" Width="48" Height="48" Source="ApplicationIcon.jpg"/>
  29.                         </Grid>
  30.            </Border>
  31.                     </DataTemplate>
  32.        
  33. listBox1.Items.AddRange(new object[]
  34.     {
  35.         "Item 1, column 1",
  36.         "Item 2, column 1",
  37.         "Item 3, column 1",
  38.         "Item 4, column 1",
  39.         "Item 5, column 1",
  40.         "Item 1, column 2",
  41.         "Item 2, column 2",
  42.         "Item 3, column 2"
  43.    });