private void SetScrollBarAutomationPeer(ScrollBar scrollbar, AutomationOrientation orientation) { if (scrollbar == null) { if (orientation == AutomationOrientation.Horizontal) { hScrollbarPeer = null; } else { vScrollbarPeer = null; } } else { if (orientation == AutomationOrientation.Horizontal) { hScrollbarPeer = FrameworkElementAutomationPeer.CreatePeerForElement(scrollbar) as ScrollBarAutomationPeer; } else { vScrollbarPeer = FrameworkElementAutomationPeer.CreatePeerForElement(scrollbar) as ScrollBarAutomationPeer; } } }
internal void RaiseOffsetChanged(double offset, AutomationOrientation orientation) { if (UIAOffsetChanged != null) { UIAOffsetChanged(this, new OffsetEventArgs() { Offset = offset, Orientation = orientation }); } }
internal void RaiseVisibilityChangedEvent(Visibility visibility, AutomationOrientation orientation) { if (UIAVisibilityChanged != null) { UIAVisibilityChanged(this, new VisibilityEventArgs() { Visibility = visibility, Orientation = orientation }); } }
internal void RaiseUIAScrollBarSet(AutomationOrientation orientation, ScrollBar oldValue, ScrollBar newValue) { if (UIAScrollBarSet != null) { UIAScrollBarSet(this, new ScrollBarSetEventArgs() { Orientation = orientation, OldValue = oldValue, NewValue = newValue }); } }
internal void RaiseUIAScrollBarSet (AutomationOrientation orientation, ScrollBar oldValue, ScrollBar newValue) { if (UIAScrollBarSet != null) UIAScrollBarSet (this, new ScrollBarSetEventArgs () { Orientation = orientation, OldValue = oldValue, NewValue = newValue }); }
internal void RaiseOffsetChanged (double offset, AutomationOrientation orientation) { if (UIAOffsetChanged != null) UIAOffsetChanged (this, new OffsetEventArgs () { Offset = offset, Orientation = orientation }); }
internal void RaiseVisibilityChangedEvent (Visibility visibility, AutomationOrientation orientation) { if (UIAVisibilityChanged != null) UIAVisibilityChanged (this, new VisibilityEventArgs () { Visibility = visibility, Orientation = orientation }); }
private void SetAutomationEvents(IScrollProvider provider, ScrollBar scrollbar, Func <bool> scrollableDelegate, Func <Visibility> computedVisibilityDelegate, Func <double> scrollPercentDelegate, Func <double> viewSizeDelegate, AutomationProperty scrollPercentProperty, AutomationProperty scrollableProperty, AutomationProperty viewSizeProperty, AutomationOrientation orientation) { CachedProperty cachedProperty; if (orientation == AutomationOrientation.Horizontal) { cachedProperty = hCachedProperty; } else { cachedProperty = vCachedProperty; } cachedProperty.Scrollable = scrollableDelegate(); cachedProperty.Visible = computedVisibilityDelegate() == Visibility.Visible; cachedProperty.ScrollPercent = scrollPercentDelegate(); cachedProperty.ViewSize = viewSizeDelegate(); cachedProperty.ScrollPercentProperty = scrollPercentProperty; cachedProperty.ScrollableProperty = scrollableProperty; cachedProperty.ViewSizeProperty = viewSizeProperty; cachedProperty.Orientation = orientation; cachedProperty.ScrollBar = scrollbar; cachedProperty.ScrollPercentDelegate = scrollPercentDelegate; cachedProperty.ScrollableDelegate = scrollableDelegate; scrollViewer.UIAVisibilityChanged += (o, e) => { if (cachedProperty.Orientation != e.Orientation) { RaiseStructureChanged(cachedProperty, computedVisibilityDelegate); RaiseScrollableProperty(cachedProperty, scrollableDelegate); RaiseViewSizeProperty(cachedProperty, viewSizeDelegate); RaiseScrollPercentProperty(cachedProperty, scrollPercentDelegate); } }; scrollViewer.UIAViewportChanged += (o, e) => { if (cachedProperty.Orientation == AutomationOrientation.Horizontal) { RaiseViewSizeProperty(cachedProperty, viewSizeDelegate, provider.HorizontalViewSize); } else { RaiseViewSizeProperty(cachedProperty, viewSizeDelegate, provider.VerticalViewSize); } }; scrollViewer.SizeChanged += (o, e) => { RaiseViewSizeProperty(cachedProperty, viewSizeDelegate); }; scrollViewer.UIAOffsetChanged += (o, e) => { if (e.Orientation == cachedProperty.Orientation) { RaiseScrollPercentProperty(cachedProperty, scrollPercentDelegate); } }; scrollViewer.UIAScrollBarSet += (o, e) => { if (e.Orientation == cachedProperty.Orientation) { if (cachedProperty.ScrollBar != null) { cachedProperty.ScrollBar.IsEnabledChanged -= ScrollBar_IsEnabledChanged; cachedProperty.ScrollBar.ValueChanged -= ScrollBar_ValueChanged; } cachedProperty.ScrollBar = e.NewValue; if (cachedProperty.ScrollBar != null) { cachedProperty.ScrollBar.IsEnabledChanged += ScrollBar_IsEnabledChanged; cachedProperty.ScrollBar.ValueChanged += ScrollBar_ValueChanged; } SetScrollBarAutomationPeer(cachedProperty.ScrollBar, cachedProperty.Orientation); } }; if (cachedProperty.ScrollBar != null) { cachedProperty.ScrollBar.IsEnabledChanged += ScrollBar_IsEnabledChanged; cachedProperty.ScrollBar.ValueChanged += ScrollBar_ValueChanged; } SetScrollBarAutomationPeer(cachedProperty.ScrollBar, cachedProperty.Orientation); }
private void SetScrollBarAutomationPeer (ScrollBar scrollbar, AutomationOrientation orientation) { if (scrollbar == null) { if (orientation == AutomationOrientation.Horizontal) hScrollbarPeer = null; else vScrollbarPeer = null; } else { if (orientation == AutomationOrientation.Horizontal) hScrollbarPeer = FrameworkElementAutomationPeer.CreatePeerForElement (scrollbar) as ScrollBarAutomationPeer; else vScrollbarPeer = FrameworkElementAutomationPeer.CreatePeerForElement (scrollbar) as ScrollBarAutomationPeer; } }
private void SetAutomationEvents (IScrollProvider provider, ScrollBar scrollbar, Func<bool> scrollableDelegate, Func<Visibility> computedVisibilityDelegate, Func<double> scrollPercentDelegate, Func<double> viewSizeDelegate, AutomationProperty scrollPercentProperty, AutomationProperty scrollableProperty, AutomationProperty viewSizeProperty, AutomationOrientation orientation) { CachedProperty cachedProperty; if (orientation == AutomationOrientation.Horizontal) cachedProperty = hCachedProperty; else cachedProperty = vCachedProperty; cachedProperty.Scrollable = scrollableDelegate (); cachedProperty.Visible = computedVisibilityDelegate () == Visibility.Visible; cachedProperty.ScrollPercent = scrollPercentDelegate (); cachedProperty.ViewSize = viewSizeDelegate (); cachedProperty.ScrollPercentProperty = scrollPercentProperty; cachedProperty.ScrollableProperty = scrollableProperty; cachedProperty.ViewSizeProperty = viewSizeProperty; cachedProperty.Orientation = orientation; cachedProperty.ScrollBar = scrollbar; cachedProperty.ScrollPercentDelegate = scrollPercentDelegate; cachedProperty.ScrollableDelegate = scrollableDelegate; scrollViewer.UIAVisibilityChanged += (o, e) => { if (cachedProperty.Orientation != e.Orientation) { RaiseStructureChanged (cachedProperty, computedVisibilityDelegate); RaiseScrollableProperty (cachedProperty, scrollableDelegate); RaiseViewSizeProperty (cachedProperty, viewSizeDelegate); RaiseScrollPercentProperty (cachedProperty, scrollPercentDelegate); } }; scrollViewer.UIAViewportChanged += (o, e) => { if (cachedProperty.Orientation == AutomationOrientation.Horizontal) RaiseViewSizeProperty (cachedProperty, viewSizeDelegate, provider.HorizontalViewSize); else RaiseViewSizeProperty (cachedProperty, viewSizeDelegate, provider.VerticalViewSize); }; scrollViewer.SizeChanged += (o, e) => { RaiseViewSizeProperty (cachedProperty, viewSizeDelegate); }; scrollViewer.UIAOffsetChanged += (o, e) => { if (e.Orientation == cachedProperty.Orientation) RaiseScrollPercentProperty (cachedProperty, scrollPercentDelegate); }; scrollViewer.UIAScrollBarSet += (o, e) => { if (e.Orientation == cachedProperty.Orientation) { if (cachedProperty.ScrollBar != null) { cachedProperty.ScrollBar.IsEnabledChanged -= ScrollBar_IsEnabledChanged; cachedProperty.ScrollBar.ValueChanged -= ScrollBar_ValueChanged; } cachedProperty.ScrollBar = e.NewValue; if (cachedProperty.ScrollBar != null) { cachedProperty.ScrollBar.IsEnabledChanged += ScrollBar_IsEnabledChanged; cachedProperty.ScrollBar.ValueChanged += ScrollBar_ValueChanged; } SetScrollBarAutomationPeer (cachedProperty.ScrollBar, cachedProperty.Orientation); } }; if (cachedProperty.ScrollBar != null) { cachedProperty.ScrollBar.IsEnabledChanged += ScrollBar_IsEnabledChanged; cachedProperty.ScrollBar.ValueChanged += ScrollBar_ValueChanged; } SetScrollBarAutomationPeer (cachedProperty.ScrollBar, cachedProperty.Orientation); }