/// <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();
        }
예제 #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();
        }