public void ShowCustomPicker()
        {
            try
            {
                if (!IsCustomPickerSupported.Value)
                {
                    return;
                }

                if (m_CustomPicker == null)
                {
                    m_CustomPicker = new Windows.UI.Xaml.Controls.ColorPicker();
                    CustomColorPickerContainer.Child = m_CustomPicker;
                }

                m_CustomPicker.Color = SelectedColor;

                UpdateFlyoutSize();

                FlyoutCustomPicker.ShowAt(this);
            }
            catch (Exception ex)
            {
                ExceptionHelper.OnHandledExceptionOccurred?.Invoke(ex);
            }
        }
Exemple #2
0
        /// <inheritdoc />
        protected override void OnApplyTemplate()
        {
            _canvasTextBoxTools            = (StackPanel)GetTemplateChild(CanvasTextBoxToolsName);
            this._canvasTextBoxColorPicker = (Windows.UI.Xaml.Controls.ColorPicker)GetTemplateChild(CanvasTextBoxColorPickerName);
            _canvasTextBoxFontSizeTextBox  = (TextBox)GetTemplateChild(CanvasTextBoxFontSizeTextBoxName);
            _canvasTextBoxItalicButton     = (ToggleButton)GetTemplateChild(CanvasTextBoxItalicButtonName);
            _canvasTextBoxBoldButton       = (ToggleButton)GetTemplateChild(CanvasTextBoxBoldButtonName);
            _drawingSurfaceRenderer        = (InfiniteCanvasVirtualDrawingSurface)GetTemplateChild(DrawingSurfaceRendererName);
            _mainContainer = (Canvas)GetTemplateChild(MainContainerName);
            _infiniteCanvasScrollViewer = (ScrollViewer)GetTemplateChild(InfiniteCanvasScrollViewerName);
            _eraseAllButton             = (Button)GetTemplateChild(EraseAllButtonName);
            _canvasTextBox           = (InfiniteCanvasTextBox)GetTemplateChild(CanvasTextBoxName);
            _enableTextButton        = (InkToolbarCustomToolButton)GetTemplateChild(EnableTextButtonName);
            _enableTouchInkingButton = (InkToolbarCustomToggleButton)GetTemplateChild(EnableTouchInkingButtonName);
            _inkCanvasToolBar        = (InkToolbar)GetTemplateChild(InkCanvasToolBarName);
            _canvasToolbarContainer  = (StackPanel)GetTemplateChild(CanvasToolbarContainerName);

            _inkCanvas     = (InkCanvas)GetTemplateChild(DrawingInkCanvasName);
            _undoButton    = (Button)GetTemplateChild(UndoButtonName);
            _redoButton    = (Button)GetTemplateChild(RedoButtonName);
            _fontColorIcon = (FontIcon)GetTemplateChild(FontColorIconName);

            UnRegisterEvents();
            RegisterEvents();

            ConfigureControls();

            if (double.IsNaN(_infiniteCanvasScrollViewer.Width))
            {
                if (ControlHelpers.IsXamlRootAvailable && _infiniteCanvasScrollViewer.XamlRoot != null)
                {
                    _infiniteCanvasScrollViewer.Width = _infiniteCanvasScrollViewer.XamlRoot.Size.Width;
                }
                else
                {
                    _infiniteCanvasScrollViewer.Width = Window.Current.Bounds.Width;
                }
            }

            if (double.IsNaN(_infiniteCanvasScrollViewer.Height))
            {
                if (ControlHelpers.IsXamlRootAvailable && _infiniteCanvasScrollViewer.XamlRoot != null)
                {
                    _infiniteCanvasScrollViewer.Height = _infiniteCanvasScrollViewer.XamlRoot.Size.Height;
                }
                else
                {
                    _infiniteCanvasScrollViewer.Height = Window.Current.Bounds.Height;
                }
            }

            base.OnApplyTemplate();
        }
        private void MyColorView_ChildChanged(object sender, EventArgs e)
        {
            if (MyColorView.Child is XamlIslands.ColorPicker colorPicker)
            {
                _colorPicker = colorPicker;

                _colorPicker.ColorSpectrumShape  = XamlIslands.ColorSpectrumShape.Box;
                _colorPicker.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Left;
                _colorPicker.VerticalAlignment   = Windows.UI.Xaml.VerticalAlignment.Center;
                _colorPicker.Margin        = new Windows.UI.Xaml.Thickness(10, 10, 10, 10);
                _colorPicker.ColorChanged += ColorPicker_ColorChanged;
            }
        }
        private void CanvasTextBoxColorPicker_ColorChanged(Windows.UI.Xaml.Controls.ColorPicker sender, ColorChangedEventArgs args)
        {
            if (SelectedTextDrawable != null)
            {
                _drawingSurfaceRenderer.ExecuteUpdateTextBoxColor(_canvasTextBoxColorPicker.Color);
                ReDrawCanvas();
            }

            if (_fontColorIcon != null)
            {
                _fontColorIcon.Foreground = new SolidColorBrush(_canvasTextBoxColorPicker.Color);
            }
        }
 private void ColorPicker_ColorChanged(XamlIslands.ColorPicker sender, XamlIslands.ColorChangedEventArgs args)
 {
     uwpColorPicker = Color.FromArgb(args.NewColor.A, args.NewColor.R, args.NewColor.G, args.NewColor.B);
 }
 private void ColourPicker_ColorChanged(Windows.UI.Xaml.Controls.ColorPicker sender, ColorChangedEventArgs args)
 {
     this.SelectedColour = sender.Color;
 }
 private void ColorPicker_ColorChanged(Windows.UI.Xaml.Controls.ColorPicker sender, ColorChangedEventArgs args)
 {
     SelectedColor = args.NewColor;
 }
Exemple #8
0
        private void ColorPicker_ColorChanged(Windows.UI.Xaml.Controls.ColorPicker sender, Windows.UI.Xaml.Controls.ColorChangedEventArgs args)
        {
            var cor = Color.FromArgb(args.NewColor.A, args.NewColor.R, args.NewColor.G, args.NewColor.B);

            RectExemplo.Fill = new SolidColorBrush(cor);
        }