Hide The File -> New Menu Option

2 Answers 51 Views
RichTextEditor
Martin Hamilton
Top achievements
Rank 1
Iron
Iron
Veteran
Martin Hamilton asked on 29 Sep 2023, 04:15 PM

Is there a way to hide the File -> New Menu Option?

I tried this but it returns "Nothing" indicating the backstageTabItemNew item wasn't found.... maybe there's another name for it?

Dim FileNewItem As BackstageTabItem = TryCast(Me.RichTextEditorRibbonBar1.RibbonBarElement.BackstageControl.Items("backstageTabItemNew"), BackstageTabItem)

2 Answers, 1 is accepted

Sort by
0
Nadya | Tech Support Engineer
Telerik team
answered on 02 Oct 2023, 09:12 AM

Hello, Martin,

In order to customize the ribbon bar that is used in RadRichTextEditor control, you should create a custom class that inherits RichTextEditorRibbonBar. You can refer to the following article for more information on this topic: Inherit RichTextEditorRibbonBar - RadRichTextEditor - Telerik UI for WinForms

Please refer to the following code snippet which hides the "New" button:

Class CustomRichTextEditorRibbonBar
    Inherits RichTextEditorRibbonBar

    Public Sub New()
        backstageButtonNew.Visibility = ElementVisibility.Collapsed
    End Sub
End Class

I hope this helps. Should you have other questions, I would be glad to help.

Regards,
Nadya
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Martin Hamilton
Top achievements
Rank 1
Iron
Iron
Veteran
commented on 02 Oct 2023, 10:34 AM

Hi Nadya

 

I don't want to turn off the entire file menu option - just the Open menu option - I'd like to keep the remaining menu options available.  Can you tell me how to just remove the "Open" menu Option?

Jenny
Top achievements
Rank 1
commented on 05 Feb 2024, 09:47 AM

hi,

Is there a way to hide the File tab? thanks.

Nadya | Tech Support Engineer
Telerik team
commented on 05 Feb 2024, 11:06 AM

Hello, Jenny,

Yes, it is possible to hide the File tab. You can use the following code snippet:

Me.richTextEditorRibbonBar1.RibbonBarElement.ApplicationButtonElement.Visibility = ElementVisibility.Collapsed
Me.richTextEditorRibbonBar1.RibbonBarElement.TabStripElement.ItemContainer.Margin = New System.Windows.Forms.Padding(0)

You can also achieve the same inside your CustomRichTextEditorRibbonBar in case you have such.

I hope this helps. Should you have any other questions do not hesitate to ask.

0
Nadya | Tech Support Engineer
Telerik team
answered on 02 Oct 2023, 12:00 PM

Hello, Martin,

The File menu in RichTextEditorRibbonBar by default contains the following options:

If I understand you correctly in your first question you asked how to hide the "File -> New " menu option. This is why I show how to remove the backstageButtonNew. In the provided picture in my previous answer only the "New" menu option is missing. The File menu button is not turn off.

In your last post, it seems that you would like to hide the "File -> Open" menu option. Here is how you can achieve this:

Class CustomRichTextEditorRibbonBar
    Inherits RichTextEditorRibbonBar

    Public Sub New()
        backstageButtonOpen.Visibility = ElementVisibility.Collapsed
    End Sub
End Class

Here, you can see that the "Open" menu option is missing, the other options are still available:

Please let me know if I can assist you further.

Regards,
Nadya
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Martin Hamilton
Top achievements
Rank 1
Iron
Iron
Veteran
commented on 02 Oct 2023, 12:14 PM

ok, I'm doing something wrong I guess.

In the Form_New()  subroutine I have this code

RichTextEditorRibbonBar1 = New CustomRichTextEditorRibbonBar

and in the CustomRichTextEditorRibbonBar class I have the following code: But Both the New and Open options are still visible.

Public Class CustomRichTextEditorRibbonBar
    Inherits RichTextEditorRibbonBar
    Public Sub New()
        MyBase.Initialize()
        backstageButtonNew.Visibility = ElementVisibility.Collapsed
        backstageButtonOpen.Visibility = ElementVisibility.Collapsed
    End Sub

End Class

 

What am I doing wrong???

Martin Hamilton
Top achievements
Rank 1
Iron
Iron
Veteran
commented on 02 Oct 2023, 12:23 PM

Nevermind, I figured it out.... had a brain freeze moment
Nadya | Tech Support Engineer
Telerik team
commented on 03 Oct 2023, 08:12 AM

Hello, Martin,

I am glad that you managed to fix the problem you had on your end. Do not forget to replace the default ribbon bar with the custom one in order to see the changes. 

In case you have any other questions, I would be glad to help.

Tags
RichTextEditor
Asked by
Martin Hamilton
Top achievements
Rank 1
Iron
Iron
Veteran
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or