Example #1
0
        protected override void OnVisualChildrenChanged(DependencyObject visualAdded, DependencyObject visualRemoved)
        {
            base.OnVisualChildrenChanged(visualAdded, visualRemoved);
            int curRow = -1;
            int curCol = 0;

            RowDefinitions.Clear();

            if (Children != null)
            {
                foreach (UIElement curChild in Children)
                {
                    if (curCol == 0)
                    {
                        RowDefinitions.Add(new RowDefinition()
                        {
                            Height = new GridLength(1, GridUnitType.Auto)
                        });
                        curRow += 1;
                    }

                    Grid.SetRow(curChild, curRow);
                    Grid.SetColumn(curChild, curCol);

                    curCol += 1;
                    if (curCol == 2)
                    {
                        curCol = 0;
                    }
                }
            }
        }
        private void BuildTiles()
        {
            if (RowDefinitions.Any())
            {
                RowDefinitions.Clear();
            }

            BuildColumns();

            Children.Clear();

            var tiles = ItemsSource;

            if (tiles != null)
            {
                var numberOfRows = Math.Ceiling(tiles.Count / (float)MaxColumns);
                for (var i = 0; i < numberOfRows; i++)
                {
                    RowDefinitions.Add(new RowDefinition { Height = 200f });
                }

                for (var index = 0; index < tiles.Count; index++)
                {
                    var column = index % MaxColumns;
                    var row = (int)Math.Floor(index / (float)MaxColumns);

                    var tile = BuildTile(tiles[index]);

                    Children.Add(tile, column, row);
                }
            }
        }
Example #3
0
        void updateGridDimensions()
        {
            if (ColumnWidth < 0 || RowHeight < 0)
            {
                return;
            }

            ColumnDefinitions.Clear();
            RowDefinitions.Clear();
            for (int i = 0; i < ColumnCount; i++)
            {
                ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = new GridLength(ColumnWidth)
                });
            }

            for (int i = 0; i < RowCount; i++)
            {
                RowDefinitions.Add(new RowDefinition()
                {
                    Height = new GridLength(RowHeight)
                });
            }
            System.Threading.Thread.Sleep(20);
            reArrangItems();
        }
Example #4
0
        void updateGridDimensions()
        {
            if (Dimensions.ColumnWidth < 0 || Dimensions.RowHeight < 0)
            {
                return;
            }

            ColumnDefinitions.Clear();
            RowDefinitions.Clear();

            int columnCount = Dimensions.ColumnCount > 0 ? Dimensions.ColumnCount : 1;
            int rowCount    = Dimensions.RowCount > 0 ? Dimensions.RowCount : 1;

            for (int i = 0; i < columnCount; i++)
            {
                ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = new GridLength(Dimensions.ColumnWidth)
                });
            }

            for (int i = 0; i < rowCount; i++)
            {
                RowDefinitions.Add(new RowDefinition()
                {
                    Height = new GridLength(Dimensions.RowHeight)
                });
            }

            reArrangItems();
        }
Example #5
0
 public virtual void Clear()
 {
     Children.Clear();
     ColumnDefinitions.Clear();
     RowDefinitions.Clear();
     init();
 }
        public void UpdateAccordionLayout()
        {
            RowDefinitions.Clear();
            ColumnDefinitions.Clear();
            int i = 0;

            foreach (UIElement child in Children)
            {
                if (child is AccordionItem && !(child as AccordionItem).IsExpanded)
                {
                    ColumnDefinitions.Add(new ColumnDefinition()
                    {
                        Width = GridLength.Auto
                    });
                }
                else
                {
                    ColumnDefinitions.Add(new ColumnDefinition()
                    {
                        Width = new GridLength(1, GridUnitType.Star)
                    });
                }
                Grid.SetColumn(child, i);
                i++;
            }
            InvalidateMeasure();
        }
