We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to detect cropping window is enabled or not?

Platform: Xamarin.Forms |
Control: SfImageEditor |
Published Date: November 14, 2018 |
Last Revised Date: November 14, 2018

This section explains how to detect cropping window is enabled or not  in imageeditor.

 Create SfImageEditor sample with all necessary assemblies.

 Please refer the below link to create a simple SfImageEditor sample along with the ways to configure it.


To detect cropping window is enabled or not in two ways  such as using toolbar visibility and without using toolbar.


For example, switch is used to indicate if cropping window is enabled or not. If cropping window is enabled, then switch is going to on state if it is not enabled then switch is going to off state.


Without using toolbar:


Step 1: Add buttons and switch to call the toggle cropping, crop methods as like below code snippet






Step 2: Create a view model with Is Enabled Boolean property to bind with switch as like below code snippet



Step 3: To hide the toolbar visibility, you need to set toolbar visibility to false as like below code snippet



Step 4: Add Toggle Cropping method in button click or image loaded event. It will show the cropping window on an image. If you want to add cropping window when image loads in image editor, then you have to call toggle cropping in image loaded event as like below code snippet



Step 5: Call crop method in crop button click event to crop the image as like below code snippet.



 Step 6: To disable the cropping window, you need to call again toggle cropping method as like



Step 7: Set the Is Enabled property to true when call the toggle cropping method as like


IsEnabled property is binded with Toggled Switch. So, whenever you set the IsEnabled property to true the switch is on.

Step 8: Set the IsEnabled property to false when call the crop method and disable the cropping window as like



Screen Shot:


Sample Link:



Using Toolbar:


Step 1: Add switch and bind the switch with Is Enabled property in above mention step 1 and step2.


Step 2: Add the cropping window in image loaded event and set IsEnabled property to true as like above step 7.


Step 3: To detect cropping window is enabled or not using toolbar, you need to implement toolbar item selected event and set the Is Enabled to true when select the crop toolbar item. Set Is Enabled property to false when select the ok and cancel toolbar item.


















Screen shot:





Sample Link: http://www.syncfusion.com/downloads/support/directtrac/general/ze/CropSample151783984.zip

2X faster development

The ultimate Xamarin UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile