Access all shapes/text added

Hello,

Is there a way for me to iterate over all the shapes added?

I know you can access the shape that is selected but I cant find any collection of shapes.

I would like to crop the sections of image based on the bounds of rectangles added.

Thanks,

Jim


1 Reply

SS Sridevi Sivakumar Syncfusion Team June 28, 2021 03:00 PM UTC

Hi Jim,

Greetings from Syncfusion.

Query:  
Is there a way for me to iterate over all the shapes added?
In SfImagEditor, we are unable to iterate all added shapes in view. 

Query: I would like to crop the sections of the image based on the bounds of rectangles added.
We have checked your requirement, and we can crop the added rectangle shape by using the editor cropping method per the below code snippet


[Mainpage.XAML]
 
            <editor:SfImageEditor x:Name="editor" ImageSource="Assets\AerialView.jpg" 
                 ItemSelected="editor_ItemSelected"/> 
        <Button Content="Crop" Grid.Row="1" Click="Button_Click"/> 

[MainPage.cs]
 
        private void editor_ItemSelected(object sender, ItemSelectedEventArgs e) 
        { 
           if( e.SelectedItemName== "Rectangle") 
            { 
                editor.ToggleCropping((e.Settings as PenSettings).Bounds); 
            } 
        } 
        private void Button_Click(object sender, RoutedEventArgs e) 
        { 
            editor.Crop(new Rect()); 
        } 

Please refer below link about editor cropping
https://help.syncfusion.com/wpf/image-editor/crop


Let us know if you need any further assistance.

Regards
Sridevi S.
 
 


Loader.
Up arrow icon