Disable the BrowseImage folder

Hello,

I am trying to hide some buttons on the toolbar including the BrowseImage button and

sfeditor.ToolbarSettings.ToolbarItems has 6 items none of which are the save or BrowseImage items


How can I access those to hide or change the icon?


Thanks,


Joseph



3 Replies 1 reply marked as answer

ET Eswaran Thirugnanasambandam Syncfusion Team January 26, 2021 02:36 AM UTC

Hi Joseph Versace, 
 
Thanks for contacting Syncfusion support. 
 
We have checked your requirement and your requirement can be achieved by using the IsToolbarVisiblity property. When setting the the IsToolbarVisiblity property as false we can hide all the toolbar items from the SfImageEditor control. The code snippet is provided below: 
<editor:SfImageEditor.ToolbarSettings> 
        <editor:ToolbarSettings IsToolbarVisiblity="False" /> 
  </editor:SfImageEditor.ToolbarSettings> 
 
For more details about toolbar customization please refer the below link. 
 
We have prepared a sample to hide the toolbar item in the SfImageEditor control using IsToolbarVisiblity property. Please find the sample from the below link. 
 
 
Please check the above sample and let us know if you have any other concerns. 
 
Regards, 
Eswaran  



JV Joseph Versace January 26, 2021 02:38 AM UTC

I understand, but that removes all of them. Does that mean I have to remove all of them and add the ones I want programtically?
Is there example code for how to do that?

Thanks.


MK Muneesh Kumar G Syncfusion Team January 26, 2021 06:47 AM UTC

Hi Joseph Versace,  
 
We have analyzed your requirement and we have achieved that by extending SfImageEditor class then collapsed particular toolbar items alone in OnApplyTemplate method as per the below code snippet.  
 
Code snippet 
 
public class CustomEditor : SfImageEditor 
    { 
        public override void OnApplyTemplate() 
        { 
            base.OnApplyTemplate(); 
            var items = this.ToolbarSettings.ToolbarItems.Count; 
            var border = this.Template.FindName("PART_HeaderToolbarPanel", this) as Border; 
            var panel = (border.Child as Grid).Children[0] as StackPanel; 
            var browseButton = panel.Children[0] as Button; 
            var saveButton = panel.Children[1] as Button; 
            var line = panel.Children[2] as Rectangle; 
            var undoButton = panel.Children[3] as Button; 
            var redoButton = panel.Children[4] as Button; 
 
            var grid = (border.Child as Grid).Children[1] as Grid; 
            var stackPanel = grid.Children[0] as StackPanel; 
            var SelectButton = stackPanel.Children[0] as Button; 
            var panButton = stackPanel.Children[1] as Button; 
            var line1 = stackPanel.Children[2] as Rectangle; 
 
            var resetButton = this.Template.FindName("PART_ResetIcon", this) as Button; 
 
            var bottomToolbar = this.Template.FindName("PART_FooterToolbarPanel", this) as Border; 
            var bottomPanel = bottomToolbar.Child as Grid; 
            var resetZoomButton = bottomPanel.Children[0] as Button; 
            var line2 = bottomPanel.Children[1] as Rectangle; 
            var decreaseZoomRect = bottomPanel.Children[1] as Rectangle; 
            var decreaseZoomButton = bottomPanel.Children[2] as Button; 
            var slider = bottomPanel.Children[3] as Slider; 
            var increaseZoomButton = bottomPanel.Children[4] as Button; 
            var text = bottomPanel.Children[5] as TextBlock; 
 
            browseButton.Visibility = Visibility.Collapsed; 
            saveButton.Visibility = Visibility.Collapsed; 
            line.Visibility = Visibility.Collapsed; 
            undoButton.Visibility = Visibility.Collapsed; 
            redoButton.Visibility = Visibility.Collapsed; 
            SelectButton.Visibility = Visibility.Collapsed; 
            panButton.Visibility = Visibility.Collapsed; 
            line1.Visibility = Visibility.Collapsed; 
            resetButton.Visibility = Visibility.Collapsed; 
 
            //resetZoomButton.Visibility = Visibility.Collapsed; 
            //line2.Visibility = Visibility.Collapsed; 
            //decreaseZoomButton.Visibility = Visibility.Collapsed; 
            //decreaseZoomButton.Visibility = Visibility.Collapsed; 
            //increaseZoomButton.Visibility = Visibility.Collapsed; 
            //slider.Visibility = Visibility.Collapsed; 
            //text.Visibility = Visibility.Collapsed; 
        } 
    } 
 
 
 
<local:CustomEditor x:Name="editor" ImageSource="Assets\AerialView.jpg"> 
         
</local:CustomEditor> 
 
 
We have modified our sample based on this, please find the sample from the below location. In this sample, we have set some items visibility alone to Collapsed. You can modify the visibility based on your need.  
 
 
Let us know if you have any other queries.  
 
Thanks,  
Muneesh Kumar G  
 


Marked as answer
Loader.
Up arrow icon