Exemple #1
0
        public override Control OnCreate(CellEventArgs args)
        {
            if (ItemBinding == null)
            {
                return(null);
            }

            Initialize(args);
            var model = Model;

            var dval = ItemBinding.GetValue(args.Item);
            var tval = Convert(model.Property);

            var picker = new ColorPicker
            {
                Value = tval == dval ? dval : tval
            };

            picker.ValueChanged += (sender, eventArgs) =>
            {
                model.ToolboxValue = picker.Value.ToString();
            };

            if (!Model.Property.CanWrite)
            {
                picker.Enabled = false;
            }

            var layout = new TableLayout(1, 1);

            layout.Add(picker, 0, 0, true, true);

            return(layout);
        }
Exemple #2
0
        /// <summary>
        /// Paints the cell when <see cref="CustomCell.SupportsControlView"/> is false.
        /// </summary>
        /// <remarks>
        /// For platforms like GTK and WinForms which don't support using a custom control per cell, this will be called
        /// to paint the content of the cell when it is not in edit mode.
        /// </remarks>
        /// <param name="args">Cell paint arguments.</param>
        public override void OnPaint(CellPaintEventArgs args)
        {
            if (ItemBinding == null)
            {
                return;
            }
            var value = ItemBinding.GetValue(args.Item);

            args.DrawCenteredText(Convert.ToString(value));
        }
Exemple #3
0
        /// <summary>
        /// Paints the cell when <see cref="CustomCell.SupportsControlView"/> is false.
        /// </summary>
        /// <remarks>
        /// For platforms like GTK and WinForms which don't support using a custom control per cell, this will be called
        /// to paint the content of the cell when it is not in edit mode.
        /// </remarks>
        /// <param name="args">Cell paint arguments.</param>
        public override void OnPaint(CellPaintEventArgs args)
        {
            if (ItemBinding == null)
            {
                return;
            }
            var value = ItemBinding.GetValue(args.Item);

            args.DrawCenteredText(string.Format("{0:d}", value));
        }
Exemple #4
0
        /// <summary>
        /// Paints the cell when <see cref="CustomCell.SupportsControlView"/> is false.
        /// </summary>
        /// <remarks>
        /// For platforms like GTK and WinForms which don't support using a custom control per cell, this will be called
        /// to paint the content of the cell when it is not in edit mode.
        /// </remarks>
        /// <param name="args">Cell paint arguments.</param>
        public override void OnPaint(CellPaintEventArgs args)
        {
            if (ItemBinding == null)
            {
                return;
            }
            var value = ItemBinding.GetValue(args.Item);
            var color = args.IsSelected ? SystemColors.HighlightText : SystemColors.ControlText;

            args.Graphics.DrawText(SystemFonts.Default(), color, args.ClipRectangle.Location, Convert.ToString(value));
        }
Exemple #5
0
        /// <summary>
        /// Paints the cell when <see cref="CustomCell.SupportsControlView"/> is false.
        /// </summary>
        /// <remarks>
        /// For platforms like GTK and WinForms which don't support using a custom control per cell, this will be called
        /// to paint the content of the cell when it is not in edit mode.
        /// </remarks>
        /// <param name="args">Cell paint arguments.</param>
        public override void OnPaint(CellPaintEventArgs args)
        {
            if (ItemBinding == null)
            {
                return;
            }
            var value = ItemBinding.GetValue(args.Item);
            var color = args.IsSelected ? SystemColors.HighlightText : SystemColors.ControlText;

            args.Graphics.DrawText(SystemFonts.Default(), color, args.ClipRectangle.Location, value.ToHex(ShowAlpha));
            var rect = args.ClipRectangle;

            rect.Left = rect.Right - 35;
            args.Graphics.FillRectangle(value, rect);
        }
Exemple #6
0
        /// <summary>
        /// Paints the cell when <see cref="CustomCell.SupportsControlView"/> is false.
        /// </summary>
        /// <remarks>
        /// For platforms like GTK and WinForms which don't support using a custom control per cell, this will be called
        /// to paint the content of the cell when it is not in edit mode.
        /// </remarks>
        /// <param name="args">Cell paint arguments.</param>
        public override void OnPaint(CellPaintEventArgs args)
        {
            if (ItemBinding == null)
            {
                return;
            }
            var value = ItemBinding.GetValue(args.Item);

            const int size = 35;
            var       rect = args.ClipRectangle;

            rect.Right -= size;
            args.DrawCenteredText(value.ToHex(ShowAlpha), rect: rect);

            rect      = args.ClipRectangle;
            rect.Left = rect.Right - size;
            args.Graphics.FillRectangle(value, rect);
        }
Exemple #7
0
        public override Control OnCreate(CellEventArgs args)
        {
            var item = (IPropertyEditorModel)args.Item;

            if (item == null)
            {
                return(new Label {
                    Text = "Unsupported"
                });
            }

            var text = ItemBinding.GetValue(item);

            var label = new Label
            {
                Text = text
            };

            return(new Panel
            {
                Padding = new Padding(2),
                Content = label
            });
        }