.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Unexpected WPF Button Trigger behavior

Posted By:      Posted Date: September 22, 2010    Points: 0   Category :WPF

I have created a custom button style with triggers for "Keyboard Focus" and "IsMouseOver".

If I give keyboard control to one button while the mouse is over the other, the style works fine. However, as soon as I do "press" the button that has keyboard focus using the space key, the style for the button that is being moused over is reverted as if the control did not have the mouse over. Once the pressed button is released, the mouse over button reverts to the expected style.

This behavior does not occur in other windows programs, e.g. visual studio where the moused over control retains its style.

Here is some sample code to reproduce the issue and the steps:

1. Place mouse over button labeled "Another Button".

2. Press the tab key until the button labeled "One Button" has the style for keyboard focus.

3. Press the space key to trigger the style change for the "One Button" to the "Pressed Button" style. Hold the space bar.

At this point the "Another Button" loses the style for "Mouse Over".


<Window x:Class="ButtonStyleIssue.MainWindow"

View Complete Post

More Related Resource Links

Run Button Behavior: Suggestion/Bug


Note: This could be a bug or considered as suggestion. I am not looking for solution.

1: I have ImageWatermark.cshtml open and currently in focus.

2: I have Photo1.jpg selected in left Files workspace.

3: Now if I Click "Run", instead of opening ImageWatermark.cshtml it trys to open Photo1.jpg and it fails.

So ideally I would expect the "open file (ImageWatermark.cshtml) to run rather than running the selection from Workspace.

detect enter keypress and trigger button click (all browsers)


I have some textbox's that when the enter key is pressed on them, i should fire a buttons action (say the go button).

Seems that it no longer works accross current browsers and  i was wondering if anyone has some nice javascript or something to detect if enter is pressed and fire a button click action (accross all current browsers - ie8, ff, safari, chrome etc)

Make validation controls trigger only not clicking on submit button and not on other navigational bu


I have required validation controls on a page.  If the user got to this page by mistake and wants to go to a different section of the website using the navigational buttons; required validators are triggered and it will not let the user navigate away.  How do I get validators to trigger only when a submit button is clicked?


Thanks in advance!

Unexpected behavior of a Parameterized Row Filter for a Merge Article


Hi Everybody,

I have a merge publication with parameterized filter articles.

The filter statement of one article is:

SELECT <published_columns> FROM [Common].[StaffRule] WHERE StaffRule.ID IN (SELECT StaffRuleID FROM Common.fnCBCBC_Staff(SUSER_SNAME()))

I have created the snapshot files then created the subscription sucessfully.

The unexpected comes when adding a new record to the [Common].[StaffRule] table which satisfy the filter, but the record does not synchronize to the subscriber database.

Weird application behavior -- Action required to trigger service response otherwise the application



I am a WCF beginner and is trying out with a basic host service with callbacks to the client.

My code works wonders if my client app is a console.exe but when I transferred the code to a Windows Form app, the application will freeze.  But if I right click on the form window task bar, the code suddenly goes through and it would work...

Is there anything wrong with this?

The service is hosted on IIS

Here is my Service code:


[ServiceContract(CallbackContract = typeof





  ConcurrencyMode = ConcurrencyMode.Reentrant)]
 Chat : IChat


override wpf button default behavior - blinking on focus


How do you override the default blinking on a wpf button that has focus or on mouseover etc? I tried turning off all default behavior with 

<Setter.Property="FocusVisualStyle" Value"{x:Null}" /> and various other style settings, but nothing seems to work.




Multiple Flat Files Connection manager - unexpected behavior when using wildcard



I want to import multiple text files into a destination file.  This works fine when I point the connection manager directly to the 3 files that I need to import. However, these 3 files will change and sometimes there may be more or less files. Therefore I planned to use a wildcard (*). However, when I use a wildcard in the connection manager I get unexpected results - some of the records get duplicated in the output.  I have demonstrated this issue in  this short video clip. Apologies for the slight buzz / hum on the audio (you can just turn the audio off). 

Any help or advice would be appreciated. 



Problem to group radio button across gridview rows

In general no one can easily group or make a single selection from radio button list inside gridview rows. There are a lot of way to make a single or unique selection from list. Here i want to share how i can address this problem in the most easiest way. Googling the problem most of the cases i saw the grouping in horizontal way. Thats why i tried to group the radio buttons in vertical manner. Let i have a requirement like below:

Maintain HTML Radio Button Selection Inside GridView After Postback

Long time ago I wrote an article about getting the value of the selected RadioButtons inside the GridView control. The code did not addresssed the postback issue which means that the selected radio button was cleared after the postback occurs.

A Simple and Extensible Radio Button Style GridView

The GridView is one of the significant controls in ASP.NET 2.0 and later versions. No doubt it reduces a lot of work time. However, customizing the GridView control is not an easy task. For example, it's hard to add a radio button column to the GridView. This article demonstrates the reason why a radio button column cannot act as normal and how to create a simple and extensible radio button GridView.

Custom Editing Behavior for DataGridView TextBox Columns

For various reasons I'm using a DataGridView instead of a ListView, and while configuring the DataGridView to look like a ListView wasn't much of a problem, there's one thing that got on my nerves, which is the behavior of textbox cells in edit mode: It is much too easy to leave the edit mode accidentally, simply by pressing the cursor keys at the wrong time. For example when the text caret is positioned behind the last character of the textbox cell content, and you press the right arrow key

Editable Gridview with Textbox, CheckBox, Radio Button and DropDown List

This is an example of an editable gridview containing different ASP.NET controls. When user wants to edit values in gridview, she/he can use these controls to edit existing values in Gridview Edit Mode.

Using the Code

Radio Button Event

Here I have explained the events of radio button with javascript.
Let me explain the scenarion first,
We are having two radio button say radioobtn1 and radiobtn2. If I click on the button 1 then I need to show one DIVor FORM. same as when I click on radiobtn 2. I have given the code for the above scenarion.

Problem with Dynamic Button


Hi friends,

I am trying to make a page inspired from http://login.qlikview.com/help.aspx

here I have made a dropdownlist and on clicking I am able to dynamically add the textboxes and radio buttons using placeholders. My problem is I am not able to use a dynamic number of submit buttons. In the page (link above) I need to make the submit button available for two choices and invisible for one.  But the option dynamicbutton is not available alike dynamicTextboxes etc. What could I do? Is there any other way I could figure out to implement this.

Thanking you in advance,


replacing ok and cancel button of an alert message with YES an NO button in asp.net web application.


i want to replace ok and cancel button of an alert message with YES an NO button in asp.net web application.When a user will click yes the data will be saved in the database and if user clicks that will act as a reset button and do not save the data in database and the control will move with as usual to the redirect page.Any pointers will be highly appreciated.I am usin g C# language.

Button specific code


I have 2 submit buttons on my page. Right now, the only way to run the code behind with razor is to to If(IsPost). Since I have 2 buttons, how would I destinguish between the two in post? Is there a way to request a button that sent a post request?  

Using a trigger or anything else to populate two tables


Hi! I'm creating an application that's supposed to first add a record to table1, and then get the ID from that record to use when adding a record to table2, to be able to associate these two records with eachother.

The user gets to type in some values that goes to table1, and some values that goes to table2, but before the insert statement for table2 is executed i need the ID from the recently added record in table1. Some dude told me to use a trigger for the autopopulate purpose, but does that really work when i also need to save some values that's user input, and when those values doesn't get saved in table1?

Are there any other way to do this or can i send values to a trigger? I'm new to triggers and stored procedures, i don't have any particular knowledge of this, any help is appreciated!


Regards, Monsterbadboll

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend