WPF Buttons don't change when pressed - c#

I am using Windows 8 and getting my feet wet with WPF and one of the things that is bugging me is that buttons don't change color when they are being pressed like they would in a WinForms program.
I tried searching and oddly enough I can't see anyone else discussing this so I almost think it's something specific with my setup although as far as I can tell I haven't changed anything that would do this.
The button changes color when I hover over it and when I click it doesn't change, it still looks like I am just hovering.
Is this what it is supposed to do and if so what is the best way to override this and still respect the user's theme colors?
Thanks
UPDATE
To demonstrate what I mean here are screen shots showing a standard button in Windows 7 compared to Windows 8. What I am trying to figure out is how to make WPF button in Windows 8 behave like any other button and make it look like the button is getting pressed in when you press it.

Related

How to dynamically pop up and hide UIPickerView in iOS (Xamarin C#) game?

I have seen a very good example of implementing UIPickerView at:
Picker in Xamarin.iOS available
However, my scenario is a little more complex than that because I don't want to constantly display the picker on the screen. Instead, I want to dynamically display and hide the picker in my game as needed.
Specifically, here is what I want to implement:
(A) First, on my game screen, when users click on a button called "Choose Background Color", I will need to pop up a picker that shows 3 values: Red, Blue, and Green.
(B) Next, users can scroll through the list of the colors inside the picker, and choose any of these 3 colors.
(C) After the users officially choose a color, I will need to close (or hide) the picker from the screen.
(D) Finally, I will display the color that the users select in step (C).
I think I can implement step (D) easily. But, my main question is this: in step (C), how do we know when exactly the users finish selecting a color so that I can dynamically hide the picker ? The users may scroll back and forth many times to look at all 3 colors, and so, it may be difficult to know when exactly the users finally make a choice.
Or is it reasonable to expect that after users finish selecting a color, they will click on any space outside the picker ? Is it the standard behavior ?
Or, instead of using pickers, should I write my own customized "RADIO BUTTON" ? (Unfortunately, iOS does not have the standard radio buttons. Therefore, it will take a lot of time to design my own customized radio button controls...) Or, can you recommend another iOS standard control for this case ?
I would greatly appreciate your answers to my questions or your suggestions on how to solve my technical issue.
Furthermore, if you can show me any sample code for step (C) or (A) and (B) and (D), I would definitely appreciate very much too. Mainly, I am not sure how to handle step (C), which is the main point of my question.
BTW, I can only write code in C# with Xamarin.iOS. So, it will be wonderful if you can show me the code in C#.
Thank you so much.

Get a Windows Form to behave similar to a taskbar

I've got a problem (well, rather no clue how to do something) about my Windows Form.
I have set up a windows form that, much like the task bar, goes from the left to the right of the screen. Now I would like it to, instead of being "above" other windows, "push" them down / make them smaller so they fit between a sort of "top-task-bar" and the normal taskbar - here you have a screenshot of what it looks like right now:
As you can see, it's in the way of other programs' controls etc.. Since I would like it to stay TopMost, I have to do what the task bar does - decrease the working area so programs have no problems but it's still there. I'm using Windows Forms.
Any advice on how to achieve this?
Thanks!

Tile focus display issue

I'm working with a Windows Forms Application (.net/c#)
Using MetroFramework. Home page contains some MetroTiles. I need to focus on first tile when I launch Home page.
I Can do this focus is working fine. but it could show any indication for selected/focused tile at all. I could not find any properties.
In above image back Tile is selected now. but could not identify this as user and when I press 'enter' BACK button functionality is working fine. Same for other tiles also. Please help.
There is no property, but you can use the 'selected' event to change something yourself, like a slightly changed color or drawing a thin line around it.
As far as I know Metro still hasn't a built in a functionality for this case.
So try to use the workaround if possible.

Synchronize click on group of buttons

I am developing my first Windows embedded Compact 7 application. It is c# and .net 3.5
I have a group of buttons. When one of the buttons is clicked, the effect wanted is, that all of the buttons seem to be clicked at the same time.
Solutions I found till now, like
SendKeys.Send("{ENTER}");
or even better
button1.Performclick
seem not to be avalable on WEC7.
Or do I oversee something, that would make them available?

Prevent Window Focus Change

I'm trying to help a disabled person with a small bit of code to help him play a game easier. He is limited to a trackball and a single button.
Currently he uses the onscreen keyboard and has managed to play other games using it. I've created a small bit of code to try and make his live easier. It uses hover buttons for the keys. When the mouse pointer enters the button it sends key down, when it moves off the button it sends key up.
I have that working and I think (or hope) he's going to like it. It worked pretty well when I tested it.
I want to add one more piece of functionality to it. If he clicks while over my control, I want to send a different key stroke. Not a problem, I can do that. However, when I do that window focus shifts from the game to my control.
I found this on MSDN:
http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/48737c2b-7e6f-4ade-ac1c-7dd2f5cc2b88/
That works to prevent my window from activating, but it still causes the game to lose focus. I can set the focus back to the game, but I would prefer if it just never lost focus.
I'm coding in C# and WPF.
Anyone have any ideas on how you might do that?
John Fenton
Hook in some low level mouse and keyboard hooks, and your application won't need to steal focus and give it back.
Take a look at this pastie of a simple WPF app, which is heavily based off of an article by Stephen Toub.
Whenever you left click, anywhere, a second left click is sent, so you effectively double click. You could achieve your goal by hiding your app whenever the user clicks, so that your app never steals focus. Then detect the location of the click, and decide if one of your buttons would have been pressed, and act accordingly.
I realize I'm digging this out of the past, but hopefully someone will find this answer helpful. Cheers, and good for you for turning your programming to assist a fellow human!
You could try canceling the event PreviewLostKeyboardFocus as mention in this blog:
http://immortalratblog.blogspot.com/2008/03/canceling-keyboard-focus-change-in-wpf.html
Im guessing that focus is lost be simulating the key press?

Categories