menu

WPF

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class SfImageEditor - WPF API Reference | Syncfusion

    Show / Hide Table of Contents

    Class SfImageEditor

    Represents a control that helps in editing the image.

    Inheritance
    System.Object
    SfImageEditor
    Implements
    System.IDisposable
    Namespace: Syncfusion.UI.Xaml.ImageEditor
    Assembly: Syncfusion.SfImageEditor.WPF.dll
    Syntax
    public class SfImageEditor : Control, IDisposable
    Remarks

    The SfImageEditor control is a very handy tool to edit an image by annotating with text and built-in shapes. It allows you to crop, rotate, and flip an image and has an in built toolbar to perform these operations.

    Constructors

    SfImageEditor()

    Gets or sets a new instance of the SfImageEditor class.

    Declaration
    public SfImageEditor()

    Fields

    EditorResourceDictionaryProperty

    The Dependency property for Syncfusion.UI.Xaml.ImageEditor.SfImageEditor.EditorResourceDictionary

    Declaration
    public static readonly DependencyProperty EditorResourceDictionaryProperty
    Field Value
    Type
    System.Windows.DependencyProperty

    EnablePanningProperty

    Declaration
    public static readonly DependencyProperty EnablePanningProperty
    Field Value
    Type
    System.Windows.DependencyProperty

    EnableZoomingProperty

    The DependencyProperty for EnableZooming property.

    Declaration
    public static readonly DependencyProperty EnableZoomingProperty
    Field Value
    Type
    System.Windows.DependencyProperty

    ImageProperty

    The DependencyProperty for Image property.

    Declaration
    public static readonly DependencyProperty ImageProperty
    Field Value
    Type
    System.Windows.DependencyProperty

    ImageSourceProperty

    The DependencyProperty for ImageSource property.

    Declaration
    public static readonly DependencyProperty ImageSourceProperty
    Field Value
    Type
    System.Windows.DependencyProperty

    ResizableElementsProperty

    The DependencyProperty for ResizableElements property.

    Declaration
    public static readonly DependencyProperty ResizableElementsProperty
    Field Value
    Type
    System.Windows.DependencyProperty

    ToolbarItemSelectionBackgroundProperty

    The DependencyProperty for ToolbarItemSelectionBackground property.

    Declaration
    public static readonly DependencyProperty ToolbarItemSelectionBackgroundProperty
    Field Value
    Type
    System.Windows.DependencyProperty

    ToolbarSettingsProperty

    The DependencyProperty for ToolbarSettings property.

    Declaration
    public static readonly DependencyProperty ToolbarSettingsProperty
    Field Value
    Type
    System.Windows.DependencyProperty

    Properties

    Annotations

    Gets the collection of annotations added in the image editor.

    Declaration
    public ReadOnlyCollection<ImageEditorAnnotationsInfo> Annotations { get; }
    Property Value
    Type
    System.Collections.ObjectModel.ReadOnlyCollection<ImageEditorAnnotationsInfo>
    Remarks

    This property provides access to the annotations added in the image editor. Annotations can only be retrieved and cannot be set. Any changes made to the image will reset these annotations.

    EnablePanning

    Gets or sets a value indicating whether to enable the panning action or not.

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

    EnableZooming

    Gets or sets a value that indicates whether to enable zoom or not.

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

    Image

    Gets or sets the stream of the Image.

    Declaration
    public Stream Image { get; set; }
    Property Value
    Type
    System.IO.Stream

    ImageSource

    Gets or sets the ImageSource for the image.

    Declaration
    public ImageSource ImageSource { get; set; }
    Property Value
    Type
    System.Windows.Media.ImageSource

    IsImageEdited

    Gets a value that indicates whether image is edited or not.

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

    IsSelected

    Gets a value that indicates whether editor items such as Text / Shapes gets selected or not.

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

    ResizableElements

    Gets or sets the editor items that involve in resizing.

    Declaration
    public ImageEditorResizableElements ResizableElements { get; set; }
    Property Value
    Type
    ImageEditorResizableElements

    TextCommand

    Gets a command to perform actions on the Text.

    Declaration
    public ICommand TextCommand { get; }
    Property Value
    Type
    System.Windows.Input.ICommand

    ToolbarItemSelectionBackground

    Gets or sets the selection background for the toolbar items.

    Declaration
    public Brush ToolbarItemSelectionBackground { get; set; }
    Property Value
    Type
    System.Windows.Media.Brush

    ToolbarSettings

    Gets or sets the SfImageEditor toolbar settings.

    Declaration
    public ToolbarSettings ToolbarSettings { get; set; }
    Property Value
    Type
    ToolbarSettings

    Methods

    AddCustomView(FrameworkElement, CustomViewSettings)

    Adds the custom view to the image in the specfied position.

    Declaration
    public void AddCustomView(FrameworkElement element, CustomViewSettings customViewSettings)
    Parameters
    Type Name Description
    System.Windows.FrameworkElement element

    custom view

    CustomViewSettings customViewSettings

    Settings to customize the positioning of custom view in image.

    AddShape(ShapeType, PenSettings)

    Adds a shape based on the ShapeType with the sepecified PenSettings.

    Declaration
    public void AddShape(ShapeType shapeType, PenSettings penSettings)
    Parameters
    Type Name Description
    ShapeType shapeType

    Shape to be added

    PenSettings penSettings

    PenSettings of the shape

    AddText(String, TextSettings)

    Adds a text on the image with the specified TextSettings.

    Declaration
    public void AddText(string text, TextSettings textSettings)
    Parameters
    Type Name Description
    System.String text

    Text to be added

    TextSettings textSettings

    TextSettings of the text.

    ArrangeOverride(Size)

    Override method gets called framework arrange override.

    Declaration
    protected override Size ArrangeOverride(Size finalSize)
    Parameters
    Type Name Description
    System.Windows.Size finalSize

    The final size.

    Returns
    Type Description
    System.Windows.Size

    The calculated size.

    BringForward()

    Brings the selected shape one step forward.

    Declaration
    public void BringForward()

    BringToFront()

    Brings the selected shape to the front of all the shapes added.

    Declaration
    public void BringToFront()

    Crop(Rect, Boolean)

    Crops the image to the specified bounds.

    Declaration
    public void Crop(Rect rect = null, bool isEllipse = false)
    Parameters
    Type Name Description
    System.Windows.Rect rect

    Bounds to crop the image

    System.Boolean isEllipse

    True to crop in elliptical shape, false otherwise.(Optional).

    Delete()

    Deletes the added shape / text.

    Declaration
    public void Delete()

    Deserialize(Stream)

    DeSerializes the SfImageEditor based on the XML document contained by the specified Stream.

    Declaration
    public void Deserialize(Stream stream)
    Parameters
    Type Name Description
    System.IO.Stream stream

    Specifies the System.IO.Stream that contains the XML document to deserialize.

    Dispose()

    Disposes the resources.

    Declaration
    public void Dispose()

    Dispose(Boolean)

    Disposes the resources if true.

    Declaration
    protected virtual void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing

    bool value to dispose or not

    Flip(FlipDirection)

    Flips an image based on the specified direction.

    Declaration
    public void Flip(FlipDirection flipDirection)
    Parameters
    Type Name Description
    FlipDirection flipDirection

    FlipDirection to flip the image

    MeasureOverride(Size)

    Override method gets called framework measure override.

    Declaration
    protected override Size MeasureOverride(Size availableSize)
    Parameters
    Type Name Description
    System.Windows.Size availableSize
    Returns
    Type
    System.Windows.Size

    OnApplyTemplate()

    When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate().

    Declaration
    public override void OnApplyTemplate()

    Redo()

    Restores the actions carried out by Undo.

    Declaration
    public void Redo()

    Reset()

    Resets all the editing done in the image.

    Declaration
    public void Reset()

    ResetZoom()

    Resets the zooming applied to the image.

    Declaration
    public void ResetZoom()

    Rotate()

    Rotates the image by 90 degrees clockwise from the current state.

    Declaration
    public void Rotate()

    Save(String, Size, String)

    Saves the editied image.

    Declaration
    public void Save(string format = null, Size size = null, string filePath = null)
    Parameters
    Type Name Description
    System.String format

    Format in which image has to be saved

    System.Windows.Size size

    Saves the image in the specified size.

    System.String filePath

    Location to save the image

    SendBackward()

    Push the selected shape to one step back.

    Declaration
    public void SendBackward()

    SendToBack()

    Push the selected shape to the back of the all the shapes added.

    Declaration
    public void SendToBack()

    Serialize(Stream)

    Serializes the SfImageEditor control to the XML document file that are stored in the specified Stream.

    Declaration
    public void Serialize(Stream stream)
    Parameters
    Type Name Description
    System.IO.Stream stream

    Specifies the System.IO.Stream used to write the XML document file.

    ToggleCropping()

    Adds a preview of the crop to the full boundary of the image.

    Declaration
    public void ToggleCropping()

    ToggleCropping(Single, Single, Boolean)

    Adds a crop preview with the specified height to width ratio.

    Declaration
    public void ToggleCropping(float xRatio, float yRatio, bool isEllipse = false)
    Parameters
    Type Name Description
    System.Single xRatio

    width ratio

    System.Single yRatio

    height ratio

    System.Boolean isEllipse

    Shape of the cropping, either in elliptical or rectangular format.

    ToggleCropping(Rect)

    Adds the crop preview to the specified bounds.

    Declaration
    public void ToggleCropping(Rect rect)
    Parameters
    Type Name Description
    System.Windows.Rect rect

    crop preview bounds

    ToggleCropping(Rect, Boolean)

    Enables the cropping preview on the image with the specified rectangle bounds. Specify isCircleCropping as true to crop in elliptical shape.the cropping preview on the image with the specified rectangle bounds. Specify isEllipse as true to crop in elliptical shape.

    Declaration
    public void ToggleCropping(Rect rect, bool isEllipse)
    Parameters
    Type Name Description
    System.Windows.Rect rect

    Bounds of the cropping preview on the image.

    System.Boolean isEllipse

    True to crop in elliptical shape, false otherwise.

    Undo()

    Reverses the last performed action.

    Declaration
    public void Undo()

    Events

    BeginReset

    Invoked before resetting the edit done on the image.

    Declaration
    public event EventHandler<BeginResetEventArgs> BeginReset
    Event Type
    Type
    System.EventHandler<BeginResetEventArgs>

    EndReset

    Invoked after resetting the edit done on the image.

    Declaration
    public event EventHandler<EndResetEventArgs> EndReset
    Event Type
    Type
    System.EventHandler<EndResetEventArgs>

    ImageEdited

    Invoked whenever the image is edited.

    Declaration
    public event EventHandler<ImageEditedEventArgs> ImageEdited
    Event Type
    Type
    System.EventHandler<ImageEditedEventArgs>

    ImageLoaded

    Invoked when the image is loaded.

    Declaration
    public event EventHandler<ImageLoadedEventArgs> ImageLoaded
    Event Type
    Type
    System.EventHandler<ImageLoadedEventArgs>

    ImageSaved

    Invoked after the edited image has been saved to the location.

    Declaration
    public event EventHandler<ImageSavedEventArgs> ImageSaved
    Event Type
    Type
    System.EventHandler<ImageSavedEventArgs>

    ImageSaving

    Invoked before the edited image is saved in the location.

    Declaration
    public event EventHandler<ImageSavingEventArgs> ImageSaving
    Event Type
    Type
    System.EventHandler<ImageSavingEventArgs>

    ItemSelected

    Invoked when the editor items such as Text / Shapes get selected.

    Declaration
    public event EventHandler<ItemSelectedEventArgs> ItemSelected
    Event Type
    Type
    System.EventHandler<ItemSelectedEventArgs>

    ItemUnselected

    Invoked when the editor items such as Text / Shapes get unselected.

    Declaration
    public event EventHandler<ItemUnselectedEventArgs> ItemUnselected
    Event Type
    Type
    System.EventHandler<ItemUnselectedEventArgs>

    Implements

    System.IDisposable
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved