Ejemplo n.º 1
0
        private void AddCols(int count)
        {
            ColumnDefinitions.Clear();
            ColumnDefinition firstColumn = new ColumnDefinition();

            firstColumn.Width = new GridLength(1, GridUnitType.Star);
            ColumnDefinitions.Add(firstColumn);

            for (int i = 0; i < count; i++)
            {
                ColumnDefinition spaceBetween = new ColumnDefinition();
                spaceBetween.Width = new GridLength(20);
                ColumnDefinitions.Add(spaceBetween);

                ColumnDefinition cards = new ColumnDefinition();
                cards.Width = GridLength.Auto;
                ColumnDefinitions.Add(cards);
            }

            ColumnDefinition lastSpaceBetween = new ColumnDefinition();

            lastSpaceBetween.Width = new GridLength(20);
            ColumnDefinitions.Add(lastSpaceBetween);

            ColumnDefinition lastColumn = new ColumnDefinition();

            lastColumn.Width = new GridLength(1, GridUnitType.Star);
            ColumnDefinitions.Add(lastColumn);
        }
Ejemplo n.º 2
0
 public AccordionGrid()
 {
     HorizontalOptions = LayoutOptions.FillAndExpand;
     HeightRequest     = 60;
     ColumnDefinitions.Add(new ColumnDefinition()
     {
         Width = new GridLength(45)
     });
     ColumnDefinitions.Add(new ColumnDefinition()
     {
         Width = new GridLength(1, GridUnitType.Star)
     });
     ColumnDefinitions.Add(new ColumnDefinition()
     {
         Width = new GridLength(30)
     });
     RowDefinitions.Add(new RowDefinition()
     {
         Height = new GridLength(1, GridUnitType.Star)
     });
     RowDefinitions.Add(new RowDefinition()
     {
         Height = new GridLength(1)
     });
 }
Ejemplo n.º 3
0
        public CredentialEntry()
        {
            HorizontalOptions = LayoutOptions.FillAndExpand;

            ColumnDefinitions.Add(new ColumnDefinition {
                Width = GridLength.Star
            });
            ColumnDefinitions.Add(new ColumnDefinition {
                Width = GridLength.Auto
            });

            entry = new Entry
            {
                IsPassword = true,
            };

            entry.TextChanged += (s, e) => OnCredentialChanged(e.NewTextValue);

            button = new Button
            {
                IsEnabled = false,
            };

            SetColumn(button, 1);

            button.Clicked += (s, e) => Commit(NeedsCredentials ? entry.Text : null);

            Children.Add(entry);
            Children.Add(button);
        }
Ejemplo n.º 4
0
        private bool CreateCells(object item)
        {
            var columnIndex = 0;
            var hasStar     = false;

            foreach (var column in DataGrid.Columns)
            {
                var cell = column.CreateCell(DataGrid, item);
                cell.Control.Tag         = cell;
                cell.Control.DataContext = item;

                var cellControl = new ContentPresenter();
                cellControl.Content         = cell;
                cellControl.ContentTemplate = DataGrid.CellTemplate;

                SetColumn(cellControl, columnIndex++);
                Children.Add(cellControl);

                var columnDefinition = column.CreateGridColumnDefinition();
                hasStar = hasStar || columnDefinition.Width.IsStar;

                ColumnDefinitions.Add(columnDefinition);
            }
            return(hasStar);
        }
        public ListItemBlockView(DocumentEditorContextView root, ListItemBlock listItemBlock)
        {
            _root          = root;
            _listItemBlock = listItemBlock;
            _childContents = new StackPanel();
            SetRow(_childContents, 0);
            SetColumn(_childContents, 1);

            _listSymbol      = new TextBlock();
            _listSymbol.Text = " - ";
            SetRow(_listSymbol, 0);
            SetColumn(_listSymbol, 0);

            Children.Add(_listSymbol);
            Children.Add(_childContents);

            ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = GridLength.Auto
            });
            ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(1, GridUnitType.Star)
            });

            foreach (var block in listItemBlock.Children)
            {
                var view = _root.CreateViewFor(block);
                Children.Add(view);
            }
        }
