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

Help Needed on some requirements

Thread ID:

Created:

Updated:

Platform:

Replies:

148218 Oct 10,2019 10:30 AM UTC Oct 17,2019 01:57 PM UTC WPF 7
loading
Tags: SfRichTextBoxAdv
Sudip
Asked On October 10, 2019 10:30 AM UTC

Hi,
We are currently using SfRichTextBoxAdv control. We need help to achieve the following:
1. Removing the shortcuts for opening, save, save as, etc. other than text editing shortcuts like bold, italic, underline, etc.
2. Showing only three font families rather than showing all while editing text.
3. Adding options like insert table, insert image in the context menu rather than using ribbon control?


Thanks in advance.

Premkumar Sundaramoorthy [Syncfusion]
Replied On October 11, 2019 12:40 PM UTC

Hi Sudip, 
  
  
We have achieved all your requirements and prepared sample for the same. It can be downloaded from the following location. 
 
Please let us know if you need any further assistance. 
  
  
Regards, 
Premkumar 


Sudip
Replied On October 14, 2019 02:00 PM UTC

Hello,
Thanks for your support. It will really help us.
I have one more query
1. How to set the default line spacing to 0.5?

Sudip
Replied On October 14, 2019 04:51 PM UTC

Hello,
Thanks for your cooperation. We have multiple instances of this control throughout my application. After implementing your solution we found that duplicate context menu is added in different instances.
Please let us know what technique we should follow to solve this problem.

Premkumar Sundaramoorthy [Syncfusion]
Replied On October 15, 2019 10:31 AM UTC

Hi Sudip, 
  
 
 
Regrading set the default line spacing to 0.5 
 
You can set the default line spacing to the control by changing the document paragraph property. Please refer the below code example. 
 
richTextBox.Document.ParagraphFormat.LineSpacing = 0.9; 
 
But as per the micro soft word standard the minimum value of Linespacing should be greater then equal to 0.9px. So, we couldn’t set this value 0.5, if you force set than it leads to text clipping issue. 
  
  
 
 
Regarding duplicate context menu is added in different instances 
 
We were able to reproduce reported issue. We will validate and get back to you with further details on October 17th, 2019. 
 
  
  
  
 
Regards, 
Premkumar

Sudip
Replied On October 15, 2019 01:38 PM UTC

Thanks for your solution.
Your provided code for line spacing is working when the editor does not have predefined text. 
If the editor has some predefined text, in spite of putting your provided line spacing code, the editor is taking more line spacing 


Premkumar Sundaramoorthy [Syncfusion]
Replied On October 16, 2019 02:47 PM UTC

Hi Sudip, 
If you want to apply the default line spacing for loaded document and new document, please set the value in both the control Loaded event and Document changed event. Please refer the below code sample. 
 
//Hook the control loaded event 
sfRichTextBox.Loaded += SfRichTextBox_Loaded; 
//Hook the document changed event 
sfRichTextBox.DocumentChanged += SfRichTextBox_DocumentChanged; 
//Occurs when the element is laid out, rendered, and ready for interaction. 
private void SfRichTextBox_Loaded(object sender, RoutedEventArgs e) 
{ 
sfRichTextBox.Document.ParagraphFormat.LineSpacing = 0.9; 
} 
 
//Occurs when the document is changed in this control 
private void SfRichTextBox_DocumentChanged(object obj,DocumentChangedEventArgs args) 
{ 
//Sets the line height as exactly 0.9 pixels within the document default paragraph format. 
sfRichTextBox.Document.ParagraphFormat.LineSpacing = 0.9; 
} 
 
 
Note:  For loaded document, default format is applied only if the Linespacing property of paragraph format is not defined. If it is defined in that loaded document, then control use that value. 
For your information: Linespacing behaviour in RichTextBox 
 
Here the line spacing is work more like line height.  
 
Linespacing type 
behaviour 
LineSpacingType.AtLeast 
(Minimum Line Height) 
 
 
 
Specifies that the height of the line shall be at least the 
value specified, but might be expanded to fit its 
content as needed. 
LineSpacingType.Exactly 
(Exact Line Height) 
 
 
 
 
 
Specifies that the height of the line shall be exactly the 
value specified, regardless of the size of the contents 
of the contents. 
 
If the contents are too large for the specified height, 
then they shall be clipped as necessary. 
LineSpacingType.Multiple 
 
 
This will multiple the line height with line spacing value. 
 
For example, consider  
Type = Multiple 
Line height = 10 
Line spacing = 2 
 
Than the actual space added between two line is 10 * 2 = 20. 
So, if you want to set small value. set line space like 1 or 0.9 
 




Regards, 
Premkumar

Premkumar Sundaramoorthy [Syncfusion]
Replied On October 17, 2019 01:57 PM UTC

Hi Sudip, 
  
Thank you for your patience,  
 
We have resolved the issue duplicate context menu is added in different instances. Please find the modified sample from the below location.  
 
 
Please let us know if you need any further assistance. 
  
Regards, 
Premkumar 


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