Metro Nuggets

Bitesized tidbits for building Modern (Metro) apps.

Category Archives: Tip

Using Unplated “Tile” Images In UWP Apps

I realise the first question you have: “Unplated?” Well, give me a chance. In your app’s package manifest, you have a section for Square44x44Logo, this logo is used in the task bar and in the application list in the start menu. What you will notice is that, by default, your image will have a border around it, like so:
image

Notice the grey all around the icon (note: that grey is defined in the package manifest too, so doesn’t have to be that colour)? Now, for your app’s branding, maybe you don’t want that border as that goes against how your actual tile looks, and consistency is key, right!

Read more of this post

Advertisements

Use Triggers To Change Grid Column/Row Values in Universal Windows Apps

When creating your awesome layout to your awesome new app, you’ll often use Grids as a way of ensuring things are placed where you want them to be and you’d most likely use the ColumnDefinitions and RowDefinitions. Using these has a number of benefits, not least letting you specify exact heights/widths for your columns/rows, but you can also use Auto and the * values to set screen percentages. What this means is you can have a very exact UI or one that adapts as the size of the window changes.

Adapting to the size of the window is something that’s more relevant to UWPs than ever before with you bringing one UI to all possible screens the user can use your app on. But what if you still want to keep some rows at a certain screen percentage until the user hits a trigger point? Well, a small, but subtle change to xaml now allows you to do more with your Column/RowDefinitions.

Read more of this post

Sharing Links To Pocket (formerly Read It Later)

Pocket is a brilliant service that allows you to essentially bookmark links and (as the old name suggests), read it later. Pocket has no official app on the Windows Phone platform, but there are more apps coming from other sources (including my own Squirrel).

One of the things each of the apps has in common (other than being a Pocket client), is the ability to add links to Pocket from other apps. This is done using a custom URI scheme and works as expected. The only problem is, if you’re writing an app that you’d like to add Pocket support to, what do you do? Do you pledge your allegiance to one app? What if your users are using a different Pocket app? What then?

This was a problem I decided to address whilst writing my own Pocket app.

Read more of this post

Resizing the RadImageButton

Telerik have a great range of controls that allow you to build some really cool looking interfaces for Windows Phone. One of those controls is the RadImageButton, which lets you set an image and it creates an appbar style button for you. However, I wanted the button to be a different size to the default one, how to go about doing that?

Read more of this post

The Mystery of the Disappearing Images in the Emulator

While I was working on In Two (a great game by the way, you should check it out), I was working on one feature that allowed the user to set their profile picture, which involved letting them either choose a photo from one of their many, many albums, or taking a new picture. Most of the development of that game was done using the emulator, which was no problem, I thought, as I knew the emulator came with stock images for you to use. But every time I went to choose an image from my app, all I had was the empty camera roll folder, no stock images.

Read more of this post

Launching a Context Menu From Code

One of the great things the Windows Phone Toolkit brings developers is the ContextMenu and ContextMenuService that allows developers to offer their users a tap and hold menu, the same kind that appears in the OS itself.

Generally, you would create the context menu in xaml and attach it to an item within your page (or DataTemplate), but what if you want the user to be able to tap a button and have it appear? If you create the ContextMenu as normal in xaml then try and launch it from code, you’ll end up with an exception being through that the Element is already a child of another element. But if you create it in code, then it might not appear where you want it to appear, so what then?

Read more of this post

Tip: Nokia Ad Exchange (NAX) and Annoying Unhandled Exceptions

One of the ways in which developers try to increase their revenue is to include ads within their app and there are a number of different providers, from Google to Microsoft to Nokia. All seem to have one thing in common: Unhandled Exceptions. For some reason, ad controls seem to be some of the biggest culprits for unhandled exceptions in apps, and better still, there’s nothing you can do to actually handle them. Nothing. Not. A. Damn. Thing! So how do you stop your app from sinking without a trace in a barrage of error reports? Nothing elegant, I can tell you that, but it works.

Read more of this post

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

Using the CustomMessageBox in OnBackKeyPressed

Sometimes in your app you may need to prompt the user for something when they’ve tapped the back button on the phone. If you wanted to offer the user a little more than just Ok/Cancel buttons, then you might have thought about using the CustomMessageBox from the Windows Phone toolkit, I know I did. But I was running into a nightmare problem where the user would press back, the prompt would  should and then almost instantly close. Every blog post I could find had the code in the same way, so how to fix?

 

Read more of this post

Cimbalino Toolkit: Services

The Cimbalino toolkit is fast becoming a big favourite of mine and is starting to be used in more and more apps that I’m building. In it, you’ll find a huge amount of useful tools for building Windows Phone apps, from converters, to behaviours, to controls, to services. It’s a monster! I’m going to try and do a number of posts detailing certain parts of the toolkit and thought I’d start with Services.

Read more of this post