Пример #1
0
        public void IndexOf()
        {
            var      section = new TableSection();
            TextCell first, second;

            section.Add(first = new TextCell {
                Text = "Text"
            });
            section.Add(second = new TextCell {
                Text = "Text"
            });

            Assert.AreEqual(0, section.IndexOf(first));
            Assert.AreEqual(1, section.IndexOf(second));
        }
Пример #2
0
        bool FindIndices(GestureEventArgs e, out int sectionIndex, out int cellIndex)
        {
            sectionIndex = 0;
            cellIndex    = 0;

            TableSection section = null;
            Cell         cell    = null;

            System.Windows.Point pos = e.GetPosition(System.Windows.Application.Current.MainWindow);
            if (Device.Info.CurrentOrientation.IsLandscape())
            {
                double x = pos.Y;
                double y = System.Windows.Application.Current.MainWindow.RenderSize.Width - pos.X + (SystemTray.IsVisible ? 72 : 0);
                pos = new System.Windows.Point(x, y);
            }
            IEnumerable <UIElement> elements = VisualTreeHelperEx.FindElementsInHostCoordinates(pos, System.Windows.Application.Current.MainWindow);

            foreach (FrameworkElement element in elements.OfType <FrameworkElement>())
            {
                if (cell == null)
                {
                    cell = element.DataContext as Cell;
                }
                else if (section == null)
                {
                    section = element.DataContext as TableSection;
                }
                else
                {
                    break;
                }
            }

            if (cell == null || section == null)
            {
                return(false);
            }

            sectionIndex = Element.Root.IndexOf(section);
            cellIndex    = section.IndexOf(cell);
            return(true);
        }
Пример #3
0
		public void IndexOf ()
		{
			var section = new TableSection ();
			TextCell first, second;
			section.Add (first = new TextCell { Text = "Text" });
			section.Add (second = new TextCell { Text = "Text" });

			Assert.AreEqual (0, section.IndexOf (first));
			Assert.AreEqual (1, section.IndexOf (second));
		}