/// <inheritdoc />
        protected override void OnApplyTemplate()
        {
            _canvasTextBoxTools           = (StackPanel)GetTemplateChild("CanvasTextBoxTools");
            _canvasTextBoxColorPicker     = (ColorPicker)GetTemplateChild("CanvasTextBoxColorPicker");
            _canvasTextBoxFontSizeTextBox = (TextBox)GetTemplateChild("CanvasTextBoxFontSizeTextBox");
            _canvasTextBoxItlaicButton    = (ToggleButton)GetTemplateChild("CanvasTextBoxItlaicButton");
            _canvasTextBoxBoldButton      = (ToggleButton)GetTemplateChild("CanvasTextBoxBoldButton");
            _drawingSurfaceRenderer       = (InfiniteCanvasVirtualDrawingSurface)GetTemplateChild("DrawingSurfaceRenderer");
            _mainContainer = (Canvas)GetTemplateChild("MainContainer");
            _infiniteCanvasScrollViewer = (ScrollViewer)GetTemplateChild("InfiniteCanvasScrollViewer");
            _eraseAllButton             = (Button)GetTemplateChild("EraseAllButton");
            _canvasTextBox           = (InfiniteCanvasTextBox)GetTemplateChild("CanvasTextBox");
            _enableTextButton        = (InkToolbarCustomToolButton)GetTemplateChild("EnableTextButton");
            _enableTouchInkingButton = (InkToolbarCustomToggleButton)GetTemplateChild("EnableTouchInkingButton");
            _inkCanvasToolBar        = (InkToolbar)GetTemplateChild("InkCanvasToolBar");
            _canvasToolbarContainer  = (StackPanel)GetTemplateChild("CanvasToolbarContainer");

            _inkCanvas     = (InkCanvas)GetTemplateChild("DrawingInkCanvas");
            _undoButton    = (Button)GetTemplateChild("UndoButton");
            _redoButton    = (Button)GetTemplateChild("RedoButton");
            _fontColorIcon = (FontIcon)GetTemplateChild("FontColorIcon");

            UnRegisterEvents();
            RegisterEvents();

            ConfigureControls();
            base.OnApplyTemplate();
        }
Example #2
0
        internal static InkToolbarCustomToolButton BuildInkToolbarCustomToolButton(string label, IconElement icon)
        {
            var inkToolbarCustomToolButton = new InkToolbarCustomToolButton()
            {
                Content = icon
            };

            ToolTipService.SetToolTip(inkToolbarCustomToolButton, label);
            return(inkToolbarCustomToolButton);
        }
Example #3
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();
        }
Example #4
0
        public MainPage()
        {
            this.InitializeComponent();

            canvas.RenderTransform = new TranslateTransform();
            inkCanvas.InkPresenter.InputDeviceTypes =
                Windows.UI.Core.CoreInputDeviceTypes.Mouse |
                // Uncomment the line below if you want to draw with touch
                // When commented out, long touch to create comment
                // Windows.UI.Core.CoreInputDeviceTypes.Touch |
                Windows.UI.Core.CoreInputDeviceTypes.Pen;

            goalsInkCanvas.InkPresenter.InputDeviceTypes =
                Windows.UI.Core.CoreInputDeviceTypes.Mouse |
                // Uncomment the line below if you want to draw with touch
                // When commented out, long touch to create comment
                // Windows.UI.Core.CoreInputDeviceTypes.Touch |
                Windows.UI.Core.CoreInputDeviceTypes.Pen;

            comments   = new CommentModel();
            animations = new AnimationModel();

            inkCanvas.InkPresenter.StrokesErased += RemovedStrokes;

            //tool bar set up
            inkToolbar.Loading           += InitializeInkToolbar;
            inkToolbar.ActiveToolChanged += InkToolbar_ActiveToolChanged;

            //binding animations to front end view
            AnimationRepresentation.ItemsSource = animations.GetAnimations();

            //animation mode set up
            togglePath.Checked   += TogglePathChecked;
            togglePath.Unchecked += TogglePathUnchecked;
            Application.Current.Resources["AppBarToggleButtonBackgroundChecked"]            = (SolidColorBrush)this.Resources["animationBlockColor"];
            Application.Current.Resources["AppBarToggleButtonBackgroundCheckedPointerOver"] = (SolidColorBrush)this.Resources["animationBlockColor"];
            Application.Current.Resources["AppBarToggleButtonBackgroundCheckedPressed"]     = (SolidColorBrush)this.Resources["animationBlockColor"];

            // animation pen set up
            animationPen         = new InkToolbarCustomToolButton();
            animationPen.Content = new FontIcon
            {
                FontFamily = new FontFamily("Segoe MDL2 Assets"),
                Glyph      = "\uE735",
            };

            //comments set up
            SetUpStickyNotes();
            stickyColor = Colors.Goldenrod;
            toolButtonCommentGlyph.Foreground = new SolidColorBrush(stickyColor);
        }
 public LassoSelectionInkOption()
 {
     LassoSelectionButton = InkOptionHelper.BuildInkToolbarCustomToolButton(LassoSelectionLabel, "EF20");
 }