Daily Archives: June 30, 2009

Pin Outlook Templates to the Taskbar for Quick Access [Outlook Tip]

Reader Stephen writes in with an excellent, time-saving Windows 7 tip: you can create Outlook templates for boilerplate emails and pin them to the Windows taskbar for easy access.

This technique is not limited to readers using Windows 7, since you can pin a folder to the taskbar in any version of Windows—but the new Jump lists in Windows 7 make it a lot simpler. To create your own set of Outlook templates, Stephen advises:

  1. Create an Outlook template by composing a new email message with the text you want, and then using File -> Save As to save the message as an Outlook Template into a folder of your choice.
  2. If you are using Windows 7, simply drag the template files onto the Outlook icon.
  3. For previous versions of Windows, right-click the taskbar, choose Toolbars -> New Toolbar, and pick the folder that you saved the templates into.
  4. Now you can quickly access your templates from the Jumplist by right-clicking on the Outlook icon. For previous versions of Windows, you can use the pop-up folder menu.

It’s a great tip for anybody that repeatedly sends emails on the exact same topic. Thanks, Stephen!

For more ways to be productive while dealing with email overload, learn how to save time and typing with Outlook 2007′s Quick Parts, tweak Outlook to empty your inbox faster, knock down repetitive email with AutoHotkey, or just take a look through our top ten Outlook boosters.





Handling Events within Silverlight Control Templates – AutoCompleteBox Example

One of the great features Silverlight offers is the ability to customize controls by using control templates.  If you don’t like how a particular control looks you can modify the template and in many cases be ready to use the new control without writing a single line of C# or VB code.  I’m working on a client application that uses the AutoCompleteBox found in the Silverlight Toolkit and needed a way to change it from a regular TextBox to more of an editable ComboBox.  Fortunately the Silverlight Toolkit samples (for Silverlight 2 and 3) already do something like this as you can see here (once on the page click on AutoCompleteBox to the left and then on the Styling tab at the top of the page to see the sample).

image

The sample modifies the standard AutoCompleteBox to look more like an editable ComboBox by defining a custom control template with a ToggleButton in it (Tim Heuer provides a nice walk through of this type of customization here if you’re interested).  Here’s a simplified version of the Silverlight Toolkit’s sample template that I’m using:

<ControlTemplate TargetType="input:AutoCompleteBox">
    <Grid Margin="{TemplateBinding Padding}">
        <TextBox IsTabStop="True" x:Name="Text" Style="{TemplateBinding TextBoxStyle}" Margin="0" />
        <ToggleButton x:Name="ToggleButton"
            HorizontalAlignment="Right"
            VerticalAlignment="Center"
            Style="{StaticResource ComboToggleButton}"
            Margin="0"
            HorizontalContentAlignment="Center"
            Background="{TemplateBinding Background}"
            BorderThickness="0"
            Height="16" Width="16"
            Click="DropDownToggle_Click">
            <ToggleButton.Content>
                <Path x:Name="BtnArrow" Height="4" Width="8" Stretch="Uniform" Data="F1 M 301.14,-189.041L 311.57,-189.041L 306.355,-182.942L 301.14,-189.041 Z "
                      Margin="0,0,6,0" HorizontalAlignment="Right">
                    <Path.Fill>
                        <SolidColorBrush x:Name="BtnArrowColor" Color="#FF333333"/>
                    </Path.Fill>
                </Path>
            </ToggleButton.Content>
        </ToggleButton>
        <Popup x:Name="Popup">
            <Border x:Name="PopupBorder" HorizontalAlignment="Stretch" Opacity="1.0" BorderThickness="0">
                <Border.RenderTransform>
                    <TranslateTransform X="2" Y="2" />
                </Border.RenderTransform>
                <Border.Background>
                    <SolidColorBrush Color="#11000000" />
                </Border.Background>
                        <ListBox x:Name="Selector" ScrollViewer.HorizontalScrollBarVisibility="Auto"
                             ScrollViewer.VerticalScrollBarVisibility="Auto"
                             ItemTemplate="{TemplateBinding ItemTemplate}" />
             </Border>
        </Popup>
    </Grid>
</ControlTemplate>


Looking at the template you’ll see that it defines a ToggleButton with a Click event and associated event handler named DropDownToggle_Click.  Here’s what the ToggleButton’s Click event handler looks like:

