コード例 #1
0
 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;
         }
     }
 }
コード例 #2
0
 internal void RaiseOffsetChanged(double offset, AutomationOrientation orientation)
 {
     if (UIAOffsetChanged != null)
     {
         UIAOffsetChanged(this, new OffsetEventArgs()
         {
             Offset      = offset,
             Orientation = orientation
         });
     }
 }
コード例 #3
0
 internal void RaiseVisibilityChangedEvent(Visibility visibility, AutomationOrientation orientation)
 {
     if (UIAVisibilityChanged != null)
     {
         UIAVisibilityChanged(this, new VisibilityEventArgs()
         {
             Visibility  = visibility,
             Orientation = orientation
         });
     }
 }
コード例 #4
0
 internal void RaiseUIAScrollBarSet(AutomationOrientation orientation, ScrollBar oldValue, ScrollBar newValue)
 {
     if (UIAScrollBarSet != null)
     {
         UIAScrollBarSet(this, new ScrollBarSetEventArgs()
         {
             Orientation = orientation,
             OldValue    = oldValue,
             NewValue    = newValue
         });
     }
 }
コード例 #5
0
ファイル: ScrollViewer.cs プロジェクト: snorp/moon
	internal void RaiseUIAScrollBarSet (AutomationOrientation orientation, ScrollBar oldValue, ScrollBar newValue) 
	{
		if (UIAScrollBarSet != null)
			UIAScrollBarSet (this, new ScrollBarSetEventArgs () {
			                           Orientation = orientation,
			                           OldValue    = oldValue,
			                           NewValue    = newValue
					 });
	}
コード例 #6
0
ファイル: ScrollViewer.cs プロジェクト: snorp/moon
	internal void RaiseOffsetChanged (double offset, AutomationOrientation orientation) 
	{
		if (UIAOffsetChanged != null)
			UIAOffsetChanged (this, new OffsetEventArgs () {
			                            Offset = offset,
						    Orientation = orientation });
	}
コード例 #7
0
ファイル: ScrollViewer.cs プロジェクト: snorp/moon
	internal void RaiseVisibilityChangedEvent (Visibility visibility, AutomationOrientation orientation) 
	{
		if (UIAVisibilityChanged != null)
			UIAVisibilityChanged (this, new VisibilityEventArgs () {
			                                Visibility  = visibility,
						        Orientation = orientation });
	}
コード例 #8
0
        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);
        }
コード例 #9
0
		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;
			}
		}
コード例 #10
0
		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);

		}