Ejemplo n.º 6
0
 public DUOFrameViewer()
 {
     ColumnDefinitions.Add(new ColumnDefinition());
     ColumnDefinitions.Add(new ColumnDefinition());
     images  = new DUOImage[2];
     Loaded += DUOFrameViewer_Loaded;
 }
Ejemplo n.º 7
0
        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();
        }
        public MultiColumnFlowGrid(int num_columns, double spacing)
        {
            this.num_columns = num_columns;
            this.spacing     = spacing;

            // Add the column definitions
            for (int i = 0; i < num_columns; ++i)
            {
                if (0 != i && 0 != spacing)
                {
                    ColumnDefinition cd = new ColumnDefinition();
                    cd.Width = new GridLength(spacing);
                    ColumnDefinitions.Add(cd);
                }

                {
                    ColumnDefinition cd = new ColumnDefinition();
                    cd.Width = new GridLength(1, GridUnitType.Star);
                    ColumnDefinitions.Add(cd);
                }
            }

            // Add the first row
            RowDefinitions.Add(new RowDefinition());
        }
Ejemplo n.º 9
0
        protected override void OnSizeAllocated(double width, double height)
        {
            base.OnSizeAllocated(width, height);

            if (RowDefinitions.Count == 0 && ColumnDefinitions.Count == 0 && width != -1 && height != -1)
            {
                for (var i = 0; i < MaxColumns; i++)
                {
                    try
                    {
                        if (Math.Abs(TileHeight) < 0.01)
                        {
                            RowDefinitions.Add(new RowDefinition()
                            {
                                Height = new GridLength(width / MaxColumns)
                            });
                        }
                        else
                        {
                            RowDefinitions.Add(new RowDefinition()
                            {
                                Height = TileHeight
                            });
                        }

                        ColumnDefinitions.Add(new ColumnDefinition());
                    }

                    catch (Exception e)
                    {
                        System.Diagnostics.Debug.WriteLine(e.Message);
                    }
                }
            }
        }
Ejemplo n.º 10
0
 public LabeledPricesPanel()
 {
     ColumnDefinitions.Add(new ColumnDefinition());
     ColumnDefinitions.Add(new ColumnDefinition {
         Width = new GridLength(0, GridUnitType.Auto)
     });
 }
Ejemplo n.º 11
0
        //helper method for laying out all elements in the view grid
        private void SetupView()
        {
            HorizontalOptions = LayoutOptions.FillAndExpand;
            HeightRequest     = 100;

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

            ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(20)
            });


            Children.Add(time, 0, 0);
            Children.Add(date, 0, 1);
            Children.Add(close, 1, 0);
            SetRowSpan(close, 2);
        }
Ejemplo n.º 12
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();
        }
Ejemplo n.º 13
0
        public LabelValuePanel()
        {
            ColumnDefinitions.Add(new ColumnDefinition {
                Width = GridLength.Auto
            });
            ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(6)
            });
            ColumnDefinitions.Add(new ColumnDefinition());

            Loaded += delegate
            {
                Enumerable
                .Range(1, (Children.Count / 2))
                .Apply(x => RowDefinitions.Add(new RowDefinition {
                    Height = GridLength.Auto
                }));

                for (var index = 0; index < Children.Count; index++)
                {
                    var row = index / 2;
                    var col = (index % 2 == 1) ? 2 : 0;

                    var child = (FrameworkElement)Children[index];

                    SetColumn(child, col);
                    SetRow(child, row);
                }
            };
        }
Ejemplo n.º 14
0
            public TealTemplate()
            {
                RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(0.1, GridUnitType.Star)
                });
                RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(0.8, GridUnitType.Star)
                });
                RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(0.1, GridUnitType.Star)
                });
                ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(0.05, GridUnitType.Star)
                });
                ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(0.95, GridUnitType.Star)
                });

                var topBoxView = new BoxView {
                    Color = Color.DarkGray
                };

                Children.Add(topBoxView, 0, 0);
                Grid.SetColumnSpan(topBoxView, 2);
            }
