Пример #1
0
        private void ColorInfoShow_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                System.Windows.Media.Color Color16 = (ColorPanelShow.Fill as SolidColorBrush).Color;
                System.Windows.Media.Color Color32 = System.Windows.Media.Color.FromArgb(Color16.A, Color16.R, Color16.G, Color16.B);
                ColorSelected = Color32;

                CommandHelpers.InvokeCommandSource(ColorSelected, null, this, CommandOperation.Execute);
                PART_Popup.IsOpen = false;
            }
        }
Пример #2
0
        private void TransparentButton_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            Border targetBox = e.OriginalSource as Border;

            if (targetBox == null)
            {
                return;
            }

            System.Windows.Media.Color Color16 = (targetBox.Background as SolidColorBrush).Color;
            System.Windows.Media.Color Color32 = System.Windows.Media.Color.FromArgb(0, Color16.R, Color16.G, Color16.B);
            ColorSelected = Color32;

            CommandHelpers.InvokeCommandSource(ColorSelected, null, this, CommandOperation.Execute);
            PART_Popup.IsOpen = false;
        }
Пример #3
0
        private void InvokeCommand(StyleColor color)
        {
            dynamic dataCollection = DataCollection;

            if (dataCollection is System.Collections.IDictionary && dataCollection.ContainsKey(DataCollectionKey))
            {
                var spData = dataCollection[DataCollectionKey];
                if (spData != null)
                {
                    if (DataCollectionKey == "Font Color")
                    {
                        spData.CommandParameter = color.ToBrush();
                    }
                    else
                    {
                        spData.CommandParameter = color;
                    }
                }
            }

            CommandHelpers.InvokeCommandSource(color, null, this, CommandOperation.Execute);
        }
Пример #4
0
        private void ColorExample_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            if (OpacitySlider == null)
            {
                return;
            }
            Border targetBox = e.OriginalSource as Border;

            if (targetBox == null)
            {
                return;
            }

            System.Windows.Media.Color Color16 = (targetBox.Background as SolidColorBrush).Color;
            Byte A = Convert.ToByte(OpacitySlider.Value * 255 / 100);

            System.Windows.Media.Color Color32 = System.Windows.Media.Color.FromArgb(A, Color16.R, Color16.G, Color16.B);
            ColorSelected = Color32;

            CommandHelpers.InvokeCommandSource(ColorSelected, null, this, CommandOperation.Execute);
            PART_Popup.IsOpen = false;
        }