示例#1
0
        private void RenderLabel([NotNull] Grid grid, [NotNull] Field field, int count)
        {
            Assert.ArgumentNotNull(grid, nameof(grid));
            Assert.ArgumentNotNull(field, nameof(field));

            var label = new Default.Label
            {
                ContentEditor = ContentEditor,
                Field         = field,
                Margin        = new Thickness(8, 12, 8, 2)
            };

            grid.Children.Add(label);

            var row    = count / 2 * 2;
            var column = count % 2;

            label.SetValue(Grid.RowProperty, row);
            label.SetValue(Grid.ColumnProperty, column);

            if (column == 0)
            {
                grid.RowDefinitions.Add(new RowDefinition());
            }
        }
示例#2
0
        private Control RenderCheckBox([NotNull] Grid grid, [NotNull] Field field, int count)
        {
            Debug.ArgumentNotNull(grid, nameof(grid));
            Debug.ArgumentNotNull(field, nameof(field));

            var fieldControl = field.Control;

            if (fieldControl == null)
            {
                return(null);
            }

            var control = fieldControl.GetControl() as ContentControl;

            if (control == null)
            {
                return(null);
            }

            control.VerticalAlignment = VerticalAlignment.Top;

            var label = new Default.Label
            {
                ShowColon         = false,
                ContentEditor     = ContentEditor,
                Field             = field,
                VerticalAlignment = VerticalAlignment.Center,
            };

            control.Content = label;

            var border = new Border
            {
                Margin = new Thickness(8, 0, 8, 12),
                Child  = control
            };

            border.GotKeyboardFocus += (sender, args) => ContentEditor.UpdateContextualRibbon(field);

            grid.Children.Add(border);

            var row    = count / 2 * 2 + 1;
            var column = count % 2;

            border.SetValue(Grid.RowProperty, row);
            border.SetValue(Grid.ColumnProperty, column);

            if (column == 0)
            {
                grid.RowDefinitions.Add(new RowDefinition());
            }

            borders[field] = border;

            return(fieldControl.GetFocusableControl());
        }
示例#3
0
        private Control RenderCheckBox([NotNull] StackPanel section, [NotNull] Field field)
        {
            Debug.ArgumentNotNull(section, nameof(section));
            Debug.ArgumentNotNull(field, nameof(field));

            var fieldControl = field.Control;

            if (fieldControl == null)
            {
                return(null);
            }

            var control = fieldControl.GetControl() as ContentControl;

            if (control == null)
            {
                return(null);
            }

            control.VerticalContentAlignment = VerticalAlignment.Center;

            var label = new Default.Label
            {
                ShowColon         = false,
                ContentEditor     = ContentEditor,
                Field             = field,
                VerticalAlignment = VerticalAlignment.Center,
            };

            control.Content = label;

            var border = new Border
            {
                Margin = new Thickness(8, 12, 8, 12),
                Child  = control
            };

            border.GotKeyboardFocus += (sender, args) => ContentEditor.UpdateContextualRibbon(field);

            section.Children.Add(border);

            borders[field] = border;

            return(fieldControl.GetFocusableControl());
        }
示例#4
0
        private void RenderLabel([NotNull] Grid grid, [NotNull] Field field)
        {
            Debug.ArgumentNotNull(grid, nameof(grid));
            Assert.ArgumentNotNull(field, nameof(field));

            var label = new Default.Label
            {
                ContentEditor = ContentEditor,
                Field = field,
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment = VerticalAlignment.Top,
                Margin = new Thickness(0, 14, 0, 12)
            };

            grid.Children.Add(label);

            label.SetValue(Grid.ColumnProperty, 0);
            label.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1);
        }
示例#5
0
        private Control RenderCheckBox([NotNull] Grid grid, [NotNull] Field field)
        {
            Debug.ArgumentNotNull(grid, nameof(grid));
            Debug.ArgumentNotNull(field, nameof(field));

            if (field.Control == null)
            {
                return null;
            }

            var control = field.Control.GetControl() as ContentControl;
            if (control == null)
            {
                return null;
            }

            var label = new Default.Label
            {
                ShowColon = false,
                ContentEditor = ContentEditor,
                Field = field,
            };

            control.Content = label;

            var border = new Border
            {
                Margin = new Thickness(8, 12, 8, 12),
                Child = control
            };

            border.GotKeyboardFocus += (sender, args) => ContentEditor.UpdateContextualRibbon(field);

            grid.Children.Add(border);

            border.SetValue(Grid.ColumnProperty, 1);
            border.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1);

            borders[field] = border;

            return field.Control.GetFocusableControl();
        }
示例#6
0
        private Control RenderControl([NotNull] StackPanel section, [NotNull] Field field)
        {
            Debug.ArgumentNotNull(section, nameof(section));
            Debug.ArgumentNotNull(field, nameof(field));

            if (string.Compare(field.ActualFieldType, @"checkbox", StringComparison.InvariantCultureIgnoreCase) == 0 || string.Compare(field.ActualFieldType, @"tristate", StringComparison.InvariantCultureIgnoreCase) == 0)
            {
                return(RenderCheckBox(section, field));
            }

            var fieldControl = field.Control;

            if (fieldControl == null)
            {
                return(null);
            }

            var label = new Default.Label
            {
                ContentEditor = ContentEditor,
                Field         = field,
                Margin        = new Thickness(8, 12, 8, 2)
            };

            section.Children.Add(label);

            var control = fieldControl.GetControl();

            var border = new Border
            {
                Margin = new Thickness(8, 0, 8, 12),
                Child  = control
            };

            border.GotKeyboardFocus += (sender, args) => ContentEditor.UpdateContextualRibbon(field);

            section.Children.Add(border);

            borders[field] = border;

            return(fieldControl.GetFocusableControl());
        }
        private void RenderLabel([NotNull] Section section, [NotNull] Field field)
        {
            Assert.ArgumentNotNull(section, nameof(section));
            Assert.ArgumentNotNull(field, nameof(field));

            var label = new Default.Label
            {
                ContentEditor = ContentEditor,
                Field         = field,
                HorizontalContentAlignment = HorizontalAlignment.Right,
                VerticalContentAlignment   = VerticalAlignment.Top,
                Padding         = new Thickness(0, 4, 8, 0),
                BorderThickness = new Thickness(0, 0, 0, 1),
                BorderBrush     = SystemColors.ControlDarkBrush,
            };

            label.HelpTextBlock.Visibility = Visibility.Collapsed;

            Editor.Children.Add(label);

            label.SetValue(Grid.RowProperty, RowIndex);
        }