Ejemplo n.º 15
0
        public ScoreboardHeader()
        {
            var fontSize = 16;

            email = new Button {
                Text           = "Person",
                FontAttributes = FontAttributes.Bold,
                FontSize       = fontSize
            };

            count = new Button {
                Text           = "Count",
                FontAttributes = FontAttributes.Bold,
                FontSize       = fontSize
            };

            mean = new Button {
                Text           = "Reply Time",
                FontAttributes = FontAttributes.Bold,
                FontSize       = fontSize
            };

            count.Clicked += (object sender, EventArgs e) => {
                var model = (MainPageViewModel)BindingContext;
                model.CurrentSort          = "EmailCount";
                model.CurrentSortAscending = !model.CurrentSortAscending;
                model.FilterSort();
            };

            email.Clicked += (object sender, EventArgs e) => {
                var model = (MainPageViewModel)BindingContext;
                model.CurrentSort          = "Name";
                model.CurrentSortAscending = !model.CurrentSortAscending;
                model.FilterSort();
            };

            mean.Clicked += (object sender, EventArgs e) => {
                var model = (MainPageViewModel)BindingContext;
                model.CurrentSort          = "MeanReplyTime";
                model.CurrentSortAscending = !model.CurrentSortAscending;
                model.FilterSort();
            };

            ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Auto)
            });
            ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Auto)
            });

            Padding = 10;

            Children.Add(email, 0, 0);
            Children.Add(count, 1, 0);
            Children.Add(mean, 2, 0);
        }
Ejemplo n.º 16
0
        public CustomComboBox()
        {
            HeightRequest = ComboBoxHeight;
            ColumnSpacing = 0;
            ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(1, GridUnitType.Star)
            });
            ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(1, GridUnitType.Auto)
            });

            _caretDownLabel                   = new Label();
            _caretDownLabel.FontFamily        = ((OnPlatform <string>)Application.Current.Resources["FontAwesomeLight"]).GetRuntimePlatformValue();
            _caretDownLabel.Text              = FontAwesome.FontAwesomeIcons.AngleDown;
            _caretDownLabel.FontSize          = Device.GetNamedSize(NamedSize.Large, _caretDownLabel);
            _caretDownLabel.HorizontalOptions = LayoutOptions.End;
            _caretDownLabel.VerticalOptions   = LayoutOptions.End;
            _caretDownLabel.TextColor         = Color.FromHex("#539f90");
            _caretDownLabel.Margin            = new Thickness(8, 0, 16, 8);
            SetColumn(_caretDownLabel, 1);
            Children.Add(_caretDownLabel);

            TappedCommand = new Command(ControlTapped);
            var rec = new TapGestureRecognizer();

            rec.BindingContext = this;
            rec.SetBinding(TapGestureRecognizer.CommandProperty, new Binding(nameof(TappedCommand)));
            GestureRecognizers.Add(rec);

            var underline = new BoxView()
            {
                HeightRequest = 0.5, HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.End, BackgroundColor = ColorScheme.TextColor, Margin = new Thickness(4, 0)
            };

            SetColumnSpan(underline, 2);
            Children.Add(underline);

            _textLabel = new Label();
            _textLabel.LineBreakMode     = LineBreakMode.TailTruncation;
            _textLabel.HorizontalOptions = LayoutOptions.Start;
            _textLabel.VerticalOptions   = LayoutOptions.End;
            _textLabel.TextColor         = ColorScheme.TextColor;
            _textLabel.Margin            = new Thickness(15, 0, 0, 8);
            _textLabel.FontFamily        = ((OnPlatform <string>)Application.Current.Resources["UiFontSemiBold"]).GetRuntimePlatformValue();
            _textLabel.FontSize          = (double)Application.Current.Resources["MediumFontSize"];
            Children.Add(_textLabel);

            _placeHolderLabel = new Label();
            _placeHolderLabel.BindingContext = this;
            _placeHolderLabel.SetBinding(Label.TextProperty, new Binding(nameof(Placeholder), BindingMode.OneWay));
            _placeHolderLabel.HorizontalOptions = LayoutOptions.Start;
            _placeHolderLabel.VerticalOptions   = LayoutOptions.Start;
            _placeHolderLabel.TextColor         = ColorScheme.TextColor;
            _placeHolderLabel.FontSize          = (double)Application.Current.Resources["SemiSmallFontSize"];
            _placeHolderLabel.Margin            = new Thickness(15, 4, 0, 0);
            Children.Add(_placeHolderLabel);
        }
