Hello,
I'm seeing an issue with the RadDropDownButton and am wondering curious if there is a work around for my scenario. When focus is on a RadDropDownButton pressing 'Enter' or 'Space' normally causes the button to display the DropDownContent; what I'm seeing is this keyboard functionality stops working after the following steps.
1. User clicks the RadDropDownButton. This causes the DropDownContent to display as expected.
2. User clicks the RadDropDownButton again. This closes the DropDownContent to hide as expected and focus is once again on the button itself.
Unfortunately it is at this point that 'Enter' and 'Space' seem to no longer work. Even after tabbing off of the control and returning the keyboard functions do not work. Interestingly pressing 'Space' actually changes the button visual to the 'Pressed' state but the DropDownContent is not displayed. Any ideas to get the keyboard functionality work would be greatly appreciated. We are currently using assemblies version 2012.2.912.40. Thanks much for any feedback!
Below is the code for a small test app that exhibits the behavior outlined above.
MainWindow.xaml.cs
MainWindow.xaml
ViewModel.cs
I'm seeing an issue with the RadDropDownButton and am wondering curious if there is a work around for my scenario. When focus is on a RadDropDownButton pressing 'Enter' or 'Space' normally causes the button to display the DropDownContent; what I'm seeing is this keyboard functionality stops working after the following steps.
1. User clicks the RadDropDownButton. This causes the DropDownContent to display as expected.
2. User clicks the RadDropDownButton again. This closes the DropDownContent to hide as expected and focus is once again on the button itself.
Unfortunately it is at this point that 'Enter' and 'Space' seem to no longer work. Even after tabbing off of the control and returning the keyboard functions do not work. Interestingly pressing 'Space' actually changes the button visual to the 'Pressed' state but the DropDownContent is not displayed. Any ideas to get the keyboard functionality work would be greatly appreciated. We are currently using assemblies version 2012.2.912.40. Thanks much for any feedback!
Below is the code for a small test app that exhibits the behavior outlined above.
MainWindow.xaml.cs
using
System.Windows;
namespace
DropDownButtonKeyBehavior
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public
partial
class
MainWindow : Window
{
public
MainWindow()
{
InitializeComponent();
DataContext =
new
ViewModel();
}
}
}
MainWindow.xaml
<
Window
x:Class
=
"DropDownButtonKeyBehavior.MainWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
xmlns:commands
=
"clr-namespace:Microsoft.Practices.Prism.Commands;assembly=Microsoft.Practices.Prism"
Title
=
"MainWindow"
Height
=
"400"
Width
=
"200"
>
<
Window.Resources
>
<
DataTemplate
x:Key
=
"DropDownContent"
>
<
Grid
Background
=
"Orange"
Height
=
"300"
Width
=
"300"
>
<
Grid
Margin
=
"5"
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"Auto"
/>
</
Grid.RowDefinitions
>
<
telerik:RadDatePicker
/>
<
Button
Name
=
"Save"
Grid.Row
=
"1"
Content
=
"OK"
HorizontalAlignment
=
"Right"
Width
=
"105"
/>
</
Grid
>
</
Grid
>
</
DataTemplate
>
</
Window.Resources
>
<
Grid
x:Name
=
"LayoutRoot"
>
<
Grid.RowDefinitions
>
<
RowDefinition
/>
<
RowDefinition
/>
</
Grid.RowDefinitions
>
<
telerik:RadDropDownButton
Content
=
"Click Me For Popup"
IsOpen
=
"{Binding IsExpanded}"
Background
=
"Gray"
HorizontalAlignment
=
"Center"
VerticalAlignment
=
"Center"
Height
=
"90"
Width
=
"90"
commands:Click.Command
=
"{Binding ExpandCommand}"
commands:Click.CommandParameter
=
"{Binding}"
>
<
telerik:RadDropDownButton.DropDownContent
>
<
ContentControl
ContentTemplate
=
"{StaticResource DropDownContent}"
DataContext
=
"{Binding}"
Content
=
"{Binding}"
/>
</
telerik:RadDropDownButton.DropDownContent
>
</
telerik:RadDropDownButton
>
<
TextBox
x:Name
=
"FocusHolder"
Grid.Row
=
"1"
/>
</
Grid
>
</
Window
>
ViewModel.cs
using
System;
using
System.ComponentModel;
using
Microsoft.Practices.Prism.Commands;
namespace
DropDownButtonKeyBehavior
{
public
class
ViewModel : INotifyPropertyChanged
{
#region ViewModel Members
private
DelegateCommand<
object
> mExpandCommand;
public
DelegateCommand<
object
> ExpandCommand
{
get
{
return
mExpandCommand ?? ( mExpandCommand =
new
DelegateCommand<
object
>( _OnExpandCommandExecuted ) );
}
}
private
bool
mIsExpanded;
public
bool
IsExpanded
{
get
{
return
mIsExpanded;
}
set
{
if
( mIsExpanded != value )
{
mIsExpanded = value;
OnPropertyChanged(
"IsExpanded"
);
}
}
}
#endregion ViewModel Members
#region Ëvents
public
event
PropertyChangedEventHandler PropertyChanged;
#endregion Ëvents
#region Private Members
private
void
_OnExpandCommandExecuted(
object
obj )
{
IsExpanded =
true
;
}
#endregion Private Members
#region Protected Members
protected
virtual
void
OnPropertyChanged(
string
propertyName )
{
PropertyChangedEventHandler handler = PropertyChanged;
if
( handler !=
null
)
{
handler(
this
,
new
PropertyChangedEventArgs( propertyName ) );
}
}
#endregion Protected Members
}
}