C# WIndows phone disable button after one press - c#

I'm making a Windows Phone 8.1 app in Visual Studio 2013.
I have a page where a user sees an image and button labelled "Complete". The user has to do (in real life) what is in the image, and then press the button. After the button is pressed he is awarded 3 points.
Once the user presses the button, the first time, I would like to disable it. Right now, there is a bug where the user can press it many times and gain more points from one task.

Try doing this:
Button myButton = FindName("ButtonName") as Button;
myButton.IsEnabled = false;
For more information check this: Disable button in WPF?

Related

Pop Up Menu Button

I wish to make that a popup menu will appear out of a button on a left key button press in C#.
(Like the reboot/logout menu in Windows 10 which appears after you press the circular button which you can see in the example picture.)
All I've found is related to Menustrip/Contextstrip, however I don't want a strip nor a right key contextstrip; i just want a menu out of a button.

Handle button which has drill-down menu

So i have a UI that when you right click on a button, it opens a screen with 3 other buttons on it. How do i get the event system to not override the last button clicked (being what i right clicked to open the screen) when i click down on the button that is opened. The only way i can think to do it is to store the button that was right clicked in another variable. I was wondering if there was a way to prevent the event system from overriding the last button pressed. So that my code will run off what was right clicked and not the button that was clicked.

when I pressed enter it goes direct to the button

I am developing web form in asp.net inside it there are drop down list , text box and buttons when I pressed enter after text box it goes direct to buttons how can I stop that I didn't put that button as default button but I need to know why is that happening ?

Keep a Button control in the pressed state wp7?

How can I keep a Button control in the pressed state in a windows phone 7 app using C#? I want to have many different buttons on the screen, but when I press any of them I want it to stay pressed. Any ideas?
Also, once it is in its pressed state, is there a way to "depress" it manually?
Thanks
If the button properties are as follows:
foreground: white
background:black
Then in the pressing state its properties will be
foreground: black
background:white
If you change the properties of button in click event it can be seen as it is pressed. And making the IsEnabled property of button prevents it from firing the events on buttons.

Windows Forms: Multiple default buttons?

In a simple Guess-The-Number game I'm making, the user inputs a couple of numbers and hits a button. A second panel becomes enabled and the original one is disabled. The user now enters a number and hits another button, multiple times. Since the two panels will never be enabled at the same time, I'd like for both buttons to be "default", i.e., they will be pushed if Enter is pressed. Is this possible? Apparently, I can only set one of these per window.
A window in Windows by definition has only one default button. This is a functionality intended for dialog windows where you would never disable the default button.
What you can do instead is to switch the default button when you disable one panel.
Another option would be to throw out default buttons altogether and use KeyPreview on the form and handle the enter key yourself, sending it to the appropriate button that is currently active.
Nope, no way to accomplish that that I know of. You'll have to switch the default button when one button is pressed to the next button.
You can only have one default button per window. However, this can be changed at runtime, so when you activate a specific panel, you can make it's button the default one at that point.

Categories

Resources