Esempio n. 1
0
        void ReturnListener()
        {
            listener.Changed -= HandleValueChanged;

            freeListeners.Add(listener);

            listener = null;
        }
Esempio n. 2
0
        void Attach()
        {
            Detach();

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

			if (target != null && binding != null)
			{
				listener = GetListener();
				listener.Attach(target, binding);
			}
		}
Esempio n. 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);
        }
Esempio n. 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;
		}
Esempio n. 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);
        }
Esempio n. 7
0
		void ReturnListener()
		{
			listener.Changed -= HandleValueChanged;

			freeListeners.Add(listener);

			listener = null;
		}