TxtblkRGBNumbers.Background = new SolidColorBrush(Color.FromRgb((cb.SelectedItem as ColorInfo).Color.R, change the background of the second row (second TextBox) Private void CboboxColors_SelectionChanged(object sender, SelectionChangedEventArgs e) orderby ((Color)property.GetValue(null, null)).ToString() Var color_query = from PropertyInfo property in typeof(Colors).GetProperties() Private void Window_Loaded(object sender, RoutedEventArgs e) Of the title with the drop-down selector. The color index is stored in a SQLite database with Dapper. What’s next? We have a follow-up post called WPF ComboBox Colors with SQLite that takes his example project and adds a SQLite database that remembers the color you picked even if you close the program and open it again. We have a very similar program here that uses a ListBox instead of a ComboBox. We use Reflection to get the list of system colors and load the list upon the Window_Loaded event. The great thing about this approach is that we don’t need to manually add all these colors. This post is loosely based on some code over at C# Helper. The user can pick a color from the list and set the background, similar to how they might do to set preferences or options. It is a “color picker”, or a “color viewer”. This post is a sample program of a ComboBox that lists all of the WPF system colors.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |