6 Answers, 1 is accepted
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
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
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
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)
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;
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
Hi Dess,
Thanks for the solution, it works perfectly.
Grtz Patrick Vossen