/// <summary> /// The initialize theme colors. /// </summary> private void InitializeThemeColors() { if (_themeColors != null) { return; } var list = PredefinedColor.AllThemeColors; _themeColors = new Dictionary <Color, PredefinedColorItem>(); int r = 0; int c = 0; foreach (var color in list) { var item = new PredefinedColorItem(color.Value, color.Name); item.SetValue(Grid.RowProperty, r); item.SetValue(Grid.ColumnProperty, c); // item.Style = themeColorsGrid.Resources["ThemeColorItemStyle"] as Style; _themeColorsGrid.Items.Add(item); if (!_themeColors.ContainsKey(color.Value)) { _themeColors.Add(color.Value, item); } if (r < 5) { r++; } else { r = 0; c++; } } }
/// <summary> /// The initialize theme colors. /// </summary> private void InitializeThemeColors() { if (_themeColors is not null) { return; } var list = PredefinedColor.AllThemeColors; _themeColors = new Dictionary <Color, PredefinedColorItem>(); var r = 0; var c = 0; foreach (var color in list) { var item = new PredefinedColorItem(color.Value, color.Name); item.SetValue(Grid.RowProperty, r); item.SetValue(Grid.ColumnProperty, c); _themeColorsListBox.Items.Add(item); if (!_themeColors.ContainsKey(color.Value)) { _themeColors.Add(color.Value, item); } if (r < 5) { r++; } else { r = 0; c++; } } }
/// <summary> /// The initialize theme colors. /// </summary> private void InitializeThemeColors() { if (_themeColors != null) { return; } List<PredefinedColor> list = PredefinedColor.AllThemeColors; _themeColors = new Dictionary<Color, PredefinedColorItem>(); int r = 0; int c = 0; foreach (PredefinedColor color in list) { var item = new PredefinedColorItem(color.Value, color.Name); item.SetValue(Grid.RowProperty, r); item.SetValue(Grid.ColumnProperty, c); // item.Style = themeColorsGrid.Resources["ThemeColorItemStyle"] as Style; _themeColorsGrid.Items.Add(item); if (!_themeColors.ContainsKey(color.Value)) { _themeColors.Add(color.Value, item); } if (r < 5) { r++; } else { r = 0; c++; } } }