Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. <ComboBox x:Name="comboBox1" Style="{StaticResource ComboBoxBlue}" HorizontalAlignment="Left" Margin="10,128,0,0" VerticalAlignment="Top" Width="75" />
  2.  
  3. public static List<string> MyItemSource = new List<string>()
  4. {
  5. "Item 1", "Item 2", "Item 3", "Item 4"
  6. };
  7.  
  8. comboBox1.ItemsSource = MyItemSource;
  9.  
  10. <!-- ComboBox Blue Item -->
  11. <Style TargetType="{x:Type ComboBoxItem}">
  12. <Setter Property="Foreground" Value="White" />
  13. <Setter Property="Background" Value="Blue" />
  14. <Setter Property="BorderBrush" Value="Blue" />
  15. </Style>
  16.  
  17. <Style x:Key="ComboBoxBlueItem" TargetType="{x:Type ComboBoxItem}">
  18.  
  19. <ComboBox.ItemContainerStyle>
  20. <Style TargetType="{x:Type ComboBoxItem}">
  21. <Setter Property="Background" Value="Blue" />
  22. </Style>
  23. </ComboBox.ItemContainerStyle>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement