Tim Hibbard

Software Architect for EnGraph software


News





Add to Google



My Stats

  • Posts - 593
  • Comments - 353
  • Trackbacks - 507

Twitter












Tag Cloud


Recent Comments


Recent Posts


Article Categories


Archives


Post Categories


Image Galleries


EnGraph Blogs


Links


Other


Roll


September 2007 Entries

WPF - TextBox.SelectAll


I think that any business application should select all the text in a TextBox when the user tabs into it.  Your advanced users that take advantage of the tab key will appreciate it.  In WinForms 2.0, the best way of accomplishing this was to create a new control that inherited from TextBox that implemented SelectAll functionality and use your new control instead of the normal TextBox.

In WPF, this is much easier.  In the App.xaml.cs, override the OnStartup method and use the EventManager.RegisterClassHandler to listen to the GotFocusEvent of every TextBox:

 

protected override void OnStartup(StartupEventArgs e)
{
   EventManager.RegisterClassHandler(typeof(TextBox), 
         TextBox.GotFocusEvent, 
         new RoutedEventHandler(TextBox_GotFocus));
   base.OnStartup(e);
}

void TextBox_GotFocus(object sender, RoutedEventArgs e)
{
   (sender as TextBox).SelectAll();
}

If you want to override this behavior for a specific TextBox, just point the GotFocus event to a method like this:

void NoSelectTextBox_GotFocus(object sender, RoutedEventArgs e)
{
   (sender as TextBox).Select(0, 0);
}
 

posted @ Tuesday, September 18, 2007 8:29 AM | Feedback (1) | Filed Under [ .NET WPF ]


A request to anybody who is bored on a Friday afternoon


If there is anybody who has some spare time and wants to build some killer TFS tools, I have some ideas for you.

I would love a Vista gadget with a search box that searches all work items from a predetermined Team Project.  This gadget should also have a button that allows me to create a predetermined work item in a predetermined Team Project with a predetermined iteration path.

I would also love a script that would merge my dev branch into my main branch, check in the changes (overriding any policy failures is fine), then kick off a predetermined build and if the build was successful, run a predetermined batch file.

Any takers?

 

Technorati tags:

posted @ Friday, September 14, 2007 1:23 PM | Feedback (0) | Filed Under [ .NET TFS Vista ]


View Kyle's GPS location on Google Maps in Jersey


DSC00445

Kyle Archer is headed to New Jersey today to swoon our future clients at the COST Expo 2007 tradeshow.  He took our Where's Tim phone, so you can view his current GPS location on Google Maps in real time (updates automatically every 15 seconds).

You can view his location here. Or download the Where's Tim task tray alerter.  It's ClickOnce, so it's double cool.

Bring home the bacon, Kyle!

 

posted @ Thursday, September 13, 2007 8:00 AM | Feedback (0) | Filed Under [ .NET GPS Where's Tim ClickOnce ]