Visually Located

XAML and GIS

Migrating from the Windows Phone Toolkit ContextMenu to the new Runtime MenuFlyout

Create a MenuFlyoutService (ContextMenuService) to show a ContextMenu in Windows Phone 8.1 using the MenuFlyout [More]

Migrating from the Windows Phone Toolkit ListPicker to the new XAML ComboBox (Display a ListPicker in XAML apps)

Discover how to display a ListPicker in Widows Phone Runtime (XAML) apps. [More]

Migrating from the Windows Phone Toolkit TimePicker to the new Runtime TimePicker

Moving from Windows Phone Toolkit TimePicker and displaying a TimePicker in a Windows Phone Runtime app [More]

Migrating from the Windows Phone Toolkit DatePicker to the new Runtime DatePicker

Moving from Windows Phone Toolkit DatePicker and displaying DatePicker in a Windows Phone Runtime app [More]

Migrating from the Windows Phone Toolkit ToggleSwitch to the new XAML ToggleSwitch

Moving from Windows Phone Toolkit ToggleSwitch and displaying ToggleSwitch in a Windows Phone Runtime app [More]

Migrating from the Windows Phone Toolkit to the new Runtime XAML controls

With the introduction of the new Windows Phone XAML Apps, Microsoft released new controls that previously only existed in the Windows Phone Toolkit. For any years these controls existed in open source format, but did not allow for contributions. These controls would get some bug fixes, or new functionality/controls every now and then. Ownership of the toolkit changed hands many times and the toolkit was mostly forgotten. There was often complaints from the community that Microsoft would put “must have controls” in a toolkit. I personally liked that these controls were in a toolkit in which I could see the source. It allowed me to learn from  the people that know the core code the best. Sidebar: Take advantage of open source software. Contribute or not, it is a great learning tool. A nice thing about it being open was that you could fix bugs that you found. While the source was open, contributions were closed, so you could not submit bug fixes are add features to the tool... [More]

Add a persistent element to every page of your phone apps

Adding ad controls to apps is a pretty common thing. Some apps have ads on every page of the app. Some apps only have ads on some pages. When you want to have ads on one page you have to manually add the control to each page. Wouldn’t it be cool to only add it once and it shows up on all of your pages? This is exactly what someone recently asked on Stack Overflow. This is possible to do and quite simple. First, add a new style to your App.xaml resources and name it AdPhoneApplicationFrameStyle. <Style x:Key="AdPhoneApplicationFrameStyle" TargetType="toolkit:TransitionFrame"> <Setter Property="IsTabStop" Value="False"/> <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/> <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeNormal}"/> <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilyNormal}"/> <Setter Property="HorizontalAlignm... [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]

Performing an async operation in the OnBackKeyPress method and still exit your Windows Phone apps

The OnBackKeyPress method allows you to perform special logic when the user presses the phone back button. You usually override this method when you do not want the user to actually go back a page. An example of this is if you show a popup, when the user presses the back button you should close the popup. protected override void OnBackKeyPress(CancelEventArgs e) { base.OnBackKeyPress(e);   if (PopupIsOpen()) { e.Cancel = true; ClosePopup(); } } This workflow works great because everything is synchronous. You may have seen some apps that prompt you with a MessageBox asking if you want to exit. If you say yes the app exits and if you say no, you do not exit the app. protected override void OnBackKeyPress(CancelEventArgs e) { base.OnBackKeyPress(e); var result = MessageBox.Show( "Are... [More]

Making the Windows Phone Toolkit CustomMessageBox async

The Windows Phone Toolkit has a nice CustomMessageBox control that allows you to customize the button text of a MessageBox. This message box is nice but you must subscribe to an event for when it is closed. Microsoft.Phone.Controls.CustomMessageBox msgBox = new CustomMessageBox(); msgBox.RightButtonContent = "cancel"; msgBox.LeftButtonContent = "delete"; msgBox.Caption = "Are you sure you want to delete?"; msgBox.Title = "Delete message?"; msgBox.Dismissed += (o, eventArgs) => { // Do some logic in here. }; msgBox.Show(); This requires that your logic for user input to be either in a separate method or above the Show method like in my example. If the CustomMessageBox had a way to show it asynchronously, you could have your logic in one place. Luckily this is very easy with an extension method. public static class Toolk... [More]