private void UpdateRecentColors(ColorItem colorItem) { if (!RecentColors.Contains(colorItem)) { RecentColors.Add(colorItem); } if (RecentColors.Count > 10) //don't allow more than ten, maybe make a property that can be set by the user. { RecentColors.RemoveAt(0); } }
private static ObservableCollection <ColorItem> CreateAvailableColors() { ObservableCollection <ColorItem> _standardColors = new ObservableCollection <ColorItem>(); foreach (var item in ColorUtilities.KnownColors) { if (!String.Equals(item.Key, "Transparent")) { var colorItem = new ColorItem(item.Value, item.Key); if (!_standardColors.Contains(colorItem)) { _standardColors.Add(colorItem); } } } return(_standardColors); }
private static ObservableCollection<ColorItem> CreateAvailableColors() { ObservableCollection<ColorItem> _standardColors = new ObservableCollection<ColorItem>(); foreach (var item in ColorUtilities.KnownColors) { if (!String.Equals(item.Key, "Transparent")) { var colorItem = new ColorItem(item.Value, item.Key); if (!_standardColors.Contains(colorItem)) _standardColors.Add(colorItem); } } return _standardColors; }
private void UpdateRecentColors(ColorItem colorItem) { if (!RecentColors.Contains(colorItem)) RecentColors.Add(colorItem); if (RecentColors.Count > 10) //don't allow more than ten, maybe make a property that can be set by the user. RecentColors.RemoveAt(0); }