WinRTXamlToolkit.Controls.Extensions.CursorDisplayHandler.Attach C# (CSharp) Méthode

Attach() public méthode

Attaches to the specified framework element.
public Attach ( FrameworkElement frameworkElement ) : void
frameworkElement Windows.UI.Xaml.FrameworkElement The frameworkElement.
Résultat void
        public void Attach(FrameworkElement frameworkElement)
        {
            _control = frameworkElement;
            _control.PointerEntered += OnPointerEntered;
            _control.PointerExited += OnPointerExited;
            _control.Unloaded += OnControlUnloaded;
        }

Usage Example

        /// <summary>
        /// Handles changes to the Cursor property.
        /// </summary>
        /// <param name="d">
        /// The <see cref="DependencyObject"/> on which
        /// the property has changed value.
        /// </param>
        /// <param name="e">
        /// Event data that is issued by any event that
        /// tracks changes to the effective value of this property.
        /// </param>
        private static void OnCursorChanged(
            DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            CoreCursor oldCursor = (CoreCursor)e.OldValue;
            CoreCursor newCursor = (CoreCursor)d.GetValue(CursorProperty);

            if (oldCursor == null)
            {
                var handler = new CursorDisplayHandler();
                handler.Attach((Control)d);
                SetCursorDisplayHandler(d, handler);
            }
            else
            {
                var handler = GetCursorDisplayHandler(d);

                if (newCursor == null)
                {
                    handler.Detach();
                    SetCursorDisplayHandler(d, null);
                }
                else
                {
                    handler.UpdateCursor();
                }
            }
        }
All Usage Examples Of WinRTXamlToolkit.Controls.Extensions.CursorDisplayHandler::Attach