Ejemplo n.º 17
0
        private ColumnDefinitions CalculateBuildColumnDefinitions(HexControlViewModel viewModel)
        {
            ColumnDefinitions columnDefinitions = new ColumnDefinitions();

            // 1. the first column is the description column
            columnDefinitions.Add(new ColumnDefinition(GridLength.Auto));
            // 2. the second column is a placeholder
            columnDefinitions.Add(new ColumnDefinition(GRID_PLACEHOLDER_MARGIN, GridUnitType.Pixel));

            // 3. add 16 columns for the data
            for (int index = 0; index < Math.Min(16, viewModel.HexValueViewModels.Count); index++)
            {
                columnDefinitions.Add(new ColumnDefinition(GridLength.Auto));
            }

            return(columnDefinitions);
        }
Ejemplo n.º 18
0
 public OutlinerDocument()
 {
     __ColumnsDefinitions = new ColumnDefinitions();
     __ColumnsDefinitions.Add(new OutlinerColumnDefinition("Topic", ColumnDataType.RichText));
     __FakeRootNote = new OutlinerNote(this, new OutlinerNoteCollection(this));
     __HoistedNodes = new List <OutlinerNote>();
     __UndoManager.UndoActionsCountChanged += new EventHandler(UndoManager_UndoActionsCountChanged);
 }
Ejemplo n.º 19
0
 public GridView()
 {
     InitializeComponent();
     for (var i = 0; i < MaxColumns; i++)
     {
         ColumnDefinitions.Add(new ColumnDefinition());
     }
 }
Ejemplo n.º 20
0
 public LabelValueGrid()
     : base()
 {
     ColumnDefinitions.Add(new ColumnDefinition());
     ColumnDefinitions.Add(new ColumnDefinition());
     ColumnDefinitions[0].Width = new System.Windows.GridLength(1, System.Windows.GridUnitType.Auto);
     ColumnDefinitions[1].Width = new System.Windows.GridLength(1, System.Windows.GridUnitType.Star);
 }
 private void BuildColumns()
 {
     ColumnDefinitions.Clear();
     for (var i = 0; i < MaxColumns; i++)
     {
         ColumnDefinitions.Add(new ColumnDefinition());
     }
 }