private void DropDownToggle_Click(object sender, RoutedEventArgs e)
{
    FrameworkElement fe = sender as FrameworkElement;
    AutoCompleteBox acb = null;
    while (fe != null && acb == null)
    {
        fe = VisualTreeHelper.GetParent(fe) as FrameworkElement;
        acb = fe as AutoCompleteBox;
    }
    if (acb != null)
    {
        if (String.IsNullOrEmpty(acb.SearchText))
        {
            acb.Text = String.Empty;
        }
        acb.IsDropDownOpen = !acb.IsDropDownOpen;
    }
}


You can see that the code uses the VisualTreeHelper class to access the parent of the ToggleButton which is the AutoCompleteBox.  Once the AutoCompleteBox parent is found the code handles showing or hiding the Popup control that’s part of the control template by setting the IsDropDownOpen property to true or false.

This works fine if the control template is placed in the same scope as the event handler code such as the page or user control resources section.  However, if you try to move the template code to another resources section that doesn’t have access to the event handler code (DropDownToggle_Click) you’ll run into problems .  What if you want to put the control template in a merged resource dictionary (similar to an external CSS stylesheet to give a web analogy) and can’t hard-code the click event into the control template since you don’t know where the event handler will be defined at that point?  Although you can certainly write a custom control that derives from AutoCompleteBox in this case (which would be recommended if you’ll re-use the control across multiple pages or user controls), another solution is to hook-up the ToggleButton’s Click event when the AutoCompleteBox control first loads as shown next:

 

void SilverlightApplication_Loaded(object sender, RoutedEventArgs e)
{
    HookAutoCompleteBoxEvents();
}

void HookAutoCompleteBoxEvents()
{
    AutoCompleteBox[] boxes = { this.JobIDAutoCompleteBox, this.EmployeeAutoCompleteBox };
    foreach (var box in boxes)
    {
        Grid grid = VisualTreeHelper.GetChild(box, 0) as Grid;
        ToggleButton tb = grid.Children[1] as ToggleButton;
        if (tb != null) tb.Click += DropDownToggle_Click;
    }
}


When the Silverlight application Loaded event is called it calls the HookAutoCompleteBoxEvents() method.  Within HookAutoCompleteBoxEvents() an array of AutoCompleteBox controls is iterated through to locate the ToggleButton for each control and attach a Click event handler to it.  Doing this avoids hard-coding the event handler in the control template so that it can be defined just about anywhere you’d like without running into code scoping issues. 

Note: Keep in mind that if you plan on using the customized AutoCompleteBox control in several places it may be worth the time to create a custom control that derives from AutoCompleteBox to avoid having to put the ToggleButton event handler code and the HookAutoCompleteBoxEvents code into each page or user control. 

 

Logo

For more information about onsite, online and video training, mentoring and consulting solutions for .NET, SharePoint or Silverlight please visit www.thewahlingroup.com/.

7stacks Does OS X Stacks in Windows 7 Style [Downloads]

Windows only: Application launcher 7stacks adds the Stacks functionality of Mac’s OS X to Windows 7, including Aero transparency effects that blend into your taskbar perfectly.

To create your own stacks, launch the application, pick a folder and the type of launcher you want, create a shortcut on the desktop, and then right-click the shortcut and pin it to the taskbar. You can pin up to 10 shortcuts onto the taskbar this way, and you can choose between Menu, Grid, or Stacks (pictured). You don’t have all of the functionality that the latest version of StandaloneStack gives you, but it blends into the desktop really well with the Aero transparency effects, making it well worth a look for anybody using Windows 7.

7stacks is a free download for Windows 7 only. For more, check out how StandaloneStack is an awesome file-browsing widget, or our other favorite methods of consolidating taskbar launchers with Jumplist and switching folders with Folder Menu.

Update: Numerous readers point out that you’ve always been able to dock folders to the Windows taskbar by right-clicking on the taskbar and choosing New Toolbar from the Toolbars menu. This application simply does it with eye-candy effects instead of a plain menu.

7stacks [Alastria Software via Into Windows]





Firefox 3.5 Officially Available for Download [Downloads]

