Exemplo n.º 1
0
        private void OnNewColorClicked(object sender, RoutedEventArgs args)
        {
            var button = (Button) sender;
            var colorList = (ColorItemList) button.DataContext;
            var cv = (CollectionView) CollectionViewSource.GetDefaultView(colorList);

            // add a new color based on the current one, then select the new one
            var newItem = new ColorItem((ColorItem) cv.CurrentItem);
            colorList.Add(newItem);
            cv.MoveCurrentTo(newItem);
        }
Exemplo n.º 2
0
        private void OnNewColorClicked(object sender, RoutedEventArgs args)
        {
            var button    = (Button)sender;
            var colorList = (ColorItemList)button.DataContext;
            var cv        = (CollectionView)CollectionViewSource.GetDefaultView(colorList);

            // add a new color based on the current one, then select the new one
            var newItem = new ColorItem((ColorItem)cv.CurrentItem);

            colorList.Add(newItem);
            cv.MoveCurrentTo(newItem);
        }
Exemplo n.º 3
0
 public ColorItem(ColorItem item)
 {
     Source      = Sources.UserDefined;
     _name       = "New Color";
     _red        = item._red;
     _green      = item._green;
     _blue       = item._blue;
     _hue        = item._hue;
     _saturation = item._saturation;
     _value      = item._value;
     _alpha      = item._alpha;
     Luminance   = item.Luminance;
     Brush       = new SolidColorBrush(item.Brush.Color);
 }
Exemplo n.º 4
0
 public ColorItem(ColorItem item)
 {
     Source = Sources.UserDefined;
     _name = "New Color";
     _red = item._red;
     _green = item._green;
     _blue = item._blue;
     _hue = item._hue;
     _saturation = item._saturation;
     _value = item._value;
     _alpha = item._alpha;
     Luminance = item.Luminance;
     Brush = new SolidColorBrush(item.Brush.Color);
 }