Example #7
0
 public void SetupOrientation()
 {
     ColumnDefinitions.Clear();
     RowDefinitions.Clear();
     if (Orientation == LayoutSystemOrientation.HORIZONTAL)
     {
         RowDefinition rd = new RowDefinition();
         if (HorizontalAlignment == HorizontalAlignment.Stretch)
         {
             rd.Height = new GridLength(1, GridUnitType.Star);
         }
         else
         {
             rd.Height = new GridLength(1, GridUnitType.Auto);
         }
         RowDefinitions.Add(rd);
     }
     else
     {
         ColumnDefinition cd = new ColumnDefinition();
         if (VerticalAlignment == VerticalAlignment.Stretch)
         {
             cd.Width = new GridLength(1, GridUnitType.Star);
         }
         else
         {
             cd.Width = new GridLength(1, GridUnitType.Auto);
         }
         ColumnDefinitions.Add(cd);
     }
 }
        private void UpdateRowsAndColumns()
        {
            if (_prices != null && _currency != null)
            {
                Children.Clear();
                RowDefinitions.Clear();

                for (int i = 0; i < _prices.Count; i++)
                {
                    var price = _prices[i];

                    var label = new TextBlock();
                    label.Style  = App.Current.Resources["DisabledBodyTextBlockStyle"] as Style;
                    label.Text   = price.Label;
                    label.Margin = new Thickness(12, 4, 0, 4);

                    var amount = new TextBlock();
                    amount.Style         = App.Current.Resources["DisabledBodyTextBlockStyle"] as Style;
                    amount.Text          = BindConvert.Current.FormatAmount(price.Amount, _currency);
                    amount.Margin        = new Thickness(8, 4, 12, 4);
                    amount.TextAlignment = TextAlignment.Right;

                    Grid.SetRow(label, i);
                    Grid.SetRow(amount, i);
                    Grid.SetColumn(amount, 1);

                    Children.Add(label);
                    Children.Add(amount);
                    RowDefinitions.Add(new RowDefinition {
                        Height = new GridLength(0, GridUnitType.Auto)
                    });
                }
            }
        }
Example #9
0
        public void BuildTiles(IEnumerable <object> tiles)
        {
            try
            {
                if (tiles == null || tiles.Count() == 0)
                {
                    Children?.Clear();
                }

                // Wipe out the previous row definitions if they're there.
                RowDefinitions?.Clear();

                var enumerable   = tiles as IList ?? tiles.ToList();
                var numberOfRows = Math.Ceiling(enumerable.Count / (float)MaxColumns);

                for (var i = 0; i < numberOfRows; i++)
                {
                    RowDefinitions?.Add(new RowDefinition {
                        Height = TileHeight
                    });
                }

                for (var index = 0; index < enumerable.Count; index++)
                {
                    var column = index % MaxColumns;
                    var row    = (int)Math.Floor(index / (float)MaxColumns);

                    var tile = BuildTile(enumerable[index]);

                    Children?.Add(tile, column, row);
                }
            }
            catch { // can throw exceptions if binding upon disposal
            }
        }
Example #10
0
        private void UpdateChildren()
        {
            var alreadyContainedChildren = Children.OfType <ILayoutControl>().ToArray();

            DetachOldSplitters();
            DetachPropertyChangeHandler();
            Children.Clear();
            ColumnDefinitions.Clear();
            RowDefinitions.Clear();
            var manager = _model?.Root?.Manager;

            if (manager == null)
            {
                return;
            }
            foreach (var child in _model.Children)
            {
                var foundContainedChild = alreadyContainedChildren.FirstOrDefault(chVM => chVM.Model == child);
                if (foundContainedChild != null)
                {
                    Children.Add(foundContainedChild as UIElement);
                }
                else
                {
                    Children.Add(manager.CreateUIElementForModel(child));
                }
            }
            CreateSplitters();
            UpdateRowColDefinitions();
            AttachNewSplitters();
            AttachPropertyChangeHandler();
        }
    protected override void OnVisualChildrenChanged(System.Windows.DependencyObject visualAdded, System.Windows.DependencyObject visualRemoved)
    {
        base.OnVisualChildrenChanged(visualAdded, visualRemoved);
        int curRow = -1;
        int curCol = 1;

        RowDefinitions.Clear();
        if (Children != null)
        {
            foreach (System.Windows.UIElement curChild in Children)
            {
                if (curCol == 0)
                {
                    curCol = 1;
                }
                else
                {
                    curCol = 0;
                    curRow++;
                    RowDefinitions.Add(new RowDefinition()
                    {
                        Height = new System.Windows.GridLength(1, System.Windows.GridUnitType.Auto)
                    });
                }
                Grid.SetRow(curChild, curRow);
                Grid.SetColumn(curChild, curCol);
            }
        }
        RowDefinitions.Add(new RowDefinition()
        {
            Height = new System.Windows.GridLength(1, System.Windows.GridUnitType.Star)
        });
    }
        private void UpdateRowsAndColumns()
        {
            if (_options != null && _currency != null)
            {
                Children.Clear();
                RowDefinitions.Clear();

                Shipping = _options[0];

                for (int i = 0; i < _options.Count; i++)
                {
                    var option = _options[i];

                    var radio = new RadioButton();
                    radio.IsChecked   = i == 0;
                    radio.Content     = BindConvert.Current.ShippingOption(option, _currency);
                    radio.Margin      = new Thickness(12, 4, 12, 4);
                    radio.DataContext = option;
                    radio.Checked    += (s, args) =>
                    {
                        Shipping = radio.DataContext as ShippingOption;
                    };

                    Grid.SetRow(radio, i);

                    Children.Add(radio);
                    RowDefinitions.Add(new RowDefinition {
                        Height = new GridLength(0, GridUnitType.Auto)
                    });
                }
            }
        }
