Ejemplo n.º 1
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = MinorVersion.GetHashCode();
         hashCode = (hashCode * 397) ^ MajorVersion.GetHashCode();
         hashCode = (hashCode * 397) ^ (PropMask?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (BackColor?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (ForeColor?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (FontTextProps?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)NextAvailableId;
         hashCode = (hashCode * 397) ^ (BooleanProperties?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)BorderStyle;
         hashCode = (hashCode * 397) ^ (int)MousePointer;
         hashCode = (hashCode * 397) ^ (ScrollBars?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ GroupCount;
         hashCode = (hashCode * 397) ^ (int)Cycle;
         hashCode = (hashCode * 397) ^ (int)SpecialEffect;
         hashCode = (hashCode * 397) ^ (BorderColor?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)Zoom;
         hashCode = (hashCode * 397) ^ (int)PictureAlignment;
         hashCode = (hashCode * 397) ^ (int)PictureSizeMode;
         hashCode = (hashCode * 397) ^ (int)ShapeCookie;
         hashCode = (hashCode * 397) ^ (int)DrawBuffer;
         hashCode = (hashCode * 397) ^ (DisplayedSize?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (LogicalSize?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (ScrollPosition?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Caption?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ FontIsStdFont.GetHashCode();
         hashCode = (hashCode * 397) ^ (FontStdFont?.GetHashCode() ?? 0);
         return(hashCode);
     }
 }
Ejemplo n.º 2
0
        float _tabCenteredScrollOffset(int index)
        {
            ScrollPosition position = this._scrollController.position;

            return(this._tabScrollOffset(index, position.viewportDimension, position.minScrollExtent,
                                         position.maxScrollExtent));
        }
Ejemplo n.º 3
0
 public override ScrollPosition createScrollPosition(ScrollPhysics physics, ScrollContext context,
                                                     ScrollPosition oldPosition)
 {
     return(new _TabBarScrollPosition(
                physics: physics,
                context: context,
                oldPosition: oldPosition,
                tabBar: this.tabBar
                ));
 }
Ejemplo n.º 4
0
 void _addScrollingNotifierListener()
 {
     if (this.widget.closeOnScroll)
     {
         this._scrollPosition = Scrollable.of(this.context)?.position;
         if (this._scrollPosition != null)
         {
             this._scrollPosition.isScrollingNotifier.addListener(this._isScrollingListener);
         }
     }
 }
Ejemplo n.º 5
0
 public override ScrollPosition createScrollPosition(
     ScrollPhysics physics,
     ScrollContext context,
     ScrollPosition oldPosition
     )
 {
     return(new _DraggableScrollableSheetScrollPosition(
                physics: physics,
                context: context,
                oldPosition: oldPosition,
                extent: extent
                ));
 }
Ejemplo n.º 6
0
 public _TabBarScrollPosition(
     ScrollPhysics physics      = null,
     ScrollContext context      = null,
     ScrollPosition oldPosition = null,
     _TabBarState tabBar        = null
     ) : base(
         physics: physics,
         context: context,
         initialPixels: null,
         oldPosition: oldPosition)
 {
     this.tabBar = tabBar;
 }
Ejemplo n.º 7
0
        public override void didChangeDependencies()
        {
            base.didChangeDependencies();
            if (this._position != null)
            {
                this._position.isScrollingNotifier.removeListener(this._isScrollingListener);
            }

            this._position = Scrollable.of(this.context)?.position;
            if (this._position != null)
            {
                this._position.isScrollingNotifier.addListener(this._isScrollingListener);
            }
        }
Ejemplo n.º 8
0
        private void MoveSlider()
        {
            float sliderPos = 0.0f;

            if (MaxScrollPosition > float.Epsilon)
            {
                float p = ScrollPosition.Clamp(MinScrollPosition, MaxScrollPosition);
                sliderPos = p * ProjectToScrollAxis(Frame.Size - slider.Size) / MaxScrollPosition;
            }
            if (ScrollDirection == ScrollDirection.Vertical)
            {
                slider.Y = sliderPos;
            }
            else
            {
                slider.X = sliderPos;
            }
        }
Ejemplo n.º 9
0
 public _DraggableScrollableSheetScrollPosition(
     ScrollPhysics physics        = null,
     ScrollContext context        = null,
     float initialPixels          = 0.0f,
     bool keepScrollOffset        = true,
     ScrollPosition oldPosition   = null,
     string debugLabel            = null,
     _DraggableSheetExtent extent = null
     ) : base(physics: physics,
              context: context,
              initialPixels: initialPixels,
              keepScrollOffset: keepScrollOffset,
              oldPosition: oldPosition,
              debugLabel: debugLabel)
 {
     D.assert(extent != null);
     this.extent = extent;
 }
Ejemplo n.º 10
0
 void pictureBox_MouseMove(object sender, MouseEventArgs e)
 {
     ScrollPosition = ScrollPosition.Translate(new Vector(e.Location, cursorPosition));
     cursorPosition = e.Location;
 }
Ejemplo n.º 11
0
        // -----------------------------------------------------------------------
        void Toolbar()
        {
            // No toolbar if editor snapshot without background requested.
            if (iCS_DevToolsConfig.IsFrameWithoutBackground)
            {
                return;
            }

            // Build standard toolbar at top of editor window.
            Rect r = iCS_ToolbarUtility.BuildToolbar(position.width, 0f);

            // Insert an initial spacer.
            float spacer = 8f;

            // --------------
            // LEFT TOOLBAR
            // -- Navigation History --
            var   backwardNavigationIcon = iCS_BuiltinTextures.BackwardNavigationHistoryIcon();
            var   forwardNavigationIcon  = iCS_BuiltinTextures.ForwardNavigationHistoryIcon();
            var   hasBackwardHistory     = IStorage.HasBackwardNavigationHistory;
            float width = backwardNavigationIcon.width + spacer;

            if (iCS_ToolbarUtility.Button(ref r, width, hasBackwardHistory, backwardNavigationIcon, 0, 0))
            {
                if (hasBackwardHistory)
                {
                    iCS_UserCommands.ReloadFromBackwardNavigationHistory(IStorage);
                }
            }
            var hasForwardHistory = IStorage.HasForwardNavigationHistory;

            width = forwardNavigationIcon.width + spacer;
            if (iCS_ToolbarUtility.Button(ref r, width, hasForwardHistory, forwardNavigationIcon, 0, 0))
            {
                if (hasForwardHistory)
                {
                    iCS_UserCommands.ReloadFromForwardNavigationHistory(IStorage);
                }
            }

            // -- Generate & Delete C#
            if (iCS_ToolbarUtility.Button(ref r, 100, true, "Generate C#", spacer, 0))
            {
                var codeGenerator = new CodeGenerator();
                codeGenerator.GenerateCodeFor(IStorage);
            }
            if (iCS_ToolbarUtility.Button(ref r, 100, true, "Delete C#", spacer, 0))
            {
                var codeGenerator = new CodeGenerator();
                codeGenerator.DeleteGeneratedFilesFor(IStorage);
            }


            // -- Zoom factor --
            float newScale = iCS_ToolbarUtility.Slider(ref r, kSliderSize, Scale, 2f, 0.15f, spacer, spacer, true);

            iCS_ToolbarUtility.MiniLabel(ref r, "Zoom", 10f, 0, true);
            if (Math3D.IsNotEqual(newScale, Scale))
            {
                Vector2 pivot = ViewportToGraph(ViewportCenter);
                CenterAtWithScale(pivot, newScale);
            }

            // -- Visual Script Settings --
            if (iCS_ToolbarUtility.Button(ref r, 100, true, "Visual Script Settings", 0, spacer, true))
            {
                VisualScriptSettingsEditor.Init(IStorage);
            }

            // -- Show Display Root Node. --
            if (IStorage.DisplayRoot != IStorage.RootObject)
            {
                IStorage.ShowDisplayRootNode = iCS_ToolbarUtility.Toggle(ref r, IStorage.ShowDisplayRootNode, spacer, spacer);
                iCS_ToolbarUtility.MiniLabel(ref r, "Show Root Node", 0, 0);
                iCS_ToolbarUtility.Separator(ref r);
            }

            // --------------
            // CENTER TOOLBAR
            // Show game object name in middle of toolbar.
            var projectName = "";
            var project     = IStorage.Package;

            if (project != null)
            {
                projectName = project.PackageName + " -- ";
            }
            var vsName   = IStorage.TypeName;
            var baseType = CodeGenerationUtility.GetBaseType(IStorage);

            if (baseType != null && baseType != typeof(void))
            {
                vsName += " : " + baseType.Name;
            }
            iCS_ToolbarUtility.CenteredTitle(ref r, projectName + vsName);

            // Trial information.
            ShowTrialInformation(ref r);

            // Show scroll position
            var scrollPositionAsStr        = ScrollPosition.ToString();
            var scrollPositionAsGUIContent = new GUIContent(scrollPositionAsStr);
            var scrollPositionSize         = EditorStyles.label.CalcSize(scrollPositionAsGUIContent);

            r = new Rect(position.width - scrollPositionSize.x, position.height - scrollPositionSize.y,
                         scrollPositionSize.x, scrollPositionSize.y);
            GUI.Label(r, scrollPositionAsGUIContent);
        }
Ejemplo n.º 12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="listViewBase"></param>
        /// <param name="index"></param>
        /// <param name="offset"></param>
        /// <returns></returns>
        public async static Task ScrollToIndex(this ListViewBase listViewBase, int index, ScrollPosition s)
        {
            try
            {
                bool   isVirtualizing = default(bool);
                double previousHorizontalOffset = default(double), previousVerticalOffset = default(double);
                // get the ScrollViewer withtin the ListView/GridView
                var scrollViewer = listViewBase.GetScrollViewer();
                // get the SelectorItem to scroll to
                var selectorItem = listViewBase.ContainerFromIndex(index) as UIElement;

                // when it's null, means virtualization is on and the item hasn't been realized yet
                if (selectorItem == null)
                {
                    isVirtualizing = true;

                    previousHorizontalOffset = scrollViewer.HorizontalOffset;
                    previousVerticalOffset   = scrollViewer.VerticalOffset;

                    // call task-based ScrollIntoViewAsync to realize the item
                    await listViewBase.ScrollIntoViewAsync(listViewBase.Items[index]);

                    // this time the item shouldn't be null again
                    selectorItem = (UIElement)listViewBase.ContainerFromIndex(index);
                }

                // calculate the position object in order to know how much to scroll to
                var transform = selectorItem.TransformToVisual((UIElement)scrollViewer.Content);

                // offset : positivie down, negative up
                Point position;
                switch (s)
                {
                case ScrollPosition.Top:
                    position = transform.TransformPoint(new Point(0, 0));
                    break;

                case ScrollPosition.Center:
                    position = transform.TransformPoint(new Point(0, 0 - (listViewBase.ActualHeight - (selectorItem as ListViewItem).ActualHeight) / 2));
                    break;

                case ScrollPosition.Bottom:
                    position = transform.TransformPoint(new Point(0, 0 - listViewBase.ActualHeight + (selectorItem as ListViewItem).ActualHeight));
                    break;

                default:
                    position = transform.TransformPoint(new Point(0, 0));
                    break;
                }


                // when virtualized, scroll back to previous position without animation
                if (isVirtualizing)
                {
                    await scrollViewer.ChangeViewAsync(previousHorizontalOffset, previousVerticalOffset, true);
                }

                // scroll to desired position with animation!
                scrollViewer.ChangeView(position.X, position.Y, null);
            }
            catch (Exception)
            {
            }
        }
Ejemplo n.º 13
0
 /// <summary>
 /// 指定した位置にスクロールするように継承先でオーバーライド
 /// </summary>
 /// <param name="position"></param>
 public abstract void ScrollTo(ScrollPosition position);
        //----------------------------------------------------------------------------------------------------------------------------------\\

        static public void SetImagePosition(int IndexX, int IndexY, int CellHeight, int RowsCount, int CellsinRow, int value, Logic.ScreenSideofDrawing FormuleType)
        {
            /*
             * Метод вычисления координат.
             *
             * Имеет 4 разных формулы
             * для расчёта координат в четырёх разных циклах,
             * которые находятся в функции отрисовки
             *
             *  ( DrawingCells
             *   в классе Logic )
             */

            int TypeofFormule = (int)(FormuleType);

            if (TypeofFormule == 1)
            {
                MarginValues[0] = unchecked((int)((int)(SystemParameters.PrimaryScreenWidth / 2) - CellHeight / 2 + (CellHeight * RowsCount) - CellHeight * (CellsinRow - value) + ScrollPosition.GetLeftOffset() - ScrollPosition.GetRightOffset()));   //установка горизонтальной координаты картинки центральной ячйеки
                MarginValues[1] = unchecked((int)(Convert.ToInt32(SystemParameters.PrimaryScreenHeight / 2) - Convert.ToInt32(CellHeight / 2) + (CellHeight * RowsCount) + ScrollPosition.GetTopOffset() - ScrollPosition.GetBottomOffset()));     //установка вертикальной координаты картинки центральной ячйеки

                MarginValues[2] = Convert.ToInt32(SystemParameters.PrimaryScreenWidth - CellHeight - MarginValues[0]);
                MarginValues[3] = Convert.ToInt32(SystemParameters.PrimaryScreenHeight - CellHeight - MarginValues[1]);

                Grid[IndexX, IndexY].Model.Margin = new Thickness(MarginValues[0], MarginValues[1], MarginValues[2], MarginValues[3]);
            }

            if (TypeofFormule == 2)
            {
                MarginValues[0] = unchecked((int)((int)(SystemParameters.PrimaryScreenWidth / 2) - CellHeight / 2 - (CellHeight * RowsCount) + ScrollPosition.GetLeftOffset() - ScrollPosition.GetRightOffset()));       //установка горизонтальной координаты картинки центральной ячйеки
                MarginValues[1] = unchecked((int)((int)(SystemParameters.PrimaryScreenHeight / 2) - CellHeight / 2 + (CellHeight * RowsCount) - (CellHeight * (CellsinRow - value)) + ScrollPosition.GetTopOffset() - ScrollPosition.GetBottomOffset()));      //установка вертикальной координаты картинки центральной ячйеки

                MarginValues[2] = Convert.ToInt32(SystemParameters.PrimaryScreenWidth - CellHeight - MarginValues[0]);
                MarginValues[3] = Convert.ToInt32(SystemParameters.PrimaryScreenHeight - CellHeight - MarginValues[1]);

                Grid[IndexX, IndexY].Model.Margin = new Thickness(MarginValues[0], MarginValues[1], MarginValues[2], MarginValues[3]);
            }

            if (TypeofFormule == 3)
            {
                MarginValues[0] = unchecked((int)((int)(SystemParameters.PrimaryScreenWidth / 2) - CellHeight / 2 - (CellHeight * (RowsCount + 1)) + (CellHeight * (CellsinRow - value)) + ScrollPosition.GetLeftOffset() - ScrollPosition.GetRightOffset()));        //установка горизонтальной координаты картинки центральной ячйеки
                MarginValues[1] = unchecked((int)((int)(SystemParameters.PrimaryScreenHeight / 2) - CellHeight / 2 - (CellHeight * RowsCount) + ScrollPosition.GetTopOffset() - ScrollPosition.GetBottomOffset()));       //установка вертикальной координаты картинки центральной ячйеки

                MarginValues[2] = Convert.ToInt32(SystemParameters.PrimaryScreenWidth - CellHeight - MarginValues[0]);
                MarginValues[3] = Convert.ToInt32(SystemParameters.PrimaryScreenHeight - CellHeight - MarginValues[1]);

                Grid[IndexX, IndexY].Model.Margin = new Thickness(MarginValues[0], MarginValues[1], MarginValues[2], MarginValues[3]);
            }

            if (TypeofFormule == 4)
            {
                MarginValues[0] = unchecked((int)((int)(SystemParameters.PrimaryScreenWidth / 2) - CellHeight / 2 + (CellHeight * RowsCount) + ScrollPosition.GetLeftOffset() - ScrollPosition.GetRightOffset()));//установка горизонтальной координаты картинки центральной ячйеки
                MarginValues[1] = unchecked((int)((int)(SystemParameters.PrimaryScreenHeight / 2) - CellHeight / 2 - (CellHeight * RowsCount) + (CellHeight * ((CellsinRow - 2) - value)) + CellHeight + ScrollPosition.GetTopOffset() - ScrollPosition.GetBottomOffset()));//установка вертикальной координаты картинки центральной ячйеки

                MarginValues[2] = Convert.ToInt32(SystemParameters.PrimaryScreenWidth - CellHeight - MarginValues[0]);
                MarginValues[3] = Convert.ToInt32(SystemParameters.PrimaryScreenHeight - CellHeight - MarginValues[1]);

                Grid[IndexX, IndexY].Model.Margin = new Thickness(MarginValues[0], MarginValues[1], MarginValues[2], MarginValues[3]);
            }
        }
        static public void SM_DeletingCells(int RowsCount, byte VoS)
        {
            /*
             *  Метод 
             *  
             *   удаления объектов
             *   картинок ячеек
             *   и расчёт их координат 
             *   
             *   при скроллинге перемещения
             *   
             *   ( удаление тех клеток, что что попали за границу экрана )
             *   
             *  ( вызывается метод
             *   в методе SM_Drawing
             *   класса Logic )
             * 
             */

            int IndexX = ScrollPosition.GetCameraX() - 1;
            int IndexY = ScrollPosition.GetCameraY() - 1;


            if (VoS == 1)
            {                  //  При перемещении    / ВНИЗ
                IndexX = IndexX - RowsCount;
                IndexY = IndexY - RowsCount;

                while (ScrollPosition.GetCameraX() - 1 + ((RowsCount * 2) + 1) > IndexX)
                {

                    if (Grid[IndexX, IndexY].Model != null) Grid[IndexX, IndexY].Model = null;

                    IndexX++;
                }
            }


            if (VoS == 2)
            {                  //  При перемещении    / ВЛЕВО
                IndexX = IndexX + RowsCount;
                IndexY = IndexY - RowsCount;

                while (ScrollPosition.GetCameraY() - 1 + ((RowsCount * 2) + 1) > IndexY)
                {

                    if (Grid[IndexX, IndexY].Model != null) Grid[IndexX, IndexY].Model = null;

                    IndexY++;
                }
            }


            if (VoS == 3)
            {                  //  При перемещении    / ВВЕРХ
                IndexX = IndexX - RowsCount;
                IndexY = IndexY + RowsCount;

                while (ScrollPosition.GetCameraX() - 1 + ((RowsCount * 2) + 1) > IndexX)
                {

                    if (Grid[IndexX, IndexY].Model != null) Grid[IndexX, IndexY].Model = null;

                    IndexX++;
                }
            }


            if (VoS == 4)
            {                  //  При перемещении    / ВПРАВО
                IndexX = IndexX - RowsCount;
                IndexY = IndexY - RowsCount;

                while (ScrollPosition.GetCameraY() - 1 + ((RowsCount * 2) + 1) > IndexY)
                {

                    if (Grid[IndexX, IndexY].Model != null) Grid[IndexX, IndexY].Model = null;

                    IndexY++;
                }
            }
        }
        static public void SM_AddingCells(int RowsCount, byte VoS, int CellHeight)
        {
            /*
             *  Метод 
             *  
             *   создания объектов
             *   картинок ячеек
             *   и расчёт их координат 
             *   
             *   при скроллинге перемещения
             *   
             *   ( отрисовка тех клеток, что были за границей экрана )
             *   
             *  ( вызывается метод
             *   в методе SM_Drawing
             *   класса Logic )
             * 
             */   /////  не закончено, расчёта координат пока нет

            int IndexX = ScrollPosition.GetCameraX() - 1;
            int IndexY = ScrollPosition.GetCameraY() - 1;


            if (VoS == 1)
            {                  //  При перемещении    / ВНИЗ
                IndexX = IndexX - RowsCount;
                IndexY = IndexY + RowsCount;

                while (ScrollPosition.GetCameraX() - 1 + ((RowsCount * 2) + 1) > IndexX)
                {

                    if (Grid[IndexX, IndexY].Model == null) Grid[IndexX, IndexY].Model = new Image();

                    IndexY--;   //  начало расчёта координат новой отрисованной ячейки

                    MarginValues[1] = (int)Grid[IndexX, IndexY].Model.Margin.Left;                  //  берутся координаты
                    MarginValues[2] = (int)Grid[IndexX, IndexY].Model.Margin.Top + CellHeight;      //  соседней уже отрисованной
                    MarginValues[3] = (int)Grid[IndexX, IndexY].Model.Margin.Right;                 //  ячейки 
                    MarginValues[4] = (int)Grid[IndexX, IndexY].Model.Margin.Bottom - CellHeight;   //  и смещаются на одну клетку

                    IndexY++;
                    Grid[IndexX, IndexY].Model.Margin = new Thickness(MarginValues[1], MarginValues[2], MarginValues[3], MarginValues[4]);
                    //  конец расчёта координат новой отрисованной ячейки

                    IndexX++;
                }
            }


            if (VoS == 2)
            {                  //  При перемещении    / ВЛЕВО
                IndexX = IndexX - RowsCount;
                IndexY = IndexY - RowsCount;

                while (ScrollPosition.GetCameraY() - 1 + ((RowsCount * 2) + 1) > IndexY)
                {

                    if (Grid[IndexX, IndexY].Model == null) Grid[IndexX, IndexY].Model = new Image();

                    IndexX++;   //  начало расчёта координат новой отрисованной ячейки

                    MarginValues[1] = (int)Grid[IndexX, IndexY].Model.Margin.Left - CellHeight;   //  берутся координаты
                    MarginValues[2] = (int)Grid[IndexX, IndexY].Model.Margin.Top;                 //  соседней уже отрисованной
                    MarginValues[3] = (int)Grid[IndexX, IndexY].Model.Margin.Right + CellHeight;  //  ячейки 
                    MarginValues[4] = (int)Grid[IndexX, IndexY].Model.Margin.Bottom;              //  и смещаются на одну клетку

                    IndexX--;
                    Grid[IndexX, IndexY].Model.Margin = new Thickness(MarginValues[1], MarginValues[2], MarginValues[3], MarginValues[4]);
                    //  конец расчёта координат новой отрисованной ячейки

                    IndexY++;
                }
            }


            if (VoS == 3)
            {                  //  При перемещении    / ВВЕРХ
                IndexX = IndexX - RowsCount;
                IndexY = IndexY - RowsCount;

                while (ScrollPosition.GetCameraX() - 1 + ((RowsCount * 2) + 1) > IndexX)
                {

                    if (Grid[IndexX, IndexY].Model == null) Grid[IndexX, IndexY].Model = new Image();

                    IndexY++;   //  начало расчёта координат новой отрисованной ячейки

                    MarginValues[1] = (int)Grid[IndexX, IndexY].Model.Margin.Left;                  //  берутся координаты
                    MarginValues[2] = (int)Grid[IndexX, IndexY].Model.Margin.Top - CellHeight;      //  соседней уже отрисованной
                    MarginValues[3] = (int)Grid[IndexX, IndexY].Model.Margin.Right;                 //  ячейки 
                    MarginValues[4] = (int)Grid[IndexX, IndexY].Model.Margin.Bottom + CellHeight;   //  и смещаются на одну клетку

                    IndexY--;
                    Grid[IndexX, IndexY].Model.Margin = new Thickness(MarginValues[1], MarginValues[2], MarginValues[3], MarginValues[4]);
                    //  конец расчёта координат новой отрисованной ячейки

                    IndexX++;
                }
            }


            if (VoS == 4)
            {                  //  При перемещении    / ВПРАВО
                IndexX = IndexX + RowsCount;
                IndexY = IndexY - RowsCount;

                while (ScrollPosition.GetCameraY() - 1 + ((RowsCount * 2) + 1) > IndexY)
                {

                    if (Grid[IndexX, IndexY].Model == null) Grid[IndexX, IndexY].Model = new Image();

                    IndexX--;   //  начало расчёта координат новой отрисованной ячейки

                    MarginValues[0] = (int)Grid[IndexX, IndexY].Model.Margin.Left + CellHeight;   //  берутся координаты
                    MarginValues[1] = (int)Grid[IndexX, IndexY].Model.Margin.Top;                 //  соседней уже отрисованной
                    MarginValues[2] = (int)Grid[IndexX, IndexY].Model.Margin.Right - CellHeight;  //  ячейки 
                    MarginValues[3] = (int)Grid[IndexX, IndexY].Model.Margin.Bottom;              //  и смещаются на одну клетку

                    IndexX++;
                    Grid[IndexX, IndexY].Model.Margin = new Thickness(MarginValues[0], MarginValues[1], MarginValues[2], MarginValues[3]);
                    //  конец расчёта координат новой отрисованной ячейки

                    IndexY++;
                }
            }
        }