All posts in Business

I think the title says it pretty well: we want the DatePicker control to not be stupid and allow tabbing to the calendar button so we can meet mouse-less compliance standards.

Q: Why didn’t Microsoft do this to begin with?
A: *shrugs* But, we’re going to fix it.

The code:


using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;

/// <summary>
/// Extended DatePicker.
/// </summary>
public class ExtendedDatePicker : DatePicker
{
    #region Members

    private bool _tabInvoked;

    #endregion

    #region Constructors

    /// <summary>
    /// Initializes a new instance of the <see cref="ExtendedDatePicker"/> class.
    /// </summary>
    public ExtendedDatePicker()
    {
        _tabInvoked = false;
        this.PreviewKeyDown += DatePickerPreviewKeyDown;
        this.CalendarClosed += DatePickerCalendarClosed;

        // Allow to be a tab target
        IsTabStop = true;
    }

    #endregion

    #region Events

    /// <summary>
    /// Dates the picker preview key down.
    /// </summary>
    /// <param name="sender">The sender.</param>
    /// <param name="e">The <see cref="KeyEventArgs"/> instance containing the event data.
    /// </param>
    private void DatePickerPreviewKeyDown(object sender, KeyEventArgs e)
    {
        var datePicker = sender as DatePicker;
        if (datePicker == null || e.Key != Key.Tab) return;

        // Mark that "tab" was pressed
        _tabInvoked = true;

        // Reverse drop down opened state
        datePicker.IsDropDownOpen = !datePicker.IsDropDownOpen;
    }

    /// <summary>
    /// Dates the picker calendar closed.
    /// </summary>
    /// <param name="sender">The sender.</param>
    /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.
    /// </param>
    private void DatePickerCalendarClosed(object sender, RoutedEventArgs e)
    {
        if (!_tabInvoked) return;

        // Reset marker
        _tabInvoked = false;

        // Go to next control in sequence
        var element = Keyboard.FocusedElement as UIElement;
        if (element == null) return;
        element.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
    }

    #endregion
}

Here is what it does in a nutshell:

  • Makes this control a tab stop (it’s not by default)
  • Binds to the PreviewKeyDown event, which catches when Tab is pressed. It then sets a marker, telling the control that the calendar was opened via keyboard and sets IsDropDownOpen to true.
  • Binds to the CalendarClosed event, which (if Tab was invoked) resets the marker and sets the focus to the next control in the view.

It’s not overly complicated, but it solves an annoyance.

Until next time…

2012 in review

Categories: Business
Comments: No

The WordPress.com stats helper monkeys prepared a 2012 annual report for this blog.

Here’s an excerpt:

600 people reached the top of Mt. Everest in 2012. This blog got about 2,500 views in 2012. If every person who reached the top of Mt. Everest viewed this blog, it would have taken 4 years to get that many views.

Click here to see the complete report.

In the world of web design, we are constantly facing the challenge of making a site as good looking as it is functional. And though many of us have attempted to do graphic design work on our own, it is usually proven that our scope is limited resulting in the pumping out of the same old templates to our customers.

With that in mind, we usually have to hire a graphic artist to assist in the web design process. It is well known that this can be a troublesome if not completely undesirable with the wrong people on board.

Here are the basic dilemma’s web designers face when dealing with graphic artists:

The client provides one to help supplement the job: The issue here is trust and collaboration. Many times when two contractors are working together because the client forces the relationship, competitive interests come to the surface making the relationship difficult. If the chemistry is not perfect, one of the contractors may abandon the project entirely. Even if you are not the one that left and finished the site, it still leaves a bad note with the client since you didn’t “work it out”.

The artist does good work, but is a diva: This one is pretty common. I have dealt with many artists who work on “their” schedule. This translates to “when I get my lazy butt in gear and care enough”. These people are usually very difficult to deal with, and don’t like to revise their work to meet client expectations should the planning phase drag on long enough.

The artist does poor work but refuses to accept it: Ever have an artist on contract that doesn’t meet the client expectations because the quality of the mocks and design assets are not good enough within realistic requirements? Then trying to convince them to update their stuff without hurting their feelings is near impossible.

Now, all that being said we are not without hope. I personally have found an awesome graphic artist who I will call “Rebecca” in this context, so as to not publish her real name on this blog. Xcalibur Systems asked Rebecca to design mocks for our new site, and I have to say; we are thrilled at what she has come up with. Take a look at the below image to see what I mean:

In summary, working with a graphic artist can be a huge challenge. However, there are plenty of Rebecca’s out there that will make the experience worthwhile. With patience and continued research, you’ll find one too.