Class SfImageEditor
Represents a control that helps in editing the image.
Inheritance
Namespace: Syncfusion.UI.Xaml.ImageEditor
Assembly: Syncfusion.SfImageEditor.UWP.dll
Syntax
public class SfImageEditor : Control
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
ActualImageRenderedBoundsProperty
Using a DependencyProperty as the backing store for ActualImageRenderedBounds. This enables animation, styling, binding, etc...
Declaration
public static readonly DependencyProperty ActualImageRenderedBoundsProperty
Field Value
| Type |
|---|
| Windows.UI.Xaml.DependencyProperty |
ColorPaletteProperty
The DependencyProperty for ColorPalette property.
Declaration
public static readonly DependencyProperty ColorPaletteProperty
Field Value
| Type |
|---|
| Windows.UI.Xaml.DependencyProperty |
DefaultSelectedColorIndexProperty
Using a Dependencyproperty as the backing store for DefaultSelectedColorIndex.
Declaration
public static readonly DependencyProperty DefaultSelectedColorIndexProperty
Field Value
| Type |
|---|
| Windows.UI.Xaml.DependencyProperty |
EffectValueProperty
The DependencyProperty for EffectValue property.
Declaration
public static readonly DependencyProperty EffectValueProperty
Field Value
| Type |
|---|
| Windows.UI.Xaml.DependencyProperty |
EnableAutoSelectTextProperty
Using a DependencyProperty as the backing store for EnableAutoSelectText.
Declaration
public static readonly DependencyProperty EnableAutoSelectTextProperty
Field Value
| Type |
|---|
| Windows.UI.Xaml.DependencyProperty |
EnableZoomingProperty
The DependencyProperty for EnableZooming property.
Declaration
public static readonly DependencyProperty EnableZoomingProperty
Field Value
| Type |
|---|
| Windows.UI.Xaml.DependencyProperty |
ImageEffectProperty
The DependencyProperty for ImageEffect property.
Declaration
public static readonly DependencyProperty ImageEffectProperty
Field Value
| Type |
|---|
| Windows.UI.Xaml.DependencyProperty |
ImageProperty
The DependencyProperty for Image property.
Declaration
public static readonly DependencyProperty ImageProperty
Field Value
| Type |
|---|
| Windows.UI.Xaml.DependencyProperty |
ImageSourceProperty
The DependencyProperty for ImageSource property.
Declaration
public static readonly DependencyProperty ImageSourceProperty
Field Value
| Type |
|---|
| Windows.UI.Xaml.DependencyProperty |
MaximumZoomLevelProperty
The DependencyProperty for MaximumZoomLevel property.
Declaration
public static readonly DependencyProperty MaximumZoomLevelProperty
Field Value
| Type |
|---|
| Windows.UI.Xaml.DependencyProperty |
OriginalImageSizeProperty
Using a DependencyProperty as the backing store for OriginalImageSize. This enables animation, styling, binding, etc...
Declaration
public static readonly DependencyProperty OriginalImageSizeProperty
Field Value
| Type |
|---|
| Windows.UI.Xaml.DependencyProperty |
PanningModeProperty
Using a DependencyProperty as the backing store for PanningMode. This enables animation, styling, binding, etc...
Declaration
public static readonly DependencyProperty PanningModeProperty
Field Value
| Type |
|---|
| Windows.UI.Xaml.DependencyProperty |
ResizableElementsProperty
The DependencyProperty for ResizableElements property.
Declaration
public static readonly DependencyProperty ResizableElementsProperty
Field Value
| Type |
|---|
| Windows.UI.Xaml.DependencyProperty |
ToolbarSettingsProperty
The DependencyProperty for ToolbarSettings property.
Declaration
public static readonly DependencyProperty ToolbarSettingsProperty
Field Value
| Type |
|---|
| Windows.UI.Xaml.DependencyProperty |
ZoomLevelProperty
The DependencyProperty for ZoomLevel property.
Declaration
public static readonly DependencyProperty ZoomLevelProperty
Field Value
| Type |
|---|
| Windows.UI.Xaml.DependencyProperty |
Properties
ActualImageRenderedBounds
To get Actual image bounds. It is a read-only property.
Declaration
public Rect ActualImageRenderedBounds { get; }
Property Value
| Type |
|---|
| Windows.Foundation.Rect |
ColorPalette
Gets or sets the palette for the shape.
Declaration
public ObservableCollection<SolidColorBrush> ColorPalette { get; set; }
Property Value
| Type |
|---|
| System.Collections.ObjectModel.ObservableCollection<Windows.UI.Xaml.Media.SolidColorBrush> |
DefaultSelectedColorIndex
Gets or sets the default selected color index in the toolbar.
Declaration
public int DefaultSelectedColorIndex { get; set; }
Property Value
| Type |
|---|
| System.Int32 |
EffectValue
Gets or sets the value of Image effects.
Declaration
public float EffectValue { get; set; }
Property Value
| Type |
|---|
| System.Single |
EnableAutoSelectText
Gets or sets the selection of the edit text in text previewer dialog.
Declaration
public bool EnableAutoSelectText { 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 source.
Declaration
public IRandomAccessStream Image { get; set; }
Property Value
| Type |
|---|
| Windows.Storage.Streams.IRandomAccessStream |
ImageEffect
Gets or sets the type of image effects. It is a bindable property
Declaration
public ImageEffect ImageEffect { get; set; }
Property Value
| Type |
|---|
| ImageEffect |
ImageSource
Gets or sets the ImageSource for the image.
Declaration
public ImageSource ImageSource { get; set; }
Property Value
| Type |
|---|
| Windows.UI.Xaml.Media.ImageSource |
IsImageEdited
Gets a value that indicates whether image is edited or not.
Declaration
public bool IsImageEdited { get; }
Property Value
| Type |
|---|
| System.Boolean |
IsImageZoomed
Gets a value indicating whether the image gets zoomed or not. It is a read-only property.
Declaration
public bool IsImageZoomed { 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 |
MaximumZoomLevel
Gets or sets the maximum zoom level value.This property used to restrict the image zooming, when changing zoom level using pinch or ZoomLevel property.
Declaration
public double MaximumZoomLevel { get; set; }
Property Value
| Type |
|---|
| System.Double |
OriginalImageSize
Gets the original size of the image.It is a read-only property.
Declaration
public Size OriginalImageSize { get; }
Property Value
| Type |
|---|
| Windows.Foundation.Size |
PanningMode
Gets or sets the value for panning mode to pan the image with single finger or two finger.
Declaration
public PanningMode PanningMode { get; set; }
Property Value
| Type |
|---|
| PanningMode |
ResizableElements
Gets or sets ResizableElements value
Declaration
public ImageEditorResizableElements ResizableElements { get; set; }
Property Value
| Type |
|---|
| ImageEditorResizableElements |
RotatableElements
Gets or sets rotatable elements in the editor
Declaration
public ImageEditorElements RotatableElements { get; set; }
Property Value
| Type |
|---|
| ImageEditorElements |
ToolbarSettings
Gets or sets the SfImageEditor toolbar settings.
Declaration
public ToolbarSettings ToolbarSettings { get; set; }
Property Value
| Type |
|---|
| ToolbarSettings |
ZoomLevel
Gets or sets the zoom level value.This property is used to change the image zoom level programmatically.
Declaration
public double ZoomLevel { get; set; }
Property Value
| Type |
|---|
| System.Double |
Methods
add_BeginReset(BeginResetEventHandler)
Declaration
public void add_BeginReset(BeginResetEventHandler value)
Parameters
| Type | Name | Description |
|---|---|---|
| BeginResetEventHandler | value |
add_EndReset(EndResetEventHandler)
Declaration
public void add_EndReset(EndResetEventHandler value)
Parameters
| Type | Name | Description |
|---|---|---|
| EndResetEventHandler | value |
add_ImageLoaded(ImageLoadedEventHandler)
Declaration
public void add_ImageLoaded(ImageLoadedEventHandler value)
Parameters
| Type | Name | Description |
|---|---|---|
| ImageLoadedEventHandler | value |
add_ImageSaved(ImageSavedEventHandler)
Declaration
public void add_ImageSaved(ImageSavedEventHandler value)
Parameters
| Type | Name | Description |
|---|---|---|
| ImageSavedEventHandler | value |
add_ImageSaving(ImageSavingEventHandler)
Declaration
public void add_ImageSaving(ImageSavingEventHandler value)
Parameters
| Type | Name | Description |
|---|---|---|
| ImageSavingEventHandler | value |
add_ItemSelected(ItemSelectedEventHandler)
Declaration
public void add_ItemSelected(ItemSelectedEventHandler value)
Parameters
| Type | Name | Description |
|---|---|---|
| ItemSelectedEventHandler | value |
add_ItemUnselected(ItemUnselectedEventHandler)
Declaration
public void add_ItemUnselected(ItemUnselectedEventHandler value)
Parameters
| Type | Name | Description |
|---|---|---|
| ItemUnselectedEventHandler | value |
AddCustomView(FrameworkElement, CustomViewSettings)
Adds the specified custom view in the image editor.
Declaration
public void AddCustomView(FrameworkElement element, CustomViewSettings customViewSettings)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.FrameworkElement | element | custom view |
| CustomViewSettings | customViewSettings | Settings to customize the element. |
AddShape(ShapeType, PenSettings)
Method gets called to annotate any shapes over an image.
Declaration
public void AddShape(ShapeType shapeType, PenSettings penSettings)
Parameters
| Type | Name | Description |
|---|---|---|
| ShapeType | shapeType | The shape type. |
| PenSettings | penSettings | The pen settings. |
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. |
ApplyImageEffect(ImageEffect, Single)
ApplyImageFilters method is used to apply the image effects without using Toolbar
Declaration
public void ApplyImageEffect(ImageEffect imageEffects, float amount)
Parameters
| Type | Name | Description |
|---|---|---|
| ImageEffect | imageEffects | ImageEffects |
| System.Single | amount | float |
ArrangeOverride(Size)
Override method gets called framework arrange override.
Declaration
protected override Size ArrangeOverride(Size finalSize)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.Foundation.Size | finalSize | The final size. |
Returns
| Type | Description |
|---|---|
| Windows.Foundation.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()
ClearAnnotations()
To clear Shapes/text added on an image.
Declaration
public void ClearAnnotations()
Crop(Rect, Boolean)
Crops the image based on the specified bounds.
Declaration
public void Crop(Rect rect, bool isEllipse = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.Foundation.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()
Flip(FlipDirection)
Flips an image based on the specified direction.
Declaration
public void Flip(FlipDirection flipDirection)
Parameters
| Type | Name | Description |
|---|---|---|
| FlipDirection | flipDirection | Syncfusion.UI.Xaml.ImageEditor.SfImageEditor.FlipDirection to flip the image |
GetStream()
Gets the current stream of the image
Declaration
public Task<Stream> GetStream()
Returns
| Type |
|---|
| System.Threading.Tasks.Task<System.IO.Stream> |
LoadEdits(Stream, DeserializationController)
Method gets called to load the same edits that were edited previously.
Declaration
public void LoadEdits(Stream JsonStream, DeserializationController deserializeValue = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | JsonStream | The json stream |
| DeserializationController | deserializeValue | The deseialize value. |
MeasureOverride(Size)
Override method gets called framework measure override.
Declaration
protected override Size MeasureOverride(Size availableSize)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.Foundation.Size | availableSize |
Returns
| Type |
|---|
| Windows.Foundation.Size |
OnApplyTemplate()
Method gets called when default style key template is applied.
Declaration
protected override void OnApplyTemplate()
Redo()
Restores the actions carried out by Undo.
Declaration
public void Redo()
remove_BeginReset(BeginResetEventHandler)
Declaration
public void remove_BeginReset(BeginResetEventHandler value)
Parameters
| Type | Name | Description |
|---|---|---|
| BeginResetEventHandler | value |
remove_EndReset(EndResetEventHandler)
Declaration
public void remove_EndReset(EndResetEventHandler value)
Parameters
| Type | Name | Description |
|---|---|---|
| EndResetEventHandler | value |
remove_ImageLoaded(ImageLoadedEventHandler)
Declaration
public void remove_ImageLoaded(ImageLoadedEventHandler value)
Parameters
| Type | Name | Description |
|---|---|---|
| ImageLoadedEventHandler | value |
remove_ImageSaved(ImageSavedEventHandler)
Declaration
public void remove_ImageSaved(ImageSavedEventHandler value)
Parameters
| Type | Name | Description |
|---|---|---|
| ImageSavedEventHandler | value |
remove_ImageSaving(ImageSavingEventHandler)
Declaration
public void remove_ImageSaving(ImageSavingEventHandler value)
Parameters
| Type | Name | Description |
|---|---|---|
| ImageSavingEventHandler | value |
remove_ItemSelected(ItemSelectedEventHandler)
Declaration
public void remove_ItemSelected(ItemSelectedEventHandler value)
Parameters
| Type | Name | Description |
|---|---|---|
| ItemSelectedEventHandler | value |
remove_ItemUnselected(ItemUnselectedEventHandler)
Declaration
public void remove_ItemUnselected(ItemUnselectedEventHandler value)
Parameters
| Type | Name | Description |
|---|---|---|
| ItemUnselectedEventHandler | value |
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)
Method gets called to save the image along with the current edits in different format.
Declaration
public void Save(string format = null, Size size = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | format | The image format. |
| Windows.Foundation.Size | size | The image size. |
SaveEdits()
Method gets called to save the changes that performed over the image.
Declaration
public Stream SaveEdits()
Returns
| Type | Description |
|---|---|
| System.IO.Stream | The stream. |
SelectShape(Int32)
To select the annotation added on image programatically using its unique ID.
Declaration
public void SelectShape(int ID)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | ID | The unique ID. |
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()
SetToolbarItemVisibility(String, Boolean)
Method gets called to hide or show the toolbar items.
Declaration
public void SetToolbarItemVisibility(string name, bool isVisible)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The toolbar item name. |
| System.Boolean | isVisible | The boolean values true or false. |
Tilt(Double)
To rotate the image from -45 to 45 degree in preview state. To crop the preview rotation, call Crop() method of SfImageEditor.
Declaration
public void Tilt(double angle)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | angle | double value to set the tilt angle |
ToggleCropping()
Adds a preview of the crop to the full boundary of the image.
Declaration
public void ToggleCropping()
ToggleCropping(Boolean, Int32)
Enables the cropping preview sub toolbar items. Specify selectedIndex value to customize default selection of cropping preview toolbar item.
Declaration
public void ToggleCropping(bool showToolbarItems, int selectedIndex = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | showToolbarItems | Enable or disable cropping preview toolbar items. |
| System.Int32 | selectedIndex | Change the default cropping selection preview toolbar item. |
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 |
|---|---|---|
| Windows.Foundation.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 |
|---|---|---|
| Windows.Foundation.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 BeginResetEventHandler BeginReset
Event Type
| Type |
|---|
| BeginResetEventHandler |
EndReset
Invoked after resetting the edit done on the image.
Declaration
public event EndResetEventHandler EndReset
Event Type
| Type |
|---|
| EndResetEventHandler |
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 ImageLoadedEventHandler ImageLoaded
Event Type
| Type |
|---|
| ImageLoadedEventHandler |
ImageSaved
Invoked after the edited image has been saved to the location.
Declaration
public event ImageSavedEventHandler ImageSaved
Event Type
| Type |
|---|
| ImageSavedEventHandler |
ImageSaving
Invoked before the edited image is saved in the location.
Declaration
public event ImageSavingEventHandler ImageSaving
Event Type
| Type |
|---|
| ImageSavingEventHandler |
ItemSelected
Invoked when the editor items such as Text / Shapes get selected.
Declaration
public event ItemSelectedEventHandler ItemSelected
Event Type
| Type |
|---|
| ItemSelectedEventHandler |
ItemUnselected
Invoked when the editor items such as Text / Shapes get unselected.
Declaration
public event ItemUnselectedEventHandler ItemUnselected
Event Type
| Type |
|---|
| ItemUnselectedEventHandler |