Example #13
0
 private void Reset()
 {
     _keys = null;
     Children.Clear();
     RowDefinitions.Clear();
     ColumnDefinitions.Clear();
 }
Example #14
0
        private void AddRows(int count)
        {
            RowDefinitions.Clear();
            RowDefinition firstRow = new RowDefinition();

            firstRow.Height = new GridLength(1, GridUnitType.Star);
            RowDefinitions.Add(firstRow);

            for (int i = 0; i < count; i++)
            {
                RowDefinition spaceBetween = new RowDefinition();
                spaceBetween.Height = new GridLength(20);
                RowDefinitions.Add(spaceBetween);

                RowDefinition cards = new RowDefinition();
                cards.Height = GridLength.Auto;
                RowDefinitions.Add(cards);
            }

            RowDefinition lastSpaceBetween = new RowDefinition();

            lastSpaceBetween.Height = new GridLength(20);
            RowDefinitions.Add(lastSpaceBetween);

            RowDefinition lastRow = new RowDefinition();

            lastRow.Height = new GridLength(1, GridUnitType.Star);
            RowDefinitions.Add(lastRow);
        }
Example #15
0
        public async Task BuildTiles <T>(IEnumerable <T> tiles)
        {
            // Wipe out the previous row definitions if they're there.
            if (RowDefinitions.Any())
            {
                RowDefinitions.Clear();
            }
            var enumerable   = tiles as IList <T> ?? tiles.ToList();
            var numberOfRows = Math.Ceiling(enumerable.Count / (float)MaxColumns);

            for (var i = 0; i < numberOfRows; i++)
            {
                RowDefinitions.Add(new RowDefinition {
                    Height = TileHeight
                });
            }

            for (var index = 0; index < enumerable.Count; index++)
            {
                var column = index % MaxColumns;
                var row    = (int)Math.Floor(index / (float)MaxColumns);

                var tile = await BuildTile(enumerable[index]);

                Children.Add(tile, column, row);
            }
        }
        public void BindGridStructure()
        {
            RowDefinitions.Clear();
            ColumnDefinitions.Clear();


            Observable.Range(0, Rows)
            .Subscribe(c =>
            {
                var rowDef = new RowDefinition();
                if (CellHeight > 0)
                {
                    rowDef.Height = new GridLength(CellHeight);
                }
                RowDefinitions.Add(rowDef);
            });

            Observable.Range(0, Columns)
            .Subscribe(c =>
            {
                var def = new ColumnDefinition();
                if (CellWidth > 0)
                {
                    def.Width = new GridLength(CellWidth);
                }
                ColumnDefinitions.Add(def);
            });
        }
Example #17
0
        private void Init(int row, int column)
        {
            _game = new Game(row, column, row * column / 6, this);

            RowDefinitions.Clear();
            for (int i = 0; i < row; i++)
            {
                RowDefinitions.Add(new RowDefinition());
            }

            ColumnDefinitions.Clear();
            for (int i = 0; i < column; i++)
            {
                ColumnDefinitions.Add(new ColumnDefinition());
            }

            for (int i = 0; i < row; i++)
            {
                for (int j = 0; j < column; j++)
                {
                    var cell = new Cell(i, j, this);
                    SetRow(cell, i);
                    SetColumn(cell, j);
                    Children.Add(cell);
                }
            }

            Invalidate();
        }
Example #18
0
 private void ResetGrid()
 {
     Children.Clear();
     RowDefinitions.Clear();
     _populatingRow    = 0;
     _selectedTrackRow = -1;
     _justClickedTrack = false;
 }
Example #19
0
        private void SetHorizontalMode()
        {
            ColumnDefinitions.Clear();
            RowDefinitions.Clear();

            var b1 = new Binding
            {
                Source = this,
                Path   = new PropertyPath("OverviewWidth"),
                Mode   = BindingMode.TwoWay,
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
            };

            var cdef1 = new ColumnDefinition {
                MinWidth = 50
            };

            BindingOperations.SetBinding(cdef1, ColumnDefinition.WidthProperty, b1);

            ColumnDefinitions.Add(cdef1);
            ColumnDefinitions.Add(new ColumnDefinition {
                Width = GridLength.Auto
            });
            ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(2, GridUnitType.Star), MinWidth = 50
            });

            RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });

            foreach (UIElement child in Children)
            {
                switch (GetChildType(child))
                {
                case MainCenterGridChildType.NoteList:
                    Grid.SetColumn(child, 0);
                    Grid.SetRow(child, 0);
                    break;

                case MainCenterGridChildType.Splitter:
                    Grid.SetColumn(child, 1);
                    Grid.SetRow(child, 0);
                    ((GridSplitter)child).HorizontalAlignment = HorizontalAlignment.Stretch;
                    ((GridSplitter)child).VerticalAlignment   = VerticalAlignment.Stretch;
                    ((GridSplitter)child).Width  = 3;
                    ((GridSplitter)child).Height = double.NaN;
                    break;

                case MainCenterGridChildType.NoteView:
                    Grid.SetColumn(child, 2);
                    Grid.SetRow(child, 0);
                    break;
                }
            }

            _isCurrentlyVerticalMode = false;
        }
Example #20
0
        private void FieldPropertyChanged(Field oldValue, Field newValue)
        {
            if (oldValue != null)
            {
                oldValue.Evaluated -= Field_Evaluated;
            }

            if (viewField != null)
            {
            }
            viewField = null;

            Children.Clear();
            ColumnDefinitions.Clear();
            RowDefinitions.Clear();

            if (newValue != null)
            {
                newValue.Evaluated += Field_Evaluated;

                for (int i = 0; newValue.Width > i; i++)
                {
                    ColumnDefinitions.Add(new ColumnDefinition());
                }
                for (int i = 0; newValue.Height > i; i++)
                {
                    RowDefinitions.Add(new RowDefinition());
                }

                var field = newValue.Map;

                foreach (var cell in field)
                {
                    cell.SynchronizationContext = System.Threading.SynchronizationContext.Current;
                }

                var h = field.GetLength(0);
                var w = field.GetLength(1);
                viewField = new CellView[h, w];

                for (int y = 0; h > y; y++)
                {
                    for (int x = 0; w > x; x++)
                    {
                        CellView view = new CellView();
                        view.Margin = new Thickness(5);
                        view.Cell   = field[y, x];

                        viewField[y, x] = view;

                        SetRow(view, y);
                        SetColumn(view, x);
                        Children.Add(view);
                    }
                }
            }
        }
Example #21
0
        private void SetRowDefinitions(RowDefinitions rowDefinitions)
        {
            RowDefinitions.Clear();

            foreach (var rowDefinition in rowDefinitions)
            {
                RowDefinitions.Add(rowDefinition);
            }
        }
Example #22
0
        private void PrepareColumnAndRowLayout()
        {
            // Recreate columns and rows only after dimensions changed.
            if (_actualWidth == ActualWidth && _actualHeight == ActualHeight)
            {
                return;
            }
            _actualWidth  = ActualWidth;
            _actualHeight = ActualHeight;

            ColumnDefinitions.Clear();
            RowDefinitions.Clear();

            // Only reserve space if a template is set
            double headersOffset = 0d;

            if (GroupButtonEnabled)
            {
                headersOffset = GroupButtonWidth;
                ColumnDefinition groupButtonColumn = new ColumnDefinition {
                    Width = new GridLength(GridUnitType.Pixel, headersOffset)
                };
                ColumnDefinitions.Add(groupButtonColumn);
            }

            double headerWidth = HeaderWidth;

            headersOffset += headerWidth;
            ColumnDefinition rowHeaderColumn = new ColumnDefinition {
                Width = new GridLength(GridUnitType.Pixel, headerWidth)
            };

            ColumnDefinitions.Add(rowHeaderColumn);

            double rowHeight = ActualHeight / _numberOfRows;
            double colWidth  = (ActualWidth - headersOffset) / _numberOfColumns;

            for (int c = 0; c < _numberOfColumns; c++)
            {
                ColumnDefinition cd = new ColumnDefinition {
                    Width = new GridLength(GridUnitType.Pixel, colWidth)
                };
                ColumnDefinitions.Add(cd);
            }
            for (int r = 0; r < _numberOfRows; r++)
            {
                RowDefinition cd = new RowDefinition {
                    Height = new GridLength(GridUnitType.Pixel, rowHeight)
                };
                RowDefinitions.Add(cd);
            }

            SetInitialViewOffset();
            RecreateAndArrangeChildren(true);
            RestoreFocusPosition(true);
        }
Example #23
0
 private void GenerateRowDefinitionsFromScript(string script)
 {
     RowDefinitions.Clear();
     script?.Split(RowColumnScriptPartSplitDelimiters, StringSplitOptions.RemoveEmptyEntries)
     .SelectMany(ExpandStringDefinition)
     .ForEach(e =>
     {
         RowDefinitions.Add(RowColumnDefinition.FromString(e).ToRowDefinition());
     });
 }
        private void ArrangeChildren()
        {
            if (_arrangeChildren == false)
            {
                _arrangeChildren = true;

                RowDefinitions.Clear();
                ColumnDefinitions.Clear();

                var children = Children.Cast <FrameworkElement>().ToArray();

                if (Orientation == Orientation.Vertical)
                {
                    var index = 0;
                    var rows  = RowDefinitions;

                    foreach (var child in children)
                    {
                        rows.Add(new RowDefinition
                        {
                            Height    = CalcChildLength(child, child.Height),
                            MinHeight = child.MinHeight,
                            MaxHeight = child.MaxHeight
                        });

                        SetRow(child, index);
                        SetColumn(child, 0);

                        ++index;
                    }
                }
                else
                {
                    var index   = 0;
                    var columns = ColumnDefinitions;

                    foreach (var child in children)
                    {
                        columns.Add(new ColumnDefinition
                        {
                            Width    = CalcChildLength(child, child.Width),
                            MinWidth = child.MinWidth,
                            MaxWidth = child.MaxWidth
                        });

                        SetRow(child, 0);
                        SetColumn(child, index);

                        ++index;
                    }
                }

                _arrangeChildren = false;
            }
        }
Example #25
0
    private void OnNumberOfItemsChangedImpl()
    {
        var numOfChildren = _currentChildrenCount;

        using (var d = Dispatcher.DisableProcessing())
        {
            RowDefinitions.Clear();
            ColumnDefinitions.Clear();
            if (numOfChildren > 0)
            {
                var squareLength = getSquareLength(numOfChildren);
                var numOfCols    = getColumns(squareLength);
                var numOfRows    = getRows(squareLength);
                for (var i = 0; i < numOfRows; i++)
                {
                    RowDefinitions.Add(new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    });
                }
                for (var i = 0; i < numOfCols; i++)
                {
                    ColumnDefinitions.Add(new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    });
                }
                var adjustWidthFactor    = 1.0;
                var adjustWidthOnLastRow = numOfChildren < (numOfCols * numOfRows);
                if (adjustWidthOnLastRow)
                {
                    var notEmptySlots = (numOfChildren % numOfCols);
                    adjustWidthFactor = ((double)numOfCols / (double)notEmptySlots);
                }
                int row = 0, col = 0;
                foreach (var view in Children)
                {
                    var cell = (FrameworkElement)view;
                    SetRow(cell, row);
                    SetColumn(cell, col);
                    if (adjustWidthOnLastRow && row == (numOfRows - 1))
                    {
                        SetAdjustColumnWidth(cell, adjustWidthFactor);
                    }
                    else
                    {
                        SetAdjustColumnWidth(cell, 1.0);
                    }
                    if (++col >= numOfCols)
                    {
                        col = 0;
                        row++;
                    }
                }
            }
        }
    }
Example #26
0
        public void BuildTiles(IEnumerable <object> tiles)
        {
            try
            {
                if (tiles == null || tiles.Count() == 0)
                {
                    Children?.Clear();
                }

                var t     = ItemsSource.GetType();
                var isObs = t.GetTypeInfo().IsGenericType&& ItemsSource.GetType().GetGenericTypeDefinition() == typeof(ObservableCollection <>);
                if (isObs)
                {
                    ObservableSource = new ObservableCollection <object>(ItemsSource.Cast <object>());
                }

                // Wipe out the previous definitions if they're there.
                RowDefinitions?.Clear();
                ColumnDefinitions?.Clear();

                var enumerable   = ObservableSource as IList ?? tiles.ToList();
                var numberOfRows = Math.Ceiling(enumerable.Count / (float)MaxColumns);

                for (var i = 0; i < MaxColumns; i++)
                {
                    ColumnDefinitions.Add(new ColumnDefinition {
                        Width = GridLength.Star
                    });
                }

                for (var i = 0; i < numberOfRows; i++)
                {
                    RowDefinitions?.Add(new RowDefinition {
                        Height = TileHeight
                    });
                }

                for (var index = 0; index < enumerable.Count; index++)
                {
                    var column = index % MaxColumns;
                    var row    = (int)Math.Floor(index / (float)MaxColumns);

                    var tile = BuildTile(enumerable[index]);

                    Children.Add(tile, column, row);
                }
                //ForceLayout();
            }
            catch
            { // can throw exceptions if binding upon disposal
              /*throw new Exception(" Unhandled excepection while building tiles");*/
            }
        }
Example #27
0
        private void SetRows(string rows)
        {
            var items = GridUtil.ParseAll(rows);

            RowDefinitions.Clear();
            foreach (var item in items)
            {
                RowDefinitions.Add(new RowDefinition {
                    Height = item
                });
            }
        }
Example #28
0
 /// <summary>
 /// Clear Rung (delete all components)
 /// </summary>
 public RungUI Clear()
 {
     Children.Clear();
     ColumnDefinitions.Clear();
     RowDefinitions.Clear();
     _LogicalRung.Clear();
     _Components.Clear();
     _Wires.Clear();
     AddColumn();
     AddRow();
     return(this);
 }
 private void UpdateRowDefinitions()
 {
     RowDefinitions.Clear();
     for (int i = 0; i < Rows; i++)
     {
         RowDefinitions.Add(new RowDefinition());
     }
     if (DesignerProperties.GetIsInDesignMode(this) == true)
     {
         AddDesignTimeBorders();
     }
 }
Example #30
0
        protected override Size MeasureOverride(Size constraint)
        {
            UpdateComputedValues();

            RowDefinitions.Clear();
            ColumnDefinitions.Clear();

            for (var i = 0; i < Rows; i++)
            {
                RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(1, GridUnitType.Star)
                });
            }

            for (var i = 0; i < Columns; i++)
            {
                ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });
            }

            var count = 0;

            for (var r = 0; r < Rows; r++)
            {
                for (var c = 0; c < Columns; c++)
                {
                    if (count > Children.Count - 1)
                    {
                        continue;
                    }

                    Children[count].Measure(constraint);

                    if (RowDefinitions[r].MinHeight < Children[count].DesiredSize.Height)
                    {
                        RowDefinitions[r].MinHeight = Children[count].DesiredSize.Height;
                    }

                    if (ColumnDefinitions[c].MinWidth < Children[count].DesiredSize.Width)
                    {
                        ColumnDefinitions[c].MinWidth = Children[count].DesiredSize.Width + 6;
                    }

                    SetColumn(Children[count], c);
                    SetRow(Children[count], r);
                    count++;
                }
            }

            return(base.MeasureOverride(constraint));
        }