开发者

Looking for a Silverlight 3 or 4 Menu control providing decent keyboard support [closed]

开发者 https://www.devze.com 2022-12-26 07:54 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 7 years ago.

Improve this question

I've an N-Tier application using Silverlight for the client. The customer as one particular request - I thought was more than reasonable: all actions – including menu navigation – has to be available through keyboard.

When I tried Silverlight 4 I was surpris开发者_Python百科ed not to find any menu control so I downloaded several open source and commercial menu controls. I was very disappointed, after having searched for a couple of hours I didn’t manage to find any control that provide a decent keyboard support. Most controls provide no support or some basic support but not one control enabled to gain focus on the first item through the keyboard. You are able to use the keyboard (arrow keys) but you need first to select the control with the mouse! Not one control provided support for Keyboard shortcuts.

Does anyone know of any Silverlight control providing descent support?


Personally I'm glad that a built-in Menu control is not included. I'm not suggesting that your app does need one but at least its forced you to think about it, if you could deliver the functionality without one you would have and that's a good thing.

What it sounds like you are looking for is the menu accessor keys like <Alt>+F. Now here is the thing, for that to work well the API would have to support a page wide keypreview event, allowing the required key combination to be intercepted despite what control has the focus.

Silverlight doesn't provide such an event. The best you can do is a KeyDown or KeyUp event on the UserControl. You can make it a tab stop so that it can get the focus even if there isn't another control in the UI that can get the focus.

However any control which marks a KeyDown or KeyUp event as handled will prevent the UserControl from receiving that event and thereby making the Menu's response to such direct keyboard access appear patchy and inconsistent. This will in turn be interpretted by most users as a bug.

I suspect for this reason the vendors of menu controls don't offer this feature in order that their reputation isn't impinged by what is actually a limitation in the platform.

Bottom line is if you must have this feature you could probably deliver it reasonably well with KeyUp or KeyDown event handling but you need to test the UI rigorously to see if there are any circumstances where it doesn't work.


This menu provides quite a decent solution:

http://sl4popupmenu.codeplex.com/

Due to browser limitations the choice of keyboard modifiers is mostly limited to Ctrl+Alt though.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号