示例#1
0
        private void Table_Dragging(object source, TableDraggingEventArgs e)
        {
            e.Handled = true;
            if (cachedSelectedTables == null)
            {
                cachedSelectedTables = new List <ItemTable>();
                foreach (var selectedTable in SelectedTables)
                {
                    ItemTable table = FindAssociatedTable(selectedTable);
                    if (table == null)
                    {
                        throw new ApplicationException("Unexpected code path!");
                    }
                    cachedSelectedTables.Add(table);
                }
            }
            foreach (var table in cachedSelectedTables)
            {
                table.X += e.HorizontalChange;
                table.Y += e.VerticalChange;
            }

            var eventArgs = new TableDraggingEventArgs(TableDraggingEvent, this, SelectedTables, e.HorizontalChange, e.VerticalChange);

            RaiseEvent(eventArgs);
        }
示例#2
0
        public void BringTablesIntoView(ICollection Tables)
        {
            if (Tables == null)
            {
                throw new ArgumentNullException("'Tables' argument shouldn't be null.");
            }

            if (Tables.Count == 0)
            {
                return;
            }

            Rect rect = Rect.Empty;

            foreach (var item in Tables)
            {
                ItemTable table     = FindAssociatedTable(item);
                Rect      tableRect = new Rect(table.X, table.Y, table.ActualWidth, table.ActualHeight);

                if (rect == Rect.Empty)
                {
                    rect = tableRect;
                }
                else
                {
                    rect.Intersect(tableRect);
                }
            }

            this.BringIntoView(rect);
        }
示例#3
0
        internal ItemTable FindAssociatedTable(object table)
        {
            ItemTable tabl = table as ItemTable;

            if (tabl == null)
            {
                tabl = TableControl.FindAssociatedTable(table);
            }
            return(tabl);
        }
示例#4
0
        internal int FindMaxZIndex()
        {
            if (TableControl == null)
            {
                return(0);
            }
            int maxZ = 0;

            for (int tableIndex = 0; ; ++tableIndex)
            {
                ItemTable table = (ItemTable)TableControl.ItemContainerGenerator.ContainerFromIndex(tableIndex);
                if (table == null)
                {
                    break;
                }

                if (table.ZIndex > maxZ)
                {
                    maxZ = table.ZIndex;
                }
            }
            return(maxZ);
        }