introduction

WPUtils provides out-of-box attached properties/behaviors to extent existing controls/components. It includes ChoosePhotoBehavior, SelectedItems attached property, PinToStartAction, NavigateWithQueryStringAction, HyperlinkAction, and so on.

get the toolkit

WPUtils is now available on NuGet Gallery. Simply add it to your project through the NuGet extension from within Visual Studio. If you are using Visual Studio Express, you can still download it from here CodePlex and add it to your project manually.

sample code

<ListBox
    Grid.Row="1" SelectionMode="Multiple"
    ItemTemplate="{StaticResource IngredientTemplate}"
    ItemContainerStyle="{StaticResource HighlightSelection}"
    ItemsSource="{Binding Ingredients}"
    wpu:ListBoxProperties.SelectedItems="{Binding SelectedIngredients}"/>

<Image>
    <i:Interaction.Behaviors>
        <wpu:ChoosePhotoBehavior PhotoUri="{Binding Item.ImageUri, Mode=TwoWay}"/>
    </i:Interaction.Behaviors>
</Image>

<Image Source="{Binding ImageUri, Converter={StaticResource UriToPhotoConverter}}"/>

<Button Content="pin" IsEnabled="{Binding TileAbsent}" Margin="0,12,0,0">
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Click">
            <WPUtils:PinToStartAction
                NavigationUri="{Binding NavigationUri}"
                BackgroundImage="{Binding BackgroundImage}"
                Title="{Binding TileTitle}"/>
        </i:EventTrigger>
    </i:Interaction.Triggers>
</Button>

<toolkit:MenuItem Header="edit">
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Click">
            <wpu:NavigateWithQueryStringAction
                     TargetPage="/Views/NewOrEditIngredientPage.xaml">
                <wpu:Parameter Field="id" Value="{Binding Id}"/>
            </wpu:NavigateWithQueryStringAction>
        </i:EventTrigger>
    </i:Interaction.Triggers>
</toolkit:MenuItem>
You can find a fully functional demo in the source code.

how to use

  1. A First Look at WPUtils
  2. Working with PinToStartAction
  3. 通过附加属性和行为扩展控件
If you find a bug, you can file it at Issue Tracker. If you have troubles while using this toolkit, you can raise your question at Discussions. Thanks!

latest changes

version description
1.3 [New features] HyperlinkAction has been added for showing web page via WebBrowserTask.

Last edited Oct 17, 2012 at 11:30 AM by allenlooplee, version 21