/// <summary> /// Provides all of the known points the device hit since the last reported position update. /// </summary> /// <param name="relativeTo">Defines the coordinate space.</param> /// <returns>A list of points in the coordinate space of relativeTo.</returns> public override TouchPointCollection GetIntermediateTouchPoints(IInputElement relativeTo) { // Retrieve the stylus points StylusPointCollection stylusPoints = StylusDevice.GetStylusPoints(relativeTo, _stylusPointDescription); int count = stylusPoints.Count; TouchPointCollection touchPoints = new TouchPointCollection(); GeneralTransform elementToRoot; GeneralTransform rootToElement; GetRootTransforms(relativeTo, out elementToRoot, out rootToElement); // Convert the stylus points into touch points for (int i = 0; i < count; i++) { StylusPoint stylusPoint = stylusPoints[i]; Point position = new Point(stylusPoint.X, stylusPoint.Y); Rect rectBounds = GetBounds(stylusPoint, position, relativeTo, elementToRoot, rootToElement); TouchPoint touchPoint = new TouchPoint(this, position, rectBounds, _lastAction); touchPoints.Add(touchPoint); } return(touchPoints); }
///////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the StylusEventArgs class. /// </summary> /// <param name="stylus"> /// The logical Stylus device associated with this event. /// </param> /// <param name="timestamp"> /// The time when the input occured. /// </param> public StylusEventArgs(StylusDevice stylus, int timestamp) : base(stylus, timestamp) { if (stylus == null) { throw new System.ArgumentNullException("stylus"); } }
internal StylusDevice UpdateStylusDevices(int stylusId) { // REENTRANCY NOTE: Use PenThread to talk to wisptis.exe to make sure we are not reentrant! // PenImc will cache all the stylus device info so we don't have // any Out of Proc calls to wisptis.exe to get this info. StylusDeviceInfo[] stylusDevicesInfo = _penThread.WorkerRefreshCursorInfo(_tabletInfo.PimcTablet.Value); int cCursors = stylusDevicesInfo.Length; if (cCursors > StylusDevices.Count) { for (int iCursor = 0; iCursor < cCursors; iCursor++) { StylusDeviceInfo stylusDeviceInfo = stylusDevicesInfo[iCursor]; // See if we found it. If so go and create the new StylusDevice and add it. if (stylusDeviceInfo.CursorId == stylusId) { StylusDevice newStylusDevice = new StylusDevice( this, stylusDeviceInfo.CursorName, stylusDeviceInfo.CursorId, stylusDeviceInfo.CursorInverted, stylusDeviceInfo.ButtonCollection); StylusDevices.AddStylusDevice(iCursor, newStylusDevice); return(newStylusDevice); } } } return(null); // Nothing to add }
internal TabletDevice(TabletDeviceInfo tabletInfo, PenThread penThread) { _tabletInfo = tabletInfo; _penThread = penThread; int count = tabletInfo.StylusDevicesInfo.Length; StylusDevice[] styluses = new StylusDevice[count]; for (int i = 0; i < count; i++) { StylusDeviceInfo cursorInfo = tabletInfo.StylusDevicesInfo[i]; styluses[i] = new StylusDevice( this, cursorInfo.CursorName, cursorInfo.CursorId, cursorInfo.CursorInverted, cursorInfo.ButtonCollection); } _stylusDeviceCollection = new StylusDeviceCollection(styluses); if (_tabletInfo.DeviceType == TabletDeviceType.Touch) { // _multiTouchSystemGestureLogic = new MultiTouchSystemGestureLogic(); } }
internal TabletDevice(TabletDeviceInfo tabletInfo, PenThread penThread) { _tabletInfo = tabletInfo; _penThread = penThread; int count = tabletInfo.StylusDevicesInfo.Length; StylusDevice[] styluses = new StylusDevice[count]; for ( int i = 0; i < count; i++ ) { StylusDeviceInfo cursorInfo = tabletInfo.StylusDevicesInfo[i]; styluses[i] = new StylusDevice( this, cursorInfo.CursorName, cursorInfo.CursorId, cursorInfo.CursorInverted, cursorInfo.ButtonCollection); } _stylusDeviceCollection = new StylusDeviceCollection(styluses); if (_tabletInfo.DeviceType == TabletDeviceType.Touch) { // _multiTouchSystemGestureLogic = new MultiTouchSystemGestureLogic(); } }
///////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the StylusEventArgs class. /// </summary> /// <param name="stylus"> /// The logical Stylus device associated with this event. /// </param> /// <param name="timestamp"> /// The time when the input occured. /// </param> public StylusEventArgs(StylusDevice stylus, int timestamp) : base(stylus, timestamp) { if( stylus == null ) { throw new System.ArgumentNullException("stylus"); } }
internal StylusTouchDevice(StylusDevice stylusDevice) : base(stylusDevice.Id) { _stylusDevice = stylusDevice; _stylusLogic = InputManager.UnsecureCurrent.StylusLogic; PromotingToOther = true; }
/// <summary> /// Initializes a new instance of the MouseEventArgs class. /// </summary> /// <param name="mouse"> /// The logical Mouse device associated with this event. /// </param> /// <param name="timestamp"> /// The time when the input occurred. /// </param> /// <param name="stylusDevice"> /// The stylus device that was involved with this event. /// </param> public MouseEventArgs(MouseDevice mouse, int timestamp, StylusDevice stylusDevice) : base(mouse, timestamp) { if (mouse == null) { throw new System.ArgumentNullException("mouse"); } _stylusDevice = stylusDevice; }
/// <summary> /// Initializes a new instance of the MouseEventArgs class. /// </summary> /// <param name="mouse"> /// The logical Mouse device associated with this event. /// </param> /// <param name="timestamp"> /// The time when the input occured. /// </param> /// <param name="stylusDevice"> /// The stylus device that was involved with this event. /// </param> public MouseEventArgs(MouseDevice mouse, int timestamp, StylusDevice stylusDevice) : base(mouse, timestamp) { if( mouse == null ) { throw new System.ArgumentNullException("mouse"); } _stylusDevice = stylusDevice; }
/// <summary> /// Provides the current position. /// </summary> /// <param name="relativeTo">Defines the coordinate space.</param> /// <returns>The current position in the coordinate space of relativeTo.</returns> public override TouchPoint GetTouchPoint(IInputElement relativeTo) { Point position = StylusDevice.GetPosition(relativeTo); Rect rectBounds = GetBounds(StylusDevice.RawStylusPoint, position, relativeTo); return(new TouchPoint(this, position, rectBounds, _lastAction)); }
/// <summary> /// Forces the sytlus to resynchronize. /// </summary> public static void Synchronize() { StylusDevice curDevice = Stylus.CurrentStylusDevice; if (null != curDevice) { curDevice.Synchronize(); } }
///////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the StylusButtonEventArgs class. /// </summary> /// <param name="stylusDevice"> /// The logical Stylus device associated with this event. /// </param> /// <param name="timestamp"> /// The time when the input occured. /// </param> /// <param name="button"> /// The button. /// </param> public StylusButtonEventArgs( StylusDevice stylusDevice, int timestamp, StylusButton button) : base(stylusDevice, timestamp) { // ISSUE_XiaoTu: Do we need any validation here? _button = button; }
/// <summary> /// Initializes a new instance of the MouseButtonEventArgs class. /// </summary> /// <param name="mouse"> /// The logical Mouse device associated with this event. /// </param> /// <param name="timestamp"> /// The time when the input occured. /// </param> /// <param name="button"> /// The Mouse button whose state is being described. /// </param> /// <param name="stylusDevice"> /// The stylus device that was involved with this event. /// </param> public MouseButtonEventArgs(MouseDevice mouse, int timestamp, MouseButton button, StylusDevice stylusDevice) : base(mouse, timestamp, stylusDevice) { MouseButtonUtilities.Validate(button); _button = button; _count = 1; }
///////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the StylusSystemGestureEventArgs class. /// </summary> /// <param name="stylusDevice"> /// The logical Stylus device associated with this event. /// </param> /// <param name="timestamp"> /// The time when the input occured. /// </param> /// <param name="systemGesture"> /// The type of system gesture. /// </param> public StylusSystemGestureEventArgs( StylusDevice stylusDevice, int timestamp, SystemGesture systemGesture) : base(stylusDevice, timestamp) { if (!RawStylusSystemGestureInputReport.IsValidSystemGesture(systemGesture, false, false)) { throw new InvalidEnumArgumentException(SR.Get(SRID.Enum_Invalid, "systemGesture")); } _id = systemGesture; }
internal StylusTouchDevice(StylusDevice stylusDevice) : base(stylusDevice.Id) { _stylusDevice = stylusDevice; // DevDiv:652804 // This used to be statically defined, but this gave rise to issues with // calling GetIntermediateTouchPoints as the properties were likely to not // match the hardware. Now, we set this from the actual tablet queried // description so we can be assured they match save for when there is an // actual erroneous situation. _stylusPointDescription = _stylusDevice?.TabletDevice?.StylusPointDescription ?? _stylusPointDescription; _stylusLogic = InputManager.UnsecureCurrent.StylusLogic; PromotingToOther = true; }
///////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the StylusSystemGestureEventArgs class. /// </summary> /// <param name="stylusDevice"> /// The logical Stylus device associated with this event. /// </param> /// <param name="timestamp"> /// The time when the input occured. /// </param> /// <param name="systemGesture"> /// The type of system gesture. /// </param> /// <param name="gestureX"> /// The X location reported with this system gesture. In tablet /// device coordinates. /// </param> /// <param name="gestureY"> /// The Y location reported with this system gesture. In tablet /// device coordinates. /// </param> /// <param name="buttonState"> /// The button state at the time of the system gesture. /// Note: A flick gesture will pass the flick data in the parameter. /// </param> internal StylusSystemGestureEventArgs( StylusDevice stylusDevice, int timestamp, SystemGesture systemGesture, int gestureX, int gestureY, int buttonState) : base(stylusDevice, timestamp) { if (!RawStylusSystemGestureInputReport.IsValidSystemGesture(systemGesture, true, false)) { throw new InvalidEnumArgumentException(SR.Get(SRID.Enum_Invalid, "systemGesture")); } _id = systemGesture; _buttonState = buttonState; _gestureX = gestureX; _gestureY = gestureY; }
/// <summary> /// Create a wrapper. /// </summary> protected StylusDeviceBase() { StylusDevice = new StylusDevice(this); }
public MouseEventArgs(MouseDevice mouse, int timestamp, StylusDevice stylusDevice) : base(default(InputDevice), default(int)) { }
///////////////////////////////////////////////////////////////////// // Updates the currently active stylus device and makes sure the StylusOver // property is updated as needed. internal void SelectStylusDevice(StylusDevice stylusDevice, IInputElement newOver, bool updateOver) { bool stylusDeviceChange = (_currentStylusDevice != stylusDevice); StylusDevice oldStylusDevice = _currentStylusDevice; // If current StylusDevice is becoming null, make sure we update the over state // before we update _currentStylusDevice or else the over property will not update // correctly! #if !MULTICAPTURE if (updateOver && stylusDevice == null && stylusDeviceChange) #else if (updateOver && stylusDevice == null && stylusDeviceChange && newOver == null) #endif { // This will cause UpdateOverProperty() to be called. _currentStylusDevice.ChangeStylusOver(newOver); // This should be null. } _currentStylusDevice = stylusDevice; if (updateOver && stylusDevice != null) { // This will cause StylusLogic.UpdateStylusOverProperty to unconditionally be called. stylusDevice.ChangeStylusOver(newOver); // If changing the current stylusdevice make sure that the old one's // over state is set to null if it is not InRange anymore. // NOTE: We only want to do this if we have multiple stylusdevices InRange! if (stylusDeviceChange && oldStylusDevice != null) { if (!oldStylusDevice.InRange) { oldStylusDevice.ChangeStylusOver(null); } } } }
public StylusButtonEventArgs(StylusDevice stylusDevice, int timestamp, StylusButton button) : base(stylusDevice, timestamp) { }
public MouseButtonEventArgs (MouseDevice mouse, int timestamp, MouseButton button, StylusDevice stylusDevice) : base (mouse, timestamp, stylusDevice) { }
internal bool IsSameSpot(Point newPosition, StylusDevice stylusDevice) { int doubleClickDeltaX = (stylusDevice != null)?stylusDevice.DoubleTapDeltaX:_doubleClickDeltaX; int doubleClickDeltaY = (stylusDevice != null)?stylusDevice.DoubleTapDeltaY:_doubleClickDeltaY; // Is the delta coordinates of this click close enough to the last click? return (Math.Abs(newPosition.X - _lastClick.X) < doubleClickDeltaX) && (Math.Abs(newPosition.Y - _lastClick.Y) < doubleClickDeltaY); }
internal StylusDevice UpdateStylusDevices(int stylusId) { // REENTRANCY NOTE: Use PenThread to talk to wisptis.exe to make sure we are not reentrant! // PenImc will cache all the stylus device info so we don't have // any Out of Proc calls to wisptis.exe to get this info. StylusDeviceInfo[] stylusDevicesInfo = _penThread.WorkerRefreshCursorInfo(_tabletInfo.PimcTablet.Value); int cCursors = stylusDevicesInfo.Length; if (cCursors > StylusDevices.Count) { for (int iCursor = 0; iCursor < cCursors; iCursor++) { StylusDeviceInfo stylusDeviceInfo = stylusDevicesInfo[iCursor]; // See if we found it. If so go and create the new StylusDevice and add it. if ( stylusDeviceInfo.CursorId == stylusId ) { StylusDevice newStylusDevice = new StylusDevice( this, stylusDeviceInfo.CursorName, stylusDeviceInfo.CursorId, stylusDeviceInfo.CursorInverted, stylusDeviceInfo.ButtonCollection); StylusDevices.AddStylusDevice(iCursor, newStylusDevice); return newStylusDevice; } } } return null; // Nothing to add }
public QueryCursorEventArgs(MouseDevice mouse, int timestamp, StylusDevice stylusDevice) : base (default(MouseDevice), default(int)) { }
public StylusSystemGestureEventArgs(StylusDevice stylusDevice, int timestamp, SystemGesture systemGesture) : base(stylusDevice, timestamp) { }
public StylusDownEventArgs(StylusDevice stylusDevice, int timestamp) : base(default(StylusDevice), default(int)) { }
public StylusButtonEventArgs(StylusDevice stylusDevice, int timestamp, StylusButton button) : base(default(StylusDevice), default(int)) { }
///////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the StylusDownEventArgs class. /// </summary> /// <param name="stylusDevice"> /// The logical Stylus device associated with this event. /// </param> /// <param name="timestamp"> /// The time when the input occured. /// </param> public StylusDownEventArgs( StylusDevice stylusDevice, int timestamp) : base(stylusDevice, timestamp) { }
internal int CalculateClickCount(MouseButton button, int timeStamp, StylusDevice stylusDevice, Point downPt) { // How long since the last click? int timeSpan = timeStamp - _lastClickTime; int doubleClickDeltaTime = (stylusDevice != null)?stylusDevice.DoubleTapDeltaTime:_doubleClickDeltaTime; // Is the delta coordinates of this click close enough to the last click? bool isSameSpot = IsSameSpot(downPt, stylusDevice); // Is this the same mouse button as the last click? bool isSameButton = (_lastButton == button); // Now check everything to see if this is a multi-click. if (timeSpan < doubleClickDeltaTime && isSameSpot && isSameButton) { // Yes, increment the count return _clickCount +1; } else { // No, not a multi-click. return 1; } }
public StylusEventArgs(StylusDevice stylus, int timestamp) : base (default(InputDevice), default(int)) { }
public StylusSystemGestureEventArgs(StylusDevice stylusDevice, int timestamp, SystemGesture systemGesture) : base(default(StylusDevice), default(int)) { }
public QueryCursorEventArgs (MouseDevice mouse, int timestamp, StylusDevice stylusDevice) : base (mouse, timestamp) { }
///////////////////////////////////////////////////////////////////// internal void UnregisterStylusDeviceCore(StylusDevice stylusDevice) { lock (__stylusDeviceLock) { Debug.Assert(__stylusDeviceMap.ContainsKey(stylusDevice.Id)); __stylusDeviceMap.Remove(stylusDevice.Id); } }
public StylusEventArgs (StylusDevice stylus, int timestamp) : base (stylus, timestamp) { throw new NotImplementedException (); }
public MouseEventArgs(MouseDevice mouse, int timestamp, StylusDevice stylusDevice) : base(mouse, timestamp) { this.stylusDevice = stylusDevice; }
public MouseButtonEventArgs(MouseDevice mouse, int timestamp, MouseButton button, StylusDevice stylusDevice) : base(mouse, timestamp, stylusDevice) { }
public StylusSystemGestureEventArgs(StylusDevice stylusDevice, int timestamp, SystemGesture systemGesture) : base (default(StylusDevice), default(int)) { }
private void ProcessMouseMove(StylusDevice stylusDevice, int timestamp, bool isSynchronize) { System.Diagnostics.Debug.Assert(stylusDevice != null); if (!ShouldPromoteToMouse(stylusDevice) || !stylusDevice.TouchDevice.PromotingToOther) { return; } PresentationSource mouseInputSource = stylusDevice.GetMousePresentationSource(); if (mouseInputSource != null) { RawMouseActions actions = RawMouseActions.AbsoluteMove; // Don't set Activate flag if a synchronize is requested! if (!isSynchronize) { if (_inputManager.Value.PrimaryMouseDevice.CriticalActiveSource != mouseInputSource) { actions |= RawMouseActions.Activate; } } Point pt = stylusDevice.LastMouseScreenPoint; // Use last promoted mouse location. pt = PointUtil.ScreenToClient(pt, mouseInputSource); RawMouseInputReport mouseInputReport = new RawMouseInputReport(InputMode.Foreground, timestamp, mouseInputSource, actions, (int)pt.X, (int)pt.Y, 0, IntPtr.Zero); if (isSynchronize) { mouseInputReport._isSynchronize = true; } _lastRawMouseAction = actions; InputReportEventArgs inputReportArgs = new InputReportEventArgs(stylusDevice, mouseInputReport); inputReportArgs.RoutedEvent = InputManager.PreviewInputReportEvent; // Process this directly instead of doing a push. We want this event to get // to the user before the StylusUp and MouseUp event. InputManagerProcessInputEventArgs(inputReportArgs); } }
///////////////////////////////////////////////////////////////////// /// <summary> /// Reset will stop the current strokes being dynamically rendered /// and start a new stroke with the packets passed in. Specified StylusDevice /// must be in down position when calling this method. /// Only call from application dispatcher. /// </summary> /// <param name="stylusDevice"></param> /// <param name="stylusPoints"></param> public virtual void Reset(StylusDevice stylusDevice, StylusPointCollection stylusPoints) { // NOTE: stylusDevice == null means the mouse device. // Nothing to do if root visual not queried or not hookup up to element yet. if (_mainContainerVisual == null || _applicationDispatcher == null || !IsActiveForInput) return; // Ensure on UIContext. _applicationDispatcher.VerifyAccess(); // Make sure the stylusdevice specified (or mouse if null stylusdevice) is currently in // down state! bool inAir = (stylusDevice != null) ? stylusDevice.InAir : Mouse.PrimaryDevice.LeftButton == MouseButtonState.Released; if (inAir) { throw new ArgumentException(SR.Get(SRID.Stylus_MustBeDownToCallReset), "stylusDevice"); } // Avoid reentrancy due to lock() call. using(_applicationDispatcher.DisableProcessing()) { lock(__siLock) { AbortAllStrokes(); // stop any current inking strokes // Now create new si and insert it in the list. StrokeInfo si = new StrokeInfo(DrawingAttributes, (stylusDevice != null) ? stylusDevice.Id : 0, Environment.TickCount, GetCurrentHostVisual()); _strokeInfoList.Add(si); si.IsReset = true; if (stylusPoints != null) { RenderPackets(stylusPoints, si); // do this inside of lock to make sure this renders first. } } } }
public MouseEventArgs(MouseDevice mouse, int timestamp, StylusDevice stylusDevice) : base (default(InputDevice), default(int)) { }
public StylusPointCollection GetStylusPoints(IInputElement relativeTo, StylusPointDescription subsetToReformatTo) { return(StylusDevice.GetStylusPoints(relativeTo, subsetToReformatTo)); }
public MouseButtonEventArgs(MouseDevice mouse, int timestamp, MouseButton button, StylusDevice stylusDevice) : base (default(MouseDevice), default(int)) { }
public StylusPointCollection GetStylusPoints(IInputElement relativeTo) { return(StylusDevice.GetStylusPoints(relativeTo)); }
public StylusDownEventArgs(StylusDevice stylusDevice, int timestamp) : base (default(StylusDevice), default(int)) { }
public MouseEventArgs (MouseDevice mouse, int timestamp, StylusDevice stylusDevice) : base (mouse, timestamp) { this.stylusDevice = stylusDevice; }
public QueryCursorEventArgs(MouseDevice mouse, int timestamp, StylusDevice stylusDevice) : base(default(MouseDevice), default(int)) { }
///////////////////////////////////////////////////////////////////// internal void RegisterStylusDeviceCore(StylusDevice stylusDevice) { lock (__stylusDeviceLock) { int stylusDeviceId = stylusDevice.Id; // The map must contain unique entries for each stylus device. if (__stylusDeviceMap.ContainsKey(stylusDeviceId)) { InvalidOperationException ioe = new InvalidOperationException(); // We add a tag here so we can check for this specific exception // in TabletCollection when adding new tablet devices. ioe.Data.Add("System.Windows.Input.StylusLogic", ""); throw(ioe); } __stylusDeviceMap[stylusDeviceId] = stylusDevice; } }
///////////////////////////////////////////////////////////////////// /// internal void SetOwner(StylusDevice stylusDevice) { _stylusDevice = stylusDevice; }
public StylusSystemGestureEventArgs (StylusDevice stylusDevice, int timestamp, SystemGesture systemGesture) : base (stylusDevice, timestamp) { }
public StylusEventArgs(StylusDevice stylus, int timestamp) : base(stylus, timestamp) { throw new NotImplementedException(); }
public StylusEventArgs(StylusDevice stylus, int timestamp) : base(default(InputDevice), default(int)) { }
public Point GetPosition(IInputElement relativeTo) { return(StylusDevice.GetPosition(relativeTo)); }
public QueryCursorEventArgs(MouseDevice mouse, int timestamp, StylusDevice stylusDevice) : base(mouse, timestamp) { }
internal void UpdateOverProperty(StylusDevice stylusDevice, IInputElement newOver) { // Only update the OverProperty for the current stylus device and only if we see a change. if (stylusDevice == _currentStylusDevice && newOver != _stylusOver) { DependencyObject o = null; IInputElement oldOver = _stylusOver; _stylusOver = newOver; // Adjust the handlers we use to track everything. if (oldOver != null) { o = oldOver as DependencyObject; if (InputElement.IsUIElement(o)) { ((UIElement)o).IsEnabledChanged -= _overIsEnabledChangedEventHandler; ((UIElement)o).IsVisibleChanged -= _overIsVisibleChangedEventHandler; ((UIElement)o).IsHitTestVisibleChanged -= _overIsHitTestVisibleChangedEventHandler; } else if (InputElement.IsContentElement(o)) { ((ContentElement)o).IsEnabledChanged -= _overIsEnabledChangedEventHandler; // NOTE: there are no IsVisible or IsHitTestVisible properties for ContentElements. // // ((ContentElement)o).IsVisibleChanged -= _overIsVisibleChangedEventHandler; // ((ContentElement)o).IsHitTestVisibleChanged -= _overIsHitTestVisibleChangedEventHandler; } else { ((UIElement3D)o).IsEnabledChanged -= _overIsEnabledChangedEventHandler; ((UIElement3D)o).IsVisibleChanged -= _overIsVisibleChangedEventHandler; ((UIElement3D)o).IsHitTestVisibleChanged -= _overIsHitTestVisibleChangedEventHandler; } } if (_stylusOver != null) { o = _stylusOver as DependencyObject; if (InputElement.IsUIElement(o)) { ((UIElement)o).IsEnabledChanged += _overIsEnabledChangedEventHandler; ((UIElement)o).IsVisibleChanged += _overIsVisibleChangedEventHandler; ((UIElement)o).IsHitTestVisibleChanged += _overIsHitTestVisibleChangedEventHandler; } else if (InputElement.IsContentElement(o)) { ((ContentElement)o).IsEnabledChanged += _overIsEnabledChangedEventHandler; // NOTE: there are no IsVisible or IsHitTestVisible properties for ContentElements. // // ((ContentElement)o).IsVisibleChanged += _overIsVisibleChangedEventHandler; // ((ContentElement)o).IsHitTestVisibleChanged += _overIsHitTestVisibleChangedEventHandler; } else { ((UIElement3D)o).IsEnabledChanged += _overIsEnabledChangedEventHandler; ((UIElement3D)o).IsVisibleChanged += _overIsVisibleChangedEventHandler; ((UIElement3D)o).IsHitTestVisibleChanged += _overIsHitTestVisibleChangedEventHandler; } } // Oddly enough, update the IsStylusOver property first. This is // so any callbacks will see the more-common IsStylusOver property // set correctly. UIElement.StylusOverProperty.OnOriginValueChanged(oldOver as DependencyObject, _stylusOver as DependencyObject, ref _stylusOverTreeState); // Invalidate the IsStylusDirectlyOver property. if (oldOver != null) { o = oldOver as DependencyObject; o.SetValue(UIElement.IsStylusDirectlyOverPropertyKey, false); // Same property for ContentElements } if (_stylusOver != null) { o = _stylusOver as DependencyObject; o.SetValue(UIElement.IsStylusDirectlyOverPropertyKey, true); // Same property for ContentElements } } }