예제 #1
0
        void ReturnListener()
        {
            listener.Changed -= HandleValueChanged;

            freeListeners.Add(listener);

            listener = null;
        }
예제 #2
0
        void Attach()
        {
            Detach();

            if (target != null && binding != null)
            {
                listener = GetListener();
                listener.Attach(target, binding);
            }
        }
예제 #3
0
		void Attach()
		{
			Detach();

			if (target != null && binding != null)
			{
				listener = GetListener();
				listener.Attach(target, binding);
			}
		}
예제 #4
0
        DependencyPropertyListener GetListener()
        {
            DependencyPropertyListener listener;

            if (freeListeners.Count != 0)
            {
                listener = freeListeners[freeListeners.Count - 1];
                freeListeners.RemoveAt(freeListeners.Count - 1);

                return(listener);
            }
            listener = new DependencyPropertyListener();

            listener.Changed += HandleValueChanged;

            return(listener);
        }
예제 #5
0
		DependencyPropertyListener GetListener()
		{
			DependencyPropertyListener listener;

			if (freeListeners.Count != 0)
			{
				listener = freeListeners[freeListeners.Count - 1];
				freeListeners.RemoveAt(freeListeners.Count - 1);

				return listener;
			}
			listener = new DependencyPropertyListener();

			listener.Changed += HandleValueChanged;

			return listener;
		}
예제 #6
0
        static void element_Loaded(object sender, RoutedEventArgs e)
        {
            FrameworkElement element = (FrameworkElement)sender;

            element.Loaded -= element_Loaded;
            ScrollViewer scrollViewer = FindChildOfType <ScrollViewer>(element);

            if (scrollViewer == null)
            {
                throw new InvalidOperationException("ScrollViewer not found.");
            }

            var listener = new DependencyPropertyListener();

            listener.Changed
                += delegate
                {
                bool atBottom = scrollViewer.VerticalOffset
                                >= scrollViewer.ScrollableHeight;

                if (atBottom)
                {
                    var atEnd = GetAtEndCommand(element);
                    if (atEnd != null)
                    {
                        atEnd.Execute(null);
                    }
                }
                };
            Binding binding = new Binding("VerticalOffset")
            {
                Source = scrollViewer
            };

            listener.Attach(scrollViewer, binding);
        }
예제 #7
0
		void ReturnListener()
		{
			listener.Changed -= HandleValueChanged;

			freeListeners.Add(listener);

			listener = null;
		}