Ejemplo n.º 22
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:XCC.DemoApp.Controls.ResponsiveGrid"/> class.
        /// </summary>
        public ResponsiveGrid()
        {
            RowDefinitions.Add(new RowDefinition());
            RowDefinitions.Add(new RowDefinition());

            ColumnDefinitions.Add(new ColumnDefinition());
            ColumnDefinitions.Add(new ColumnDefinition());
        }
    void UpdateChildren()
    {
        int rowNb    = RowDefinitions.Count;
        int columnNb = ColumnDefinitions.Count;

        if (columnNb == 0)
        {
            ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(50, GridUnitType.Star)
            });
            ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(50, GridUnitType.Star)
            });
            columnNb = ColumnDefinitions.Count;
        }
        foreach (UIElement child in Children)
        {
            //happens while editing the children collection in xaml
            //if we don't handle this, the Designer throws an exception
            if (child == null)
            {
                continue;
            }
            string name = ((FrameworkElement)child).Name;     // empty for the last child, when call from OnVisualChildrenChanged
            if (_nextRow >= RowDefinitions.Count)
            {
                RowDefinitions.Add(new RowDefinition()
                {
                    Height = new GridLength(1, GridUnitType.Auto)
                });
            }
            bool rowIsDefined    = child.ReadLocalValue(RowProperty) != DependencyProperty.UnsetValue;
            bool columnIsDefined = child.ReadLocalValue(ColumnProperty) != DependencyProperty.UnsetValue;
            if (rowIsDefined)
            {
                for (int i = RowDefinitions.Count; i < GetRow(child) + 1; i++)
                {
                    RowDefinitions.Add(new RowDefinition()
                    {
                        Height = new GridLength(1, GridUnitType.Auto)
                    });
                }
            }
            if (!rowIsDefined && !columnIsDefined)
            {
                SetRow(child, _nextRow);
                SetColumn(child, _nextColumn);
                _nextColumn += GetColumnSpan(child);
                if (_nextColumn >= columnNb)
                {
                    _nextColumn = 0;
                    _nextRow++;
                }
            }
        }
    }
Ejemplo n.º 24
0
        public ZXingScanOverlay(ZXingScanOverlayOptions options = null)
        {
            Options = options ?? new ZXingScanOverlayOptions();

            RowSpacing    = 0;
            ColumnSpacing = 0;

            VerticalOptions   = FillAndExpand;
            HorizontalOptions = FillAndExpand;

            RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            RowDefinitions.Add(new RowDefinition {
                Height = Options.ScanHeight
            });
            RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            ColumnDefinitions.Add(new ColumnDefinition {
                Width = Options.ScanWidth
            });
            ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });

            AddScreenArea();

            AddCenterArea();


            SetRow(Options.TopLabel, 0);
            SetColumnSpan(Options.TopLabel, 3);
            Children.Add(Options.TopLabel);


            SetRow(Options.BottomLabel, 2);
            SetColumnSpan(Options.BottomLabel, 3);
            Children.Add(Options.BottomLabel);



            var tapGestureRecognizer = new TapGestureRecognizer();

            tapGestureRecognizer.Tapped += (sender, e) =>
            {
                Options.FlashTappedAction?.Invoke();
            };
            Options.FlashLabel.GestureRecognizers.Add(tapGestureRecognizer);

            if (Options.ShowFlash)
            {
                Children.Add(Options.FlashLabel, 2, 2);
            }
        }
Ejemplo n.º 25
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;
        }
Ejemplo n.º 26
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);
                    }
                }
            }
        }
Ejemplo n.º 27
0
 public KeyValueGrid()
 {
     ColumnDefinitions.Add(new ColumnDefinition {
         Width = new GridLength(0.0, GridUnitType.Auto)
     });
     ColumnDefinitions.Add(new ColumnDefinition {
         Width = new GridLength(1.0, GridUnitType.Star)
     });
 }
Ejemplo n.º 28
0
        private void build()
        {
            for (int j = 0; j < itemsInHeight; j++)
            {
                RowDefinitions.Add(new RowDefinition());
            }
            for (int j = 0; j < itemsInWidth; j++)
            {
                ColumnDefinitions.Add(new ColumnDefinition());
            }

            for (int i = 0; i < itemsInHeight * itemsInWidth; i++)
            {
                for (int j = 0; j < itemsInHeight; j++)
                {
                    for (int k = 0; k < itemsInWidth; k++)
                    {
                        if (!autoAllSettings)
                        {
                            if (fontSize <= 0)
                            {
                                fontSize = 14.0;
                            }
                            items[i].setFontSize(fontSize);
                            items[i].setWidth(itemWidth);
                            items[i].setHeight(itemHeight);
                        }
                        else
                        {
                            items[i].setFontSize(14.0);
                            items[i].autoConuntAndSize = true;
                        }



                        StackPanel itemOnForm = items[i].getView();
                        if (!INIT.DEFAULT_VISUAL_STYLE)
                        {
                            itemOnForm.Background = new ImageBrush(STYLE.BUTTON);
                        }
                        else
                        {
                            itemOnForm.Background = Brushes.WhiteSmoke;
                        }
                        if (!windowtitle.Equals("WINDOW_MAINMENU"))
                        {
                            itemOnForm.ToolTip = items[i].getDescription();
                        }
                        Children.Add(itemOnForm);
                        SetRow(itemOnForm, j);
                        SetColumn(itemOnForm, k);

                        i++;
                    }
                }
            }
        }
