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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Setting default Path pen color and strokewidth

Thread ID:

Created:

Updated:

Platform:

Replies:

141991 Jan 14,2019 09:15 AM UTC Jan 23,2019 01:17 PM UTC Xamarin.Forms 13
loading
Tags: SfImageEditor
Andrew
Asked On January 14, 2019 09:15 AM UTC

Greetings,

Is there a way to set the default Path color and strokewidth through the ToolbarSetting.ToolbarItems collection when SfImageEditor is instantiated.

          SfImageEditor sfimageeditor = new SfImageEditor();
          //possible to set default Shape properties, maybe through sfimageeditor.ToolbarSettings.ToolbarItems[]?

For now the only way found is to call this after loading:

          sfimageeditor.AddShape(ShapeType.Path, new PenSettings { Color = Color.Black, StrokeWidth = 1 });

Thanks,
Andy

Michael Prabhu M [Syncfusion]
Replied On January 14, 2019 12:27 PM UTC

Hi Andrew, 

Greetings from Syncfusion, 

We have validated your query and your requirement can be achieved by setting the ImageEditor’s Color palette by initializing the 0th index of the palette with your required color so that it will be the default color while ImageEditor is loaded. 

Please refer the below Knowledge base article to learn more on this. 


Thanks, 
Michael 


Andrew
Replied On January 14, 2019 12:47 PM UTC

Hi Michael,

This is what I'm looking for. I still can't figure out how to initialize the ImageEditor's ColorPallet to the 0th index, I don't see this in any of the samples.

Thanks.

Andrew
Replied On January 16, 2019 03:40 AM UTC

Please see my last post... how is the ImageEditor's ColorPallet initialized to the 0th index?

Michael Prabhu M [Syncfusion]
Replied On January 16, 2019 11:01 AM UTC

Hi Andrew,  
  
We have prepared sample based on your requirement by adding the color in 0th index in color palette. Please download the sample from the below link, 
  
  
Code Snippet: 
  
imageeditor.ColorPalette[0] = Color.HotPink; 
  
Regards, 
Michael 


Andrew
Replied On January 16, 2019 12:47 PM UTC

Hi Michael,

The snippet below does not achieve what is needed.
imageeditor.ColorPalette[0] = Color.HotPink; 
This sets the first colour in the colour the pallet to HotPink, the default drawing colour remains red (ColorPallet index #2).

What is needed is to set the initial Path values of the Pen colour and Strokewidth. i.e When the menu Pen icon is clicked, without modifying values through the menu, the first drawn path is Black with a Strokewidth of 1.

Can this be achieved?

Thanks,
Andy

Bharathiraja K [Syncfusion]
Replied On January 17, 2019 12:52 PM UTC

Hi Andrew,   
  
We have achieved your requirement using ToolbarItemSelected event in ToolbarSettings. Tapped item name can be taken from the event args and using the item name, first color can be given in the pen settings. Based on your requirement, we have prepared sample and the same can be download from the below link, 
  
Code Snippet: 
  
private void ToolbarSettings_ToolbarItemSelected(object sender, ToolbarItemSelectedEventArgs e) 
        {                    
            var colors = e.ToolbarItem.Name; 
            if (colors.Equals("Colors")) 
            { 
                PenSettings settings = new PenSettings() { Color = firstColor, StrokeWidth = 10 }; 
                imageeditor.AddShape(ShapeType.Path, settings); 
            }           
        } 
  
Screenshot: 
   
 
Regards, 
Bharathiraja. 
 


Padmini Ramamurthy [Syncfusion]
Replied On January 21, 2019 04:21 AM UTC

From: Andrew Beckley <andrew@flightdeck.co.za>
Sent: Friday, January 18, 2019 11:48 PM
To: Syncfusion Support <support@syncfusion.com>
Subject: RE: Syncfusion support community forum 141991, Setting default Path pen color and strokewidth, has been updated.
 

Greetings, 
 
Unfortunately this does not achieve what is needed, the code snippet added appears to have no effect at all. Running the sample from the link below (in UWP) the pen still draws using the menu default colour (red) and brushstroke. 
 
Still looking for a way to setting the default or start values for the menu items? 
 
Thanks, 
Andy 


Bharathiraja K [Syncfusion]
Replied On January 21, 2019 11:32 AM UTC

  
Hi Andrew, 
 
Thanks for your update. 
 
We have achieved your requirement as a workaround solution in sample, such that we have added the shape and changed the pen settings values when tapping the Path menu icon. Using this, you can change the path default drawing color without modifying the color palette values. We have modified the sample. Please find the sample from the following location. 
 
 
We have considered this as feature request and this feature will be available in our Volume 1,2019 release. You can now track the status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link. We appreciate your patience until then. 
 
 
Thanks, 
Bharathiraja. 


Andrew
Replied On January 21, 2019 05:42 PM UTC

Hi Bharathiraja,

Thank you for the feedback.

Unfortunately the solution provided will not suit the intended use. A customised solution will be implemented until this is available as a feature.

In UWP modifying the StrokeWidth value in the PenSetting (as below) appears to have no affect. Is there any way to set the StrokeWidth?

          PenSettings settings = new PenSettings() { Color = firstColor, StrokeWidth = 10}; 
            imageeditor.AddShape(ShapeType.Path, settings); 

Thanks,
Andy

Bharathiraja K [Syncfusion]
Replied On January 22, 2019 01:45 PM UTC

Hi Andrew, 
 
Thanks for the update. 
 
We can able to reproduce the issue in our end and confirmed this is an issue. In UWP, the path stroke width value always takes as default value so that the provided value not updated. At Syncfusion, we are committed to fixing all validated defects (subject to technological feasibility and Product Development Life Cycle) and including the defect fix in our subsequent weekly NuGet release which is scheduled on every Tuesday of the week and you can expect this fix on 29th January 2019 weekly NuGet release. If you wish to receive this fix in a specific prior release product version please revert back to us(backwards compatibility subject to technological feasibility and our Support SLA) You can now track the current status of your request, review the proposed resolution timeline,  and contact us for any further inquiries through this link. We appreciate your patience until then. 
 
 
As we promised earlier, we will provide the feature in our upcoming Volume 1,2019 release. 
 
Thanks, 
Bharathiraja. 


Bharathiraja K [Syncfusion]
Replied On January 23, 2019 10:24 AM UTC

Hi Andrew, 
 
We regret for the inconvenience caused. Since we have planned Volume-4 SP1 service pack release on coming 4th   February and include all the fix in service pack, we will not release next weekly build which was planned to roll out 29th January. We appreciate your patience until then. 
 
Thanks, 
Bharathiraja. 


Andrew
Replied On January 23, 2019 10:28 AM UTC

Greetings Bharathiraja,
Thank you for the update - looking forward to further news.
Regards,
Andy

Bharathiraja K [Syncfusion]
Replied On January 23, 2019 01:17 PM UTC

Hi Andy, 
  
Thanks for your update. We will let you know that once Volume-4 SP1 service pack rolled out. 
  
Thanks, 
Bharathiraja. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

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

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
Live Chat Icon