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

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.

Related

Can you make a text box on a C# form act like an excel box?

I want the user to be able to type like = or whatever and then write an equation. Once they click off the box, I want the textbox to show the answer.
For example they could put =2+2 and it would display 4 when not selected.
I have no idea how to do this at all or even where to begin. I can get the textbox to calculate it somewhere else but not in the box itself where the equation is written or without having the user press a button.
What you're probably looking for is the LostFocus event. This event fires whenever a control loses focus (for example when a user tabs out of a text box). If you listen on this event for your text box, you can then call whatever processing code you want to handle any calculations required by the value of the text box and then set its value to the result of the calculation.

Highlight certain controls when hovering above a button

I have the following case:
There are several list boxes where the user can select something, some text boxes to enter text and several buttons to execute commands.
If a button is not enabled (due to a wrong/missing selection in a list box and/or a wrong entry in a text field), I'd like to show the red error adorner around the elements that needs to be fixed.
I know how I can show the red border when a entry is not correct using Validation rules - but they are not applicable since the fact "is correct" depends on the command the user wants to execute. E.g. to add an element, there is no need for a selected element in a listbox, but if you want to delete one, there needs to be a selected one.
You should use an attached behavior on the button itself. Then, hook the MouseEnter and MouseLeave events for the button.
Then all you have to do (when the mouse enters and exits the button) is fill out the validation rules for each control you want to "turn on or off" for the validation box.

Combo box with single image in the header

I have a combo box that is bound to a list of strings. The combo box has a check box next to each value so the user can choose values.
I do not want the user to be able to "select" an item. when the combo box drop down is not open I always want a single image to show. So this would look a lot like a button but with a drop down list of check boxes.
I have already done the check boxes and text box so I dont need help with that, but I cant seem to find out how to achieve this.
C#
WPF
Visual Studio 2012

WPF Prevent button from taking focus from any other control

I have an "On screen keypad" with some up/down/left/right/select buttons.
The select button is effectively a click and the arrow keys fire the associated up/down/left/right key.
The problem is that when selecting a combo box, I can't press the down/up buttons to navigate the items in the list. It is because the combo box auto closes when loosing focus. I can see similar problems happening with other controls, so I would like to see if there is a way to do the following.
For certain buttons (up/down/etc), when clicked, fire the click event, but don't take focus from w/e currently has the focus. This would allow the combox dropdown to stay open while pressing up/down to navigate through the items.
I have tried to set Focusable=False on the navigation buttons but the focus is still taken away from the combo box and the dropdown closes.
Any ideas/suggestions?
Thanks in advance
This isn't happening because of anything your Buttons are doing so changing their focus state won't make any difference. ComboBoxes close when you click anywhere outside of them, including empty space, non-interactive controls, other windows...

SilverLight / WPF Button with DropDown

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

Categories

Resources