This is a migrated thread and some comments may be shown as answers.

Set UseMnemonic to false for Breadcrumb

6 Answers 60 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 09 Oct 2018, 12:30 PM

Hello,

Is there a way to set UseMnemonic to false for the Breadcrumb?

Setting UseMnemonic to false for the linked treeview seems not be the solution.

 

Grtz Patrick Vossen

6 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 11 Oct 2018, 08:59 AM
Hello, Patrick, 

By default, the UseMnemonic property is available for any TextPrimitive's or LightVisualElement's derivative. For example, the RadTreeViewElement is a derivative of LightVisualElement. That is why it has the UseMnemonic property. However, RadBreadCrumb doesn't offer such property. Could you please give us some more information about the exact requirement that you are trying to achieve. Once, we get a better understanding of your precise case, we would be able to think about a suitable solution and assist you further. Thank you in advance.

I am looking forward to your reply.

Regards,
Dess
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Patrick
Top achievements
Rank 1
answered on 11 Oct 2018, 09:18 AM

Hello Dess,

Some of the treeview items contain the '&'-sign in the text.

These &-signs are shown correctly in the treeview but not in the breadcrumb (see attached image).

The RadBreadcrumb control is linked to the treeview (Me.RadBreadCrumb1.DefaultTreeView = Me.RadTreeView1)

 

Grtz Patrick

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 11 Oct 2018, 02:10 PM
Hello, Patrick, 

The provided screenshot and detailed explanation is greatly appreciated. You can handle the RadTreeView.NodeFormatting event and set the NodeElement.ContentElement.UseMnemonic property to false. Thus, the "&" will be displayed as plain text. As to the RadBreadCrumb, you can iterate all items and set the RadSplitButtonElement.ActionButton.TextElement.UseMnemonic property to false. Here is a sample code snippet: 

this.radTreeView1.NodeFormatting += radTreeView1_NodeFormatting;
this.radTreeView1.SelectedNodeChanged += radTreeView1_SelectedNodeChanged;


private void radTreeView1_SelectedNodeChanged(object sender, Telerik.WinControls.UI.RadTreeViewEventArgs e)
{
    foreach (RadSplitButtonElement item in this.radBreadCrumb1.BreadCrumbElement.Items)
    {
        item.ActionButton.TextElement.UseMnemonic = false;
    }
}
  
private void radTreeView1_NodeFormatting(object sender, Telerik.WinControls.UI.TreeNodeFormattingEventArgs e)
{
    e.NodeElement.ContentElement.UseMnemonic = false;
}




Should you have further questions please let me know.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Patrick
Top achievements
Rank 1
answered on 12 Oct 2018, 07:35 AM

Hi Dess,

Thanks for the solution. At first I did not get the solution working. The reason that it did not worked was the sequence of code:

Did not work:

private void RadForm1_Load(object sender, EventArgs e) {
    this.radTreeView1.NodeFormatting += radTreeView1_NodeFormatting;
    this.radTreeView1.SelectedNodeChanged += radTreeView1_SelectedNodeChanged;
    radBreadCrumb1.DefaultTreeView = this.radTreeView1;
}

 

But this works:

private void RadForm1_Load(object sender, EventArgs e) {
    radBreadCrumb1.DefaultTreeView = this.radTreeView1;
    this.radTreeView1.NodeFormatting += radTreeView1_NodeFormatting;
    this.radTreeView1.SelectedNodeChanged += radTreeView1_SelectedNodeChanged;
}

 

But now I have still the following exception that the DropDownMenu does not handle the & "correctly" (see attached image)

 

0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 15 Oct 2018, 06:52 AM
Hello, Patrick, 

Indeed, when you set the DefaultTreeView property after you have subscribed to the RadTreeView event, the mnemonics will be displayed. 

I have logged it in our feedback portal. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I have also updated your Telerik points.

Currently, the possible solution that I can suggest is to set the DefaultTreeView before subscribing to the tree view events.

 
this.radBreadCrumb1.DefaultTreeView = this.radTreeView1;
this.radTreeView1.NodeFormatting += radTreeView1_NodeFormatting;
this.radTreeView1.SelectedNodeChanged += radTreeView1_SelectedNodeChanged;

As to the drop down menu items, you can disable the mnemonics as well as follows: 
private void radTreeView1_SelectedNodeChanged(object sender, Telerik.WinControls.UI.RadTreeViewEventArgs e)
{
    foreach (RadSplitButtonElement item in this.radBreadCrumb1.BreadCrumbElement.Items)
    {
        item.ActionButton.TextElement.UseMnemonic = false;
        foreach (RadMenuItem i in item.Items)
        {
            i.Layout.Text.UseMnemonic = false;
        }
    }
}



I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Patrick
Top achievements
Rank 1
answered on 24 Oct 2018, 12:11 PM

Hi Dess,

Thanks for the solution, it works perfectly.

Grtz Patrick Vossen

Tags
Treeview
Asked by
Patrick
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Patrick
Top achievements
Rank 1
Share this question
or