SilverLight / WPF Button with DropDown - c#

Is it possible to create a button with a drop down, or a combobox that has the dropdown arrow along the bottom as opposed to the right hand side? I am trying to emulate the "Paste" button in the Word 2010 ribbon.

I've used it with success, but only on the right-side.
http://blogs.msdn.com/b/delay/archive/2010/06/11/splitbuttoning-hairs-two-fixes-for-my-silverlight-splitbutton-menubutton-implementation-and-true-wpf-support.aspx
However it is customizable to the point where you may manipulate the _contextMenu.HorziontalOffset and _contextMenu.VerticalOffset to your liking.

Here is a small sample that you get the right idea how to accomplish that. But it's not the word like button:
http://www.tanguay.info/web/index.php?pg=codeExamples&id=140

Related

Combining dropdown menu to its button in Winforms?

I'm wondering how you can get a dropdown menu to blend in with the button clicked as seen in the above image. I've created a flat button with no border to mimic the look of the Edit, View, Project, etc. buttons, and have added a ContextMenuStrip to act as a dropdown whenever one of the buttons is clicked. The image below is however the best I could make it.
Is it perhaps some tool other than a Button + ContextMenuStrip that needs to be used to achieve a blending look like the first image? Thank you for any help.
You can use a MenuStrip control:

Adding control event methods from the code window Drop downs always go to bottom, can this be changed

In the Visual studio IDE, i like to make regions to group functionality.
when I go to add a new code sub for a control event, by using the drop downs at the top of the code window and pick a control event that has not already been added.
it adds it to the bottom of the code window and I have to copy and paste it to move it back where I want it (at my current caret position).
Is there any way to make these generated control event methods insert at the current caret position instead of the bottom?
To clarify an example would be in the middle drop down box select Button1 in the right drop down box select the Click event.
if this is not a setting does anyone know of an addin that will accomplish this.
I couldn't seem to find a setting for this in the visual studio options (there may be one, but where)
Good question!
This is very annoying behaviour. Would be good to find an option for this, or get it sorted by Microsoft.

C# Check box, only check the box not the text

Okay i swear i looked for this on google before posting.
I tried:
C# check box active area
C# check box check box not text
and a few others.
But i have a check box on top of a button. I want to be able to click the button even when the mouse is over top the check box text area. I want the use to only be able to click the actual box. But when the mouse is over the check box's text, it should click the button.
Thanks all!
I'm assuming this is in WPF / XAML.
Simply add the checkbox to the button without text. Add the text to the button not the checkbox.
That said, I cannot for the world think why this would be a pleasant user experience and would suggest trying to use a different means of getting the information.
So instead of having the checkboxes over top the button, i just created a seperate window that will show with the three options to choose from upon clicking that button.
But i still think it would be cool/neat to have them on top of the button.

C# - Menu Strip Query

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.

What WPF control should i use for my window?

So im making a WPF project where one of my windows has to let the user see a text. Select parts of this text for being put into an array of strings and no more than that. So he/she musnt be able to edit anything in the text only highlight parts and then click on a button. What WPF control would be smart to use for this?
I'd probably just use TextBox with IsReadOnly set. The various selection properties are all you need after that.

Categories

Resources