Metro Nuggets

Bitesized tidbits for building Modern (Metro) apps.

Category Archives: Controls

Coding4Fun Toolkit: Introducing LockScreenPreview

Previously I spoke about the SuperImage control that came into 2.0.6 of the Coding4Fun Toolkit today, well now I want to introduce you to another new control, LockScreenPreview. LockScreenPreview is a control for Windows Phone 8 and Windows Store (not Windows Phone 7), that does exactly what the control name suggests it does, it offers you a preview of what a user’s lock screen will look like.

Read more of this post

Coding4Fun Toolkit: Introducing SuperImage

The Coding4Fun toolkit for Windows Phone and Windows Store was updated recently to 2.0.6, and one of the new things to find its way into the toolkit is a new control called SuperImage. SuperImage is a control for Windows Phone and Windows Store that is basically a multipurpose Image control that you could use instead of a normal Image.

Read more of this post

ListBox to LongListSelector in Windows Phone 8

If you’re moving a project from Windows Phone 7 to Windows Phone 8 and you use ListBoxes in your app, you can keep them in there with no real problems. However, it’s not recommended to keep using them, instead use the LongListSelector instead. If you’re familiar with the LongListSelector from the Windows Phone Toolkit, then you’ll find the new native LongListSelector a very different beast and you probably wouldn’t think to use it because you know what it was previously only really used for. Previously you would only really use the LongListSelector if you were after a people hub or application list style grouping, but the new native version has been tweaked and improved upon and had massive performance enhancements. You can also just use it as a straight, flat ListBox, complete with all the performance enhancements it brings.

Making the change from ListBox to LongListSelector is actually very simple, just change your xaml to use the LongListSelector instead of the ListBox. It’s as simple as that. When you then run your app, it will already be a flat ListBox as you were before, but with those mentioned performance enhancements.

Before:

            <ListBox x:Name="LLS">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding}"
                                   Style="{StaticResource PhoneTextLargeStyle}" />
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>

After:

            <phone:LongListSelector x:Name="LLS">
                <phone:LongListSelector.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding}"
                                   Style="{StaticResource PhoneTextLargeStyle}" />
                    </DataTemplate>
                </phone:LongListSelector.ItemTemplate>
            </phone:LongListSelector>

It’s as simple as that.

Stay tuned for more on the new LongListSelector.

SL

PhoneFlipMenu Control for Windows Phone [UPDATED]

UPDATE: This control is now part of the coding4fun toolkit for Windows Phone. It’s usage is the same, but it’s been renamed to the AppBarPrompt. Any future updates will done to that, and not this version. Sample usage of the new prompt can be seen here.

The Windows Phone Mail app has, when you’re in an email, a respond button which when tapped, brings up three further options, as illustrated below:
Screen Capture (3) Screen Capture (2)

On the left we have the icons on the application bar, tap the respond button (on the left) and you get the options as shown in the picture on the right.

There is, however, no way of doing that in your own apps, so I created this control that does it.

Read more of this post

PhoneListBox Control for Windows Phone

There are a few things I’ve been doing to work around a couple of scenarios when it comes to using the ListBox in Windows Phone. The first is when your ListBox has no items I want it to show something to the user stating there are no items, the other involved limiting the number of items that are enabled based on whether the app was in its Trial Mode.

The first scenario had seen me using a TextBlock and a ListBox and hiding one or the other depending on how many items were in the ListBox, it wasn’t really ideal. The other scenario, well, I didn’t have any workaround for that, but I already had what I’m about to show you done for the first scenario, so modified it for the second scenario. Read on to find out more.

Read more of this post