Visually Located

XAML and GIS

Creating simple page transitions using Storyboards: Turnstile transition

In my last post, I talked about creating a simple transition to slide a page in or out. While that transition was functionality I needed for my app, Santa Calls, I thought it would be fun to do more of these posts. For this post we’ll create a turnstile transition. The turnstile transition is like a page turning. For the turnstile transition, we need to use the animate the Projection of the page. We’ll set the Projection to be a PlaneProjection. To get the rotation to turn like a page would, we need to rotate around the vertical, or y-axis. The RotationY property of the PlaneProjection is how we accomplish this. public static async Task TransitionInTurnstile(this FrameworkElement source) { await source.Turnstile(75, 0); }   public static async Task TransitionOutTurnstile(this FrameworkElement source) { await source.Turnstile(0, -90); }   private static async Task ... [More]

Creating simple page transitions using Storyboards: Slide transition

I recently updated my app Santa Calls to include a settings page that would allow the user to delay a call or pin lock the application. When navigating to this page I wanted a nice transition, but I wanted the tree in the background to remain.  To accomplish this I set the background of these pages to be the tree image and moved the content in/out when needed. I would not be able to accomplish this type of transition using an SDK like the Windows Phone Toolkit or Telerik unless I set the application background to be the tree. I did not want to do this because the phone call pages do not have this same background. The transitions are pretty simple and can be used by any page to move content up/down. I created a handy extension method that can be used by any FrameworkElement. To slide the content up into view, we need to create a Storyboard with a DoubleAnimation that will move the content (assumed to be a page) from the bottom of the page to the top. public static... [More]

Update: Creating a custom MessageBox for your Windows Phone apps.

I was looking at my site traffic and noticed that one of my most popular posts was about creating a custom MessageBox. This post was written two years ago and continues to get a lot of traffic. Since writing that post, I’ve updated my MessageBox a lot. I’ve changed it to use async/await, modified the style, corrected some bugs, and added functionality. Since I’ve made a lot of changes, and that post continues to get a lot of readers, I thought it would be good to give the latest version. I continue to use a UserControl approach for this because I don’t want any overriding of styles. It has a set look, and should not be allowed to be changed (aside from the use of static resources). The xaml only need a small change to the bottom margin. Instead of 12 all around, it needed 18 on the bottom. I also changed the name of the first Grid from MessagePanel to LayoutRoot, this wasn’t needed, but made some code behind easier to understand what element was being modified. <Grid x:Cla... [More]

Use the [beta] Nokia Imaging SDK to crop and resize any image to create a lockscreen for your phone