Ejemplo n.º 29
0
        public PropertyContainer(string propertyName, ValueControl valueControl, FrameworkElement inactiveElement)
        {
            this.propertyName    = propertyName;
            this.activeElement   = valueControl;
            this.inactiveElement = inactiveElement;

            //Add three columns
            ColumnDefinitions.Add(new ColumnDefinition()
            {
            });
            ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width           = new GridLength(150),
                SharedSizeGroup = "PropGridColumn"
            });

            //Create wrappers
            keyWrapper = new Border()
            {
                Name = "keywrapper", Background = new SolidColorBrush(Colors.White)
            };
            valueWrapper = new Border()
            {
                Name = "valuewrapper", Background = new SolidColorBrush(Colors.White)
            };

            Grid.SetColumn(keyWrapper, 0);
            Grid.SetColumn(valueWrapper, 1);

            this.Children.Add(keyWrapper);
            this.Children.Add(valueWrapper);

            textLabel = new TextBlock();
            textLabel.TextTrimming = TextTrimming.CharacterEllipsis;
            textLabel.ToolTip      = propertyName;
            textLabel.Text         = propertyName;

            keyWrapper.Child = textLabel;
            //If we only have one element (e.g textblock or something, we set the child to this)
            //if we have both an active element and an inactive (E.G textbox for editing and textblock when inactive)
            //set the child to the inactive element
            if (inactiveElement == null)
            {
                valueWrapper.Child = valueControl.Control;
            }
            else
            {
                //Attach click listeners to the active element
                //we do this to not loose focus on the element
                //if the mouse moves outside this property containers bounds while editing it

                valueWrapper.Child = inactiveElement;
                //valueControl.Control.GotKeyboardFocus += ValueControl_GotKeyboardFocus;
            }

            this.Focusable = true;
        }
Ejemplo n.º 30
0
 /// <summary>
 /// When first child is added, it sets up first properties
 /// </summary>
 /// <param name="child">Child to add</param>
 private void AddFirstChild(IDockLayout child)
 {
     m_children.Add(child);
     Children.Add((FrameworkElement)child);
     ColumnDefinitions.Add(NewColumnDefinition(new GridLength(1, GridUnitType.Star), m_minGridSize.Width));
     RowDefinitions.Add(NewRowDefinition(new GridLength(1, GridUnitType.Star), m_minGridSize.Height));
     ((FrameworkElement)child).SetValue(Grid.ColumnProperty, 0);
     ((FrameworkElement)child).SetValue(Grid.RowProperty, 0);
 }
Ejemplo n.º 31
-1
			public RowCell(ResizableGrid owner, ColumnBase gridColumn, ContentControl contentControl)
				: base(owner) {
				GridColumnControl = contentControl;
				GridColumn = gridColumn;
				Row = BandedViewBehavior.GetRow(GridColumn);
				RowSpan = BandedViewBehavior.GetRowSpan(GridColumn);
				Column = BandedViewBehavior.GetColumn(GridColumn);
				ColumnSpan = BandedViewBehavior.GetColumnSpan(GridColumn);
				ColumnDefinitions = new ColumnDefinitions();
				for(int i = Column; i < Column + ColumnSpan; i++)
					ColumnDefinitions.Add(Owner.BandBehavior.ColumnDefinitions[i]);
			}