# Wednesday, 15 September 2010

As of this week, I’m now working at WebMD Health Service in NW Portland.  I’m looking forward to working with the very smart people here, and learning about the latest in ASP.NET and Agile development in the enterprise.

More information to follow as the situation warrants. Smile

Wednesday, 15 September 2010 11:30:54 (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  | 
# Thursday, 02 September 2010
A while back I posted a revision to my original default button sample that made it a bit easier to use, but there was still an issue...  If you invoke the button while the focus is still in a text box, any changes made to the text in the text box may not get pushed into the databinding source, since by default that happens when the text box loses focus.  I didn't come up with a good solution, but luckily somebody did. :)  I got the following revision from Glenn Orr, and this should solve the problem.  If you have any custom data entry controls, etc. you may have to add additional clauses to handle them, but this will work with text boxes for sure.

Change the OnKeyUp method to look like this...


private void OnKeyUp(object sender, KeyEventArgs arg)
{
	  if (arg.Key == Key.Enter)
			  if (peer != null)
			   {
					   if (sender is TextBox)
					  {
							   BindingExpression expression = (sender as TextBox).GetBindingExpression(TextBox.TextProperty);
							   expression.UpdateSource();
					  }
					  ((IInvokeProvider)peer).Invoke();
			  }
}
This will make sure that any changes get pushed into the databinding source before the button is invoked. Thanks Glenn!
Thursday, 02 September 2010 10:00:05 (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [1]  |