Hi, I am using RadMenu to create a three layer menu.
It is something like : -TopMenu
-SecondLevel1 -ThirdLevel
-SecondLevel2
Now, If I click "ThirdLevel" or "SecondLevel2", the menu will be closed automatically. But If I click "SecondLevel1", nothing happens. I know it is the logic you made it. But I want to close the menu when clicking "SecondLevel1". If there any way to do it?
It is something like : -TopMenu
-SecondLevel1 -ThirdLevel
-SecondLevel2
Now, If I click "ThirdLevel" or "SecondLevel2", the menu will be closed automatically. But If I click "SecondLevel1", nothing happens. I know it is the logic you made it. But I want to close the menu when clicking "SecondLevel1". If there any way to do it?
4 Answers, 1 is accepted
0
Hi He Ying,
The click on the submenu header is used for opening another submenu. When you set a delay for the opening of the popup , the click on the header will still open it immediately despite the delay setting. So you cannot use the click on the header for other implementation purposes like closing the menu.
If you intend to use the desired functionality for marking a user's choice like selection among a variety of options, you might want to consider using checkable menu items. The menu items will be checkable if you set IsCheckable="True".
I hope this helps.
Best wishes,
Dani
the Telerik team
The click on the submenu header is used for opening another submenu. When you set a delay for the opening of the popup , the click on the header will still open it immediately despite the delay setting. So you cannot use the click on the header for other implementation purposes like closing the menu.
If you intend to use the desired functionality for marking a user's choice like selection among a variety of options, you might want to consider using checkable menu items. The menu items will be checkable if you set IsCheckable="True".
I hope this helps.
Best wishes,
Dani
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
0

He
Top achievements
Rank 1
answered on 13 Jul 2011, 10:57 AM
Hi, Dani
Thanks for your reply. But I do need "SecondLeve1" works the same as "ThirdLevel" when clicking in the example. The checkable menu item cannot solve my problem. Is there any method that can be used to close the popup in code?
Best Regards
He Ying
Thanks for your reply. But I do need "SecondLeve1" works the same as "ThirdLevel" when clicking in the example. The checkable menu item cannot solve my problem. Is there any method that can be used to close the popup in code?
Best Regards
He Ying
0
Hello,
RadMenu actually has a property named NotifyOnHeaderClick that was created especially for scenarios like yours. You need to set it to true and the menu will automatically close when you click on items with children. In addition, the ItemClick event will be fired.
Regards,
Valeri Hristov
the Telerik team
RadMenu actually has a property named NotifyOnHeaderClick that was created especially for scenarios like yours. You need to set it to true and the menu will automatically close when you click on items with children. In addition, the ItemClick event will be fired.
Regards,
Valeri Hristov
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
0
Hi He Ying,
You can try the following approach:
I hope this helps.
Best wishes,
Dani
the Telerik team
You can try the following approach:
private
void
RadMenu_ItemClick(
object
sender, Telerik.Windows.RadRoutedEventArgs e)
{
RadMenuItem item = e.OriginalSource
as
RadMenuItem;
while
(item.Parent !=
null
)
{
var parent = System.Windows.Controls.ItemsControl.ItemsControlFromItemContainer(item)
as
RadMenuItem;
if
(parent !=
null
)
{
item = parent;
}
else
{
break
;
}
}
var menuItemAutomationPeer = FrameworkElementAutomationPeer.CreatePeerForElement(item)
as
RadMenuItemAutomationPeer;
menuItemAutomationPeer.Collapse();
}
I hope this helps.
Best wishes,
Dani
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!