The Curious “Today” Button

[UPDATED: This article was meant to share a quick hack that I created.  I am not endorsing this as a best practice that you should incorporate into your applications.  I’m offering it as an option to those of you building apps that only use the English language.]

Yesterday, I was working on a Windows Phone application that is very date-centric.  I show the user a list of events for a specific day, and the page always loads data for “today” by default.  They can always change it (I’m using a DatePicker for that), but I wanted to give them an easy way to return to whatever “today” may be.

I’d seen this before, in the Calendar app that comes on Windows Phone by default.  It looks like this:

As you can see, there is a “today” button in the ApplicationBar.  (In the image, today must be July 7th.)  Anyways, I did some investigation, and came to a conclusion that either that image is being generated on the fly, or they’ve included 366 images in their project, to accommodate every possible month/date combination.

Since I’ve never done any dynamic image generation before, it seemed like more work that I was prepared to accomplish in the short timeline I had to finish this application.  So, I went ahead and created the 366 images that are necessary to make this functionality happen.

To change the IconUri property of an ApplicationBarIconButton, you just need this one line of code:

((ApplicationBarIconButton)ApplicationBar.Buttons[0]).IconUri = new Uri("/icons/dates/" + DateTime.Now.Month + "-" + DateTime.Now.Day + ".png", UriKind.Relative);

Finally, you’re probably interested in downloading this set of images, so you don’t have to spend the countless hours (it was less than 2) I spent creating them.  So, here they are:

1-11-21-31-41-51-61-71-81-91-101-111-121-131-141-151-161-171-181-191-201-211-221-231-241-251-261-271-281-291-301-312-12-22-32-42-52-62-72-82-92-102-112-122-132-142-152-162-172-182-192-202-212-222-232-242-252-262-272-282-293-13-23-33-43-53-63-73-83-93-103-113-123-133-143-153-163-173-183-193-203-213-223-233-243-253-263-273-283-293-303-314-14-24-34-44-54-64-74-84-94-104-114-124-134-144-154-164-174-184-194-204-214-224-234-244-254-264-274-284-294-305-15-25-35-45-55-65-75-85-95-105-115-125-135-145-155-165-175-185-195-205-215-225-235-245-255-265-275-285-295-305-316-16-26-36-46-56-66-76-86-96-106-116-126-136-146-156-166-176-186-196-206-216-226-236-246-256-266-276-286-296-307-17-27-37-47-57-67-77-87-97-107-117-127-137-147-157-167-177-187-197-207-217-227-237-247-257-267-277-287-297-307-318-18-28-38-48-58-68-78-88-98-108-118-128-138-148-158-168-178-188-198-208-218-228-238-248-258-268-278-288-298-308-319-19-29-39-49-59-69-79-89-99-109-119-129-139-149-159-169-179-189-199-209-219-229-239-249-259-269-279-289-299-3010-110-210-310-410-510-610-710-810-910-1010-1110-1210-1310-1410-1510-1610-1710-1810-1910-2010-2110-2210-2310-2410-2510-2610-2710-2810-2910-3010-3111-111-211-311-411-511-611-711-811-911-1011-1111-1211-1311-1411-1511-1611-1711-1811-1911-2011-2111-2211-2311-2411-2511-2611-2711-2811-2911-3012-112-212-312-412-512-612-712-812-912-1012-1112-1212-1312-1412-1512-1612-1712-1812-1912-2012-2112-2212-2312-2412-2512-2612-2712-2812-2912-3012-31

Or, if that’s not convenient, you can download the entire collection of Windows Phone Date Icons in a ZIP file here.

These images are completely free to use, I only ask that you comment here on how you used them.  Fair?

7 thoughts on “The Curious “Today” Button

  1. While it’s great that you did that, I wish MS had just made it so the ApplicationBar could accomodate XAML icons. I do my drawing in Illustrator since I’m very experienced with it, then import them into Blend. So at least for Blend owners it’s no problem. I could see making a control and just changing the date programmatically.

  2. Cool. But, if, like me, you translate your app in 4 or more languages, i’m not sure it’s the best solution…

  3. Pingback: The Curious "Today" Button in Windows Phone

  4. hi,
    i really liked your 31-days series but in my opinion this is a really bad approach. Currently i have an app supporting 5 different languages. So i have to add these icons in all different language formats. Sorry – no go. It’s really easy to draw to a .png and create the image dynamically (i am doing this for creating a live tile)

  5. I recognize that this is not an ideal approach for those of you supporting multiple languages, but it is a viable option for those applications that only support English.

    As I stated in my post, creating dynamic images is probably the best approach (and would support your multiple language scenarios), but for the crunched deadline I was under (for an English app), it was sufficient.

    I just figured I would share the results of my work, I was not endorsing this as a best practice.

    Geert van der Cruijsen has written an excellent tutorial on how to accomplish this…check it out.

    http://vdcruijsen.net/2011/12/creating-dynamic-windows-phone-7-live-tile-images-client-side/

  6. Pingback: 366 Date Icons For Your Windows Phone Development | WP MVP

  7. Pingback: 366 Date Icons For Your Windows Phone Development – Aximsite

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s