/// <summary> /// This static initializer is used to override PropertyMetadata of the Visibility property so that it /// can be coerced according to the IsSuppressed property value. Suppressing an edge pointer will make /// it invisible to the user without altering the underlying value of the Visibility property. Thus, /// visibility can be controlled independently of other factors that may require making the pointer /// invisible to the user. For example, the HideEdgePointerByEdgeLength feature of EdgeControlBase may /// need to ensure the pointer is removed from view, but when the constraint is removed, it shouldn't /// cause pointers to be shown that weren't shown before. /// </summary> static DefaultEdgePointer() { var oldPmd = VisibilityProperty.GetMetadata(typeof(DefaultEdgePointer).BaseType); var newPmd = new PropertyMetadata(oldPmd.DefaultValue, oldPmd.PropertyChangedCallback, CoerceVisibility); VisibilityProperty.OverrideMetadata(typeof(DefaultEdgePointer), newPmd); }
static UIElement() { var uiElement = typeof(UIElement); VisibilityProperty.GetMetadata(uiElement).MergePropertyChangedCallback(ClearPointersStateIfNeeded); Windows.UI.Xaml.Controls.Control.IsEnabledProperty.GetMetadata(typeof(Windows.UI.Xaml.Controls.Control)).MergePropertyChangedCallback(ClearPointersStateIfNeeded); #if __WASM__ HitTestVisibilityProperty.GetMetadata(uiElement).MergePropertyChangedCallback(ClearPointersStateIfNeeded); #endif }