How to implement a certain drop-down menu in WPF? - c#

I want to implement the following menu in WPF. Note that the "+" sign changes to a "-" when the Apple button is clicked. And in the opened submenu A.1 to A.5, the mouse over item is highlighted.
How am I going to do this?
There are four options:
The Apple menu is open:

I think control you are looking for is Accordian Control. You can find a good example of accordian here

Related

How to make Menu Button Selected when Menu is Opened?

Is there anyway to make unity automatically select the first button in my menu when the menu is first opened so that the player can use their keyboard to navigate through the menu?
Use :
button.Select();
There is difference between Selecting and Highlighting.

Stop displaying type cursor when clicked on a toolstrip

Im am making a toolstrip for my windows application in c#,
but when I press on a option of my toolstrip, the type cursor shows up.
It want it to be like a button, when you click on it something the code indicates happens. and not having the type cursor show up
Here is a photo of my problem:
I've already set ReadOnly to True, But this only prevents the user from typing in the toolstrip, not removing the type/text cursor.
I've tried Toolstrip.Cursor.Dispose(), But it gave me an error that toolstrip had no atribute Cursor. Al tough is should work on textboxes (haven't tried it on textboxes yet, because I have no need for that)
I'm a beginner with c#, but have some experience with python, so please go easy on me.
I expect that When I click on the box, The text/type cursor doesnt appear.
I use visual studio btw. I created the toolstrip in Design mode.
I Created A toolstrip, with a menu item, and In that menu item a textbox.
I shouldn't have created a textbox, but another menu item, and if that was pressed execute some code.
So If I just create a menu item in the toolstrip and create another menu item in the toolstrip, and set click to one of my code functions it acts as a button.

Putting hotkey/shortcut text next to toolstrip menu items in winforms

I want to be able to show the hotkey combination assigned to a toolstrip menu item in winforms. For instane, in any program (even your browser settings menu) you can see various menu items, and generally, aligned to the right of their item, is their hotkey shortcut. I want to do this programmatically.
Example: Instead of typing
Open a file (ctrl+O)
I want to have the properties show up independently of each other.
How can I achieve this?
You want to you use the ShortcutKeys property of the ToolStripMenuItem. This will let you pick the particular key combination you want for each menu item and it will show up to the right of the menu item. Make sure that you have ShowShortcutKeys property of the ToolStripMenuItem set to true.

One general context menu

I have one general context menu and for example 4 buttons and 4 textboxes - when I click on any of these buttons the context menu is opened and when I click on some items I would like to send this item to textbox, which was between button - I need to send some identificator to context menu to know which button open it and then to know where to send selected item.
How can I do that?
I am using c#
Thanks
this.ActiveControl will give you the button that has the focus. You can put the identifier in the Tag property of each button. This way, this.ActiveControl.Tag will give you the information you need.

How to create a menu similar to the Windows 7 Start Menu in WPF

I am contemplating having a menu in my WPF application that works in a similar way to the Windows 7 start menu.
In my mind, this means that I should make a user control that consitues a button. Clicking on the button will display a list box, and inside the list box it will be possible to search the items that are registered in the list box.
Would that be an advisable way of doing it or is it better to do something different such as changing the template of a menu control?
Thanks for any help, it is very much appreciated.
It seems you have the design already made up. Do exactly that! :) Create a button that when pressed, displays a panel that contains a list box and a text box. Tie an event to key presses in the text box that changes what the object bound to the list contains.
After that, it's just a SMOP!

Categories