This question is locked. New answers and comments are not allowed.
I have a menu item with StaysOpenOnClick set and two textboxes in it as well. On hitting Enter on either of the text boxes, I need to close the menu, but since StaysOpenOnClick is set, I can't use RadMenuItemAutomationPeer's Invoke method on the menu item with the two text boxes, so I call it on it's parent menu, which closes the submenu but what happens is that the tabbing location of the application is reset and that menu item that I called Invoke on stays highlighted until I mouse over it.
Here's the template for the dual text box menu item:
StaysOpenOnClick is set by the ContainerBindings.
Here's the template for the parent menu:
Here's the menu's declaration:
So, is this a known issue, or am I just doing this wrong. Is there an easier way to close a submenu and/or entire menu without any sort of highlighting issues or tab resetting issues.
Here's the template for the dual text box menu item:
<
telerik:HierarchicalDataTemplate
x:Key
=
"CustomRangeItemTemplate"
ItemsSource
=
"{Binding Items}"
telerik:ContainerBinding.ContainerBindings
=
"{StaticResource DataItemBindings}"
>
<
StackPanel
Orientation
=
"Vertical"
>
<
TextBlock
Text
=
"{Binding Text}"
Foreground
=
"Gray"
Margin
=
"0,0,5,0"
/>
<
StackPanel
Orientation
=
"Horizontal"
>
<
TextBlock
Text
=
"From:"
Foreground
=
"Gray"
/>
<
TextBox
x:Name
=
"txtFrom"
Width
=
"75"
Text="{Binding From,
Mode
=
TwoWay
,
NotifyOnValidationError
=
True
,
ValidatesOnExceptions
=
True
,
UpdateSourceTrigger
=
Explicit
}"
GotFocus
=
"OnClick"
KeyDown
=
"OnKeyDown"
LostFocus
=
"OnFromLostFocus"
Loaded
=
"OnFromLoaded"
/>
<
TextBlock
Text
=
"To:"
Foreground
=
"Gray"
/>
<
TextBox
x:Name
=
"txtTo"
Width
=
"75"
Text="{Binding ToStrikeBindingMember,
Mode
=
TwoWay
,
NotifyOnValidationError
=
True
,
ValidatesOnExceptions
=
True
,
UpdateSourceTrigger
=
Explicit
}"
GotFocus
=
"OnClick"
KeyDown
=
"OnKeyDown"
LostFocus
=
"OnToLostFocus"
Loaded
=
"OnToLoaded"
/>
</
StackPanel
>
</
StackPanel
>
</
telerik:HierarchicalDataTemplate
>
StaysOpenOnClick is set by the ContainerBindings.
Here's the template for the parent menu:
<
telerik:HierarchicalDataTemplate
x:Key
=
"MenuItemTemplate"
ItemsSource
=
"{Binding Items}"
telerik:ContainerBinding.ContainerBindings
=
"{StaticResource DataItemBindings}"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
TextBlock
Text
=
"{Binding PrecedingText}"
Foreground
=
"Gray"
/>
<
TextBlock
Text
=
"{Binding Text}"
/>
</
StackPanel
>
</
telerik:HierarchicalDataTemplate
>
Here's the menu's declaration:
<
telerikNavigation:RadMenu
x:Name
=
"Menu"
ItemClick
=
"OnRadMenuItemClick"
ClickToOpen
=
"True"
Margin
=
"1,0,1,0"
HorizontalAlignment
=
"Stretch"
VerticalAlignment
=
"Center"
ItemTemplateSelector
=
"{StaticResource MenuTemplateSelector}"
ItemsSource
=
"{Binding Items}"
/>
And here's the code that calls the Invoke method (note, in my implementation, I have a single menu item bound to the menu, and that has all the sub menu items)RadMenuItem rootMenuItem = menu.ItemContainerGenerator.ContainerFromIndex(0)
as
RadMenuItem;
RadMenuItemAutomationPeer mip =
new
RadMenuItemAutomationPeer(rootMenuItem);
mip.Invoke();
So, is this a known issue, or am I just doing this wrong. Is there an easier way to close a submenu and/or entire menu without any sort of highlighting issues or tab resetting issues.