When the new Nokia Imaging SDK was released I was really excited to start using it within one of my apps. Unlike most, I was not interested in the image filters that change how it looks. I was initially interested in using the resize and crop functionality it had. The day after it was released my wife had surgery, so I had a good amount of time to play with the SDK while I sat in the waiting room. What I wanted to accomplish that was to take a random photo from the users phone, crop and resize it to fit the device and set it as the lockscreen. I know that you can set any image to be the lockscreen and  if the image is too big, it will center the image. I needed to do it manually because I wanted to overlay information on the image. Getting the random image is pretty easy. We’ll just get one from the MediaLibrary. private Picture GetRandomImage() { var rand = new Random(DateTime.Now.Millisecond);   MediaLibrary library = ne... [More]

Keeping ads in the same location when the phone orientation changes to landscape

There has been a lot of information flying around about ads in apps these days. Microsoft recently updated PubCenter reporting to include fill rates and number of requests for ads. Dvlup recently partnered with AdDuplex to in its reward program. With all of this hype, I thought I would talk about a common problem with placing ads in apps. That issue is keeping ads in the same location when rotating the phone. Most apps are Portrait apps and display ads either at the top or bottom of the app. Displaying ads like this can be done with the following xaml <Grid x:Name="LayoutRoot" Background="Transparent"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <StackPanel Grid.Row="0" Margin="12,17,0,28"> <TextBlock Text="STATIONARY AD" Style="{Stat... [More]

Creating a Behavior to change text to any case

In a previous post we created a behavior that would capitalize any text. This Behavior served a great purpose allowing you to capitalize the text for any TextBlock. What happens when you need to lower case the text? You could create a second Behavior for this, or we could modify the Behavior so that it allows for multiple options. The first option just seems silly when we can reuse code, but how can we specify which text case we want to apply? In the previous post I talked about some reasons why I like behaviors. One reason I did not list is that you can add Dependency Properties to them. Dependency Properties allow us to set properties in xaml or even better bind to other properties. You can add Dependency Properties to value converters, but that requires your value converter to inherit from DependencyObject. A Behavior already is a DependencyObject! We’ll start with the ToUpperBehavior from before. We’ll first change the name to ChangeCaseBehavior and we’ll create an enum that will... [More]

Responding to the Windows Phone Toolkit ListPicker closing

I’ve often wondered why the ListPicker in the Windows Phone Toolkit does not have an Opened or Closed event, especially since the SelectionChanged event fires only when the selection changes (as it should). So how are you suppose to know when the ListPicker opens or closes. After all, the ComboBox control has DropDownOpened and DropDownClosed. But then I thought, “Do you really need those? You can always use the IsDropDownOpened property.” The ListPicker does not have an Opened or Closed event and it does not have an IsDropDownOpened property. What the ListPicker does have, is the ListPickerMode property. // // Summary: // Gets or sets the ListPickerMode (ex: Normal/Expanded/Full). public ListPickerMode ListPickerMode { get; } This property is actually a DependencyProperty that we can bind to! Let’s say you need to change the visibility of another control when the ListPicker opens/closes. Or maybe you need to change some text based on the... [More]

Creating a behavior to capitalize text

Many apps get data that they show from services. These services generally have their data cased a certain way. If you want to navigate to a page to show data, you may want to have the title of the page be information from the service. The title portion of the page tells the user that this is the profile for Shawn Kendrot. The text for “Shawn Kendrot” came from the service and is cased in Title Case. But if you wanted to follow design guidelines (which are not a requirement), you may want the name to be all upper case. To accomplish this you have three options, convert the text when you download it, create a value converter, or create a behavior. The first is really not an option, because that means that you can no longer use that text for anything else. Value converters are nice, easy to use, and sometimes overused. Behaviors are nice because they can easily be used within the designer of Blend. If you are not familiar with Blend, you should find time to use it. It is the tool to ... [More]

Increasing in app purchases in your Windows Phone apps

There are a few ways to increase the rate of in app purchases. One of these ways is to show a message prompt to the user explaining that an in app purchase is available and what the user can get from it. In a previous post I explained how to use Telerik’s RateApplicationReminder to increase reviews of your app. The RateApplicationReminder is great because it just works. No, really. No need for you to determine if you should show a reminder to rate the app. It handles all of the logic and it navigates the user to rate your app. Another benefit of the RateApplicationReminder is that it is built on a framework for showing reminders. This framework can be extended to create your own reminders. The is a decent framework to build reminders on. It has one abstract method, GetDataFilePath. This is just a file name for the data that will be saved. It has two virtual methods that can be overridden, but the power is in the properties that it has // Summary: // Setting this property... [More]

Increasing app reviews with Telerik’s RateApplicationReminder

I have seen a few blog posts that explain how to prompt a user to rate your app after a few visits. These posts describe how to store a setting for how many times the app has been opened and whether the prompt has been shown. Some use a custom message box and some use the built in MessageBox. There have even been NuGet packages for this. I have to wonder, Why are you not using Telerik’s RateApplicationReminder? After all, if you do not have Telerik’s controls, you might be doing something wrong. Telerik’s RateApplicationReminder is a great tool to have. It allows users to ignore further reminders. It allows you to specify if the reminder should not be shown any more if the user taps the yes button. The text it displays is fully customizable, including the buttons. It also allows you to show the reminder based on number of times the app has opened or days from the last reminder. Oh, and it helps increase app reviews. The RateApplicationReminder is used in conjunction with the Applica... [More]