menu

Xamarin.Forms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PenSettings - Xamarin.Forms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class PenSettings

    Represents PenSettings class.

    Inheritance
    System.Object
    PenSettings
    Namespace: Syncfusion.SfImageEditor.XForms
    Assembly: Syncfusion.SfImageEditor.XForms.dll
    Syntax
    public class PenSettings : BindableObject

    Constructors

    PenSettings()

    Declaration
    public PenSettings()

    Fields

    BoundsProperty

    Gets or sets the Bounds value for shapes. It is a bindable property.

    Declaration
    public static readonly BindableProperty BoundsProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty

    ColorProperty

    Gets or sets the Color for the PenSettings. It is a bindable property.

    Declaration
    public static readonly BindableProperty ColorProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty

    EnableDragProperty

    Gets or sets the enable drag for shapes.It is a bindable property.

    Declaration
    public static readonly BindableProperty EnableDragProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty

    FillColorProperty

    Gets or sets the FillColor for the PenSettings. It is a bindable property.

    Declaration
    public static readonly BindableProperty FillColorProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty

    IsResizableProperty

    Gets or sets the resizable for Shapes. It is a bindable property.

    Declaration
    public static readonly BindableProperty IsResizableProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty

    ModeProperty

    Gets or sets the mode of fill for the PenSettings. It is a bindable property.

    Declaration
    public static readonly BindableProperty ModeProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty

    OpacityProperty

    Gets or sets the Opacity for shapes. It is a bindable property.

    Declaration
    public static readonly BindableProperty OpacityProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty

    ShapeIDProperty

    Identifies the ShapeID bindable property.

    Declaration
    public static readonly BindableProperty ShapeIDProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty

    StrokeWidthProperty

    Gets or sets the stroke width of the path drawings. It is a bindable property.

    Declaration
    public static readonly BindableProperty StrokeWidthProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty

    Properties

    Bounds

    Gets or sets the Bounds for the PenSettings. It is a bindable property.

    Declaration
    public Rectangle Bounds { get; set; }
    Property Value
    Type
    Xamarin.Forms.Rectangle
    Examples

    This sample shows how to set the Bounds for the annotations.

    Public MyPage()
    {
        SfImageEditor imageEditor = new SfImageEditor();
        var penSettings = new PenSettings(){Bounds= new Rectangle(10, 80, 40, 10) };
        imageEditor.PenSettings = penSettings;
    }

    Color

    Gets or sets the Color for the PenSettings. It is a bindable property.

    Declaration
    public Color Color { get; set; }
    Property Value
    Type
    Xamarin.Forms.Color
    Examples

    This sample shows how to set the Color for the annotations.

    Public MyPage()
    {
        SfImageEditor imageEditor = new SfImageEditor();
        var penSettings = new PenSettings(){Color = Color.Red};
        imageEditor.PenSettings = penSettings;
    }

    EnableDrag

    Gets or sets a value indicating whether shape can be dragged or not.

    Declaration
    public bool EnableDrag { get; set; }
    Property Value
    Type
    System.Boolean

    FillColor

    Gets or sets the FillColor for the PenSettings. It is a bindable property.

    Declaration
    public Color FillColor { get; set; }
    Property Value
    Type
    Xamarin.Forms.Color
    Examples

    This sample shows how to set the FillColor for the annotations.

    Public MyPage()
    {
        SfImageEditor imageEditor = new SfImageEditor();
        var penSettings  = new PenSettings(){FillColor = Color.Red};
        imageEditor.PenSettings = penSettings;
    }

    IsResizable

    Gets or sets a value indicating whether the Shapes are Resizable for the TextSettings. It is a bindable property.

    Declaration
    public bool IsResizable { get; set; }
    Property Value
    Type
    System.Boolean
    Examples

    This sample shows how to set the IsResizable for the Shapes.

    Public MyPage()
    {
        SfImageEditor imageEditor = new SfImageEditor();
       imageEditor.AddShape(ShapeType.Circle, new PenSettings() { IsResizable = false });
    }

    Mode

    Gets or sets the mode of fill for the PenSettings. It is a bindable property.

    Declaration
    public Mode Mode { get; set; }
    Property Value
    Type
    Mode
    Examples

    This sample shows how to set the Mode of filling for the annotations. Applicable only for Rectangle and Circle.

    Public MyPage()
    {
        SfImageEditor imageEditor = new SfImageEditor();
        var penSettings  = new PenSettings(){ Mode = Mode.Fill};
        imageEditor.PenSettings = penSettings;
    }

    Opacity

    Gets or sets the Opacity for the PenSettings. It is a bindable property.

    Declaration
    public float Opacity { get; set; }
    Property Value
    Type
    System.Single
    Examples

    This sample shows how to set the Opacity for the annotations.

    Public MyPage()
    {
        SfImageEditor imageEditor = new SfImageEditor();
        var penSettings = new PenSettings(){Opacity=0.5f };
        imageEditor.PenSettings = penSettings;
    }

    ShapeID

    Gets the unique ID of the shape.

    Declaration
    public int ShapeID { get; }
    Property Value
    Type
    System.Int32
    Examples

    This code shows how to get the unique ID of the added shape.

    private void Editor_ItemSelected(object sender, ItemSelectedEventArgs args)
    {
        PenSettings penSettings = args.Settings as PenSettings;
        if (penSettings != null)
        {
            var shapeID = penSettings.ShapeID;
        }
    }

    StrokeWidth

    Gets or sets the stroke width of the path drawings. It is a bindable property.

    Declaration
    public float StrokeWidth { get; set; }
    Property Value
    Type
    System.Single
    Examples

    This sample shows how to set the StrokeWidth for the path.

    Public MyPage()
    {
        SfImageEditor imageEditor = new SfImageEditor();
        var penSettings = new PenSettings(){StrokeWidth = 10};
        imageEditor.PenSettings = penSettings;
    }
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved