当前位置: 首页>>代码示例>>C#>>正文


C# TextBox.AddHandler方法代码示例

本文整理汇总了C#中Windows.UI.Xaml.Controls.TextBox.AddHandler方法的典型用法代码示例。如果您正苦于以下问题:C# TextBox.AddHandler方法的具体用法?C# TextBox.AddHandler怎么用?C# TextBox.AddHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Windows.UI.Xaml.Controls.TextBox的用法示例。


在下文中一共展示了TextBox.AddHandler方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnApplyTemplate

        protected override void OnApplyTemplate()
        {
            container = this.GetTemplateChild(ContainerName) as Grid;
            textBox = this.GetTemplateChild(TextBoxName) as TextBox;
            inkCanvas = this.GetTemplateChild(InkCanvasName) as InkCanvas;
            inkBorder = this.GetTemplateChild(InkBorderName) as Border;
            inkWindow = this.GetTemplateChild(InkWindowName) as Popup;

            inkRecognizerContainer = new InkRecognizerContainer();
            recognizers = inkRecognizerContainer.GetRecognizers();

            // Set the text services so we can query when language changes
            textServiceManager = CoreTextServicesManager.GetForCurrentView();
            textServiceManager.InputLanguageChanged += TextServiceManager_InputLanguageChanged;

            SetDefaultRecognizerByCurrentInputMethodLanguageTag();

            // Create a timer that expires after 1 second
            recognitionTimer = new DispatcherTimer();
            recognitionTimer.Interval = new TimeSpan(0, 0, 1);
            recognitionTimer.Tick += RecoTimer_Tick;

            pointerTimer = new DispatcherTimer();
            pointerTimer.Interval = new TimeSpan(0, 0, 2);
            pointerTimer.Tick += PointerTimer_Tick;

            textBox.PointerEntered += TextBox_PointerEntered;
            textBox.AddHandler(PointerPressedEvent, new PointerEventHandler(TextBox_PointerPressed), true);
            textBox.SelectionChanged += TextBox_SelectionChanged;

            inkCanvas.PointerEntered += InkCanvas_PointerEntered;
            inkCanvas.InkPresenter.StrokesCollected += InkCanvas_StrokesCollected;
            inkCanvas.InkPresenter.StrokeInput.StrokeStarted += InkCanvas_StrokeStarted;
            inkCanvas.InkPresenter.StrokesErased += InkPresenter_StrokesErased;
            
            // Initialize drawing attributes. These are used in inking mode.
            InkDrawingAttributes drawingAttributes = new InkDrawingAttributes();
            drawingAttributes.Color = InkColor;
            double penSize = PenSize;
            drawingAttributes.Size = new Windows.Foundation.Size(penSize, penSize);
            drawingAttributes.IgnorePressure = false;
            drawingAttributes.FitToCurve = true;

            // Initialize the InkCanvas
            inkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes);
            inkCanvas.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Pen;

            //InputPane inputPane = InputPane.GetForCurrentView();
            //inputPane.Showing += InputPane_Showing;

            this.SizeChanged += InkTextBox_SizeChanged;

            enableText();
            base.OnApplyTemplate();
        }
开发者ID:apulliam,项目名称:InkTextBox,代码行数:55,代码来源:InkTextBox.cs


注:本文中的Windows.UI.Xaml.Controls.TextBox.AddHandler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。