Пример #1
0
        private void Root_ItemClick(object sender, ItemClickEventArgs e)
        {
            (ChangeColor.Children[0] as ColorAnimation).To = (e.ClickedItem as ColorGrid).Color.Color;
            var lightness = Palette.RGBtoL((e.ClickedItem as ColorGrid).Color.Color);

            (ChangeColor.Children[1] as ColorAnimation).To = lightness <= 127 ? Windows.UI.Colors.White : Windows.UI.Colors.Black;
            ChangeColor.Completed += (s, v) =>
            {
                this.Picked = (e.ClickedItem as ColorGrid).Color;
            };
            ChangeColor.Begin();
            this.OnColorPicked((e.ClickedItem as ColorGrid).Color.Color, false);
        }
Пример #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            (ChangeColor.Children[0] as ColorAnimation).To = (Color)App.Current.Resources["SystemAccentColor"];
            var lightness = Palette.RGBtoL((Color)App.Current.Resources["SystemAccentColor"]);

            (ChangeColor.Children[1] as ColorAnimation).To = lightness <= 127 ? Windows.UI.Colors.White : Windows.UI.Colors.Black;
            ChangeColor.Completed += (s, v) =>
            {
                this.Picked = new SolidColorBrush((Color)App.Current.Resources["SystemAccentColor"]);
            };
            ChangeColor.Begin();
            this.OnColorPicked((Color)App.Current.Resources["SystemAccentColor"], true);
        }