I mean this, before right click (press and hold):
Documentation says:
Holding is intended for informational UI, but for interactions like displaying a context menu you should use RightTapped instead. You might handle Holding first to display a hint that a menu will appear, but to display the menu itself, use a RightTapped handler
And I want to use that transparent recangle, but documentation doesn't say how. Is there any simple way?
Related
Inheriting from ListView control for WinForms and I would like to display a context menu when a item is selected and a totally different one when there is none.
This approach seems straight forward and I saw lots of examples that basically listen to the right click event and upon that decide which context to show and force it to show at cursor location.
What I am looking for if there is a more efficient / native method of doing it rather than listening to the right click event, for starters it will not work if you try to open the context from the keyboard (either shift+F10 or with context key). Plus, if you are using keyboard to navigate the listview and your cursor is elsewhere then it looks horrible. On top of that the menu should be shown on mouseUp and not mouseDown which make it a bit more complicated.
I was looking for an event of the base control class that would handle the "onContextInvoked" or similar, even onContextOpening but at the control level not the context menu level.
Anyone has a better feedback/solution/approach to this?, or I just have to deal with mouse/key events and force to show a context which is not actually bounded to the control itself?
One idea I had is to always use one context menu as normal and then on the opening event of that one check if items are selected and if not try to cancel that context and open the other one on that very same position, but I haven't tried it yet.
I don't know if it is okay to ask it here but i hope i can get a good response.
I just want to align the button OK in the right side and also i already change the properties of it to right from default but still when i run my project it stay always in the left side. Did i miss something? Or is there any better way to align my button inside popup menu? can someone help me please.
this is the current output when i run my system.
and you can see that the button okay still in the left side.
Actually there is an TextOptions.HAlignment property which is used by BarButtonItem.Appearance, BarButtonItem.ItemAppearance and BarButtonItem.ItemInMenuAppearance and has values Far,Center,Near. Still, it is not supported in all cases (as it is referred in Note section of the link) and I'm afraid the popupmenu is one of them, because it cannot be found in Designer, you can access it only by code. Also all my tries to change the value of property had no effect in caption alignment. My proposal is to add empty space in your caption in order to bring it to center, supposed your menu width will stay the same
I have multiple controls on one form,and when i select some value from combo box(for example 1) next control became enabled, else next control stay disabled.
Problem is that if i just press 1 and tab, after that next control became enabled, but program jump over it just like control are still disabled, and tab control selecting next control.
I need to find way how to tab check is control become enabled and go on this control,and if control are still disabled that go on next enabled control.
Thanx
You created a mousetrap for the user, very hard to escape from. Technically you can handle the keyboard navigation by trapping the Tab key before it can be used to navigate but the user still has an unsolvable problem when he wants to use the mouse to change the focus. He has nothing decent to click on.
You'll need to re-think your UI design. One possible solution is to change the ComboBox's DropDownStyle to DropDownList. Which ought to be pretty appropriate if you use its selected item to enable other controls, there should only be a limited set of valid selections. If that's not what you want then you need to do something drastic. Not necessarily limited to hiding controls instead of disabling them.
This is probably caused by the event of the combo-box you using to control your flow.
The "Changed"/"Value changed" events in most languages fire up after the control has lost focus.
You forgot to add a tag for the UI technology you are using.
If you are using WinForms, then you can try to execute the SelectNextControl method on your control that the user just edited. This will find the 'next' control for you, and activate it.
Lets assume it's winforms (playing with disabled/enabled like this in wpf is.. against mvvm rules).
Firstly, ensure what tab order/index of your controls is ok. To test, if they are all enabled, then pressing Tab should go through them in the right order. This can be seen easily
Next thing is to choose one of many possible solutions, to make 1,Tab to work:
disable Tab key navigation at all;
make controls to pass control (focus) to specific control (making tab order irrelevant);
use SelectNextControl (work best for custom controls, which when will support that tab-flow schema);
prevent focus changing, do all logic, change focus (theoretically).
I have two questions regarding the windows form menu strip:
1. How to force the form to always show the helper keys?
Currently the letter underlines are displayed only if the Alt key is pressed.
2. What is the command to cause a menu to drop down?
Usually a menu drops down after the user clicks the menu button or navigates it with the keyboard, but I want to cause a menu to drop down by pressing an interface button and I can't figure out how to do it. I tried fiddling the DropDown property, but it didn't help.
With ToolStripMenuItem there are three properties you need to look at:
ShortcutKeyDisplayString
ShortcutKeys
ShowShortcutKeys
Although the three apply to the root menu item, say File or Help, you will not be able to see the short cuts, however you should be able to enable the ShortcutKeys, set ShowShortcutKeys to true and without modifying ShortcutKeyDisplayStringhave them appear next to sub ToolStripMenuItem's.
The method you are looking for on ToolStripMenuItem is ShowDropDown(), executing this method will drop down the menu.
Example:
((ToolStripMenuItem)FileMenu.Items[0]).ShowDropDown();
AFAIK, it is not easily possible to do that in C#. The easiest way is to change the Windows settings. On Windows 7:
Go to Control panel
Ease of Access Center
Make the Keyboard easier to use
Check Underline keyboard shortcuts and access keys.
I'm working on a custom user control that essentially displays a name value pair (name is on a black background, value on a white). I have my control displaying correctly, even showing up in Designer and on my build page.
What I'd like to do from here is have the ability to right click on the user control and have a menu come up that has a "Copy Value" option, that when selected will copy the value in the "value" part of the user control to the clipboard. What is the best method of approach?
I'm not sure where to start since most of the documentation on user controls I've found deals with displaying the control, not necessarily interacting with it. Additionally, since I'm still learning C#, I might have left out an important part of my problem in this question, so please point that out if it's the case.
I'm using Visual Studio 2008 (if that matters).
Examine the ContextMenu control and the ContextMenu property of other controls. By assigning a ContextMenu control to the ContextMeny property of another control, you will have the right-click->popup menu wiring done for you. Then you only need to implement the click event of the different menu items in the context menu.
Then you can use the Clipboard.SetText (as suggested by BFree) to set the desired value to the clipboard.
Add a ContextMenu to the control. The, hook into the MouseClick (or MouseDown, whichever works better) event and if it's a Right-Click, then call show on the ContextMenu (there are a few overloads, try to mess with them see which works best for you). Then, in the click event of your context menu, just call Clipboard.SetText(...) to set the value to the clipboard.