Inheritance: GalaSoft.MvvmLight.ObservableObject
コード例 #1
0
		void DoInterimManipulation()
		{
			var total = manipulationStart - manipulationEnd;
			var viewport = FindViewport(this);
			if (viewport != null)
			{
                var firstVisibleItem = GetFirstVisibleItem();
                if (firstVisibleItem != null && ItemsSource.Count > 0 && firstVisibleItem == ItemsSource[0])
				{
                    if (Math.Abs(total) > pullDownOffset)
                    {
                        var orientationManager = _orientationManager == null ? (_orientationManager = Styles.Resources["orientationManager"] as OrientationManager) : _orientationManager;
                        var adjustedTotal = -total;
                        if (orientationManager != null)
                        {
                            if(orientationManager.Orientation == PageOrientation.LandscapeLeft)
                            {
                                adjustedTotal = total;
                            }
                        }
                        if(adjustedTotal > pullDownOffset)
                            Compression(this, new CompressionEventArgs(CompressionType.Top));
                        else
                            Compression(this, new CompressionEventArgs(CompressionType.None));
                    }
                    else
                        Compression(this, new CompressionEventArgs(CompressionType.None));
				}
				else
				{
					Compression(this, new CompressionEventArgs(CompressionType.None));
				}
			}
		}
コード例 #2
0
		void listbox_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
		{
			var pos = e.GetPosition(null);

            var orientationManager = _orientationManager == null ? (_orientationManager = Styles.Resources["orientationManager"] as OrientationManager) : _orientationManager;
			var val = pos.Y;
			if (orientationManager != null
				&& (orientationManager.Orientation == PageOrientation.Landscape
				|| orientationManager.Orientation == PageOrientation.LandscapeLeft
				|| orientationManager.Orientation == PageOrientation.LandscapeRight))
				val = pos.X;

			if (!isMoving)
			{
				manipulationStart = val;
			}
			else
			{
				manipulationEnd = val;
				if (ManipulationState == System.Windows.Controls.Primitives.ManipulationState.Manipulating)
				{
					DoInterimManipulation();
				}
			}

			isMoving = true;
		}