Windows/Mac/Linux: The final version of the Firefox is starting to show up on Mozilla’s web site, and some readers are reporting update notices. Here are a few links and how-tos you should check out before downloading that browser.

  • Add-on Compatibility Center – See whether the popular extensions that make up 95% of add-on downloads are compatible with Firefox 3.5 before you download. It’s looking pretty green and good at the moment, with the notable exception of Tab Mix Plus.
  • Top 10 Firefox 3.5 Features – Breaking down the Private Browsing Mode, TraceMonkey JavaScript engine, little interface features, and bigger changes to the increasingly popular open-source web browser.
  • Disable location-aware browsing and tab tearing – If those features sound more like privacy invasion and mouse-clenching hassle, respectively, they’re pretty easy to turn off.
  • Make your extensions work with (Firefox 3.5) – Originally written for the big (bigger?) Firefox 3.0 upgrade, but this little about:config tweak should keep those extensions not yet upgraded working with 3.5 as well, assuming you don’t mind potential bugs.
  • Weave synchronization tool – Mozilla's experimental synchronization project only works with Firefox 3.5—but, wait, that's out now! It's worth checking out, especially if you're running Firefox across multiple systems.
  • Firefox 3.5 Overview – It’s both a video run-through of Firefox 3.5′s features, and a test of the new no-Flash-needed video powers of Firefox 3.5 (non-HTML5-compliant browsers will just get an .ogv video download link).

Tell us about your Firefox 3.5 upgrade experience, or why you’re holding off, in the comments.





TubeMaster++ Update Makes Grabbing Videos and Music Easier [Downloads]

Windows only: Last year we shared TubeMaster Plus with you, an extremely handy program for downloading videos and music from streaming sites. TubeMaster++ has been released and comes with a slew of new features.

TubeMaster++ makes grabbing streaming videos and music incredibly simple. As long as TubeMaster++ is running, it will grab nearly every kind of media you watch over your internet connection thanks to its ability to scan the incoming data and not rely on the browser itself. Whether you’re watching a video in Internet Explorer, Firefox, or Opera, as soon as you start watching it, TubeMaster++ will begin capturing it.

You can save files, play them back right in TubeMaster++ and convert them. What formats can you convert into? A better question would be what formats can’t you convert into. You can convert audio formats into WAV, MP3, OGG, and AC3, among others. Video can be converted into dozens of formats and presets for mobile devices including the Creative Zen, iPod, Blackberry, PSP and PS3, various mobile phone sizes, and more universal formats like AVI and MPEG4.

TubeMaster++ does lose one feature from its predecessor: because of dependencies it has on installed software it is no longer portable. The trade off will be more than worth it for most people however as the new version is more stable, offers more features, has a built-in video and music search engine, and has dropped the upgrade requirement to download from adult video-sharing sites. TubeMaster++ is freeware, Windows only, and requires Java Runtime Environment and WinPcap (both of which are included in the installation if you don’t have them.)





Create an Oasis with Greywater

Greywater is the term for all household wastewater except for the toilet and kitchen sink. This is the only comprehensive book I know of on the subject, and in this fifth and expanded edition, Art Ludwig explains how to choose, build, and use a variety of simple greywater systems. There are clear drawings for sending washing machine water into the garden (with or without a drum), for putting diversion valves on bathtubs or showers, for creating “mulch basins,” for ultra-simple setups like “Garden Hose Through the Bathroom,” and “Dishpan Dump (Bucketing)” — the latter of which I've been practicing lately to the great benefit of both septic system and compost piles.

oasis-greywater2.jpg

There’s a large section on branched drains — splitting the flow and dispersing greywater to a number of mulch basins in the garden — using gravity flow, no pumps or electricity. Mistakes made in greywater systems over the years are documented here, along with suggested improvements, and there's a two-page System Selection Chart with a comparison of 18 different systems.

— Lloyd Kahn

[Complete plans for one of the book’s most broadly appealing projects -- a Laundry to Landscape Grey Water System -- are available, free, on the Oasis Design site. -- ES]

The New Create an Oasis with Greywater
Art Ludwig
2009, 144 pages
$21

Published by and available from Oasis Design

Or $15 from Amazon

Sample Excerpts:

oasis-greywater3sm.jpg
Simple Laundry Drum with Rainwater Harvesting

*

oasis-greywater4sm.jpg
Figure 7.6: Laundry Drumless Laundry

*
oasis-greywater5s.jpg

Related Entries:
The Tiny Book of Tiny Houses

Ratcheting Tube and Pipe Cutter

Pelican 0450

WP Like Button Plugin by Free WordPress Templates