How to detect WP App, is running on Emulator or real Phone Device

In this post I am going to show you how to detect, whether your application is running on real (Windows Phone) device or WP Emulator. While working on, one of service wanted to know whether service is invoking from the real device or not.

It was really quick and easy to know, whether app is running on real device or emulator. Microsoft Widows Phone SDK has a strong collection of API in Microsoft.Phone namespace.

Here is code snippet for the same:

image

Download Code here

Happy Coding Thumbs up

Advertisements
Posted in Windows Phone, Windows Phone 7 | Leave a comment

Windows Phone 8.0 is Upgradeable to WP 8.1

This is amazing news announced by Greg Sullivan (Windows Phone director – Public Relations at Microsoft) Windows Phone 8.0 is upgradeable.

wp_update

Windows Phone 8 users can upgrade their OS (Windows Phone 8.0 to Windows Phone 8.1).

Greg Sullivan word with Computerworld

Many people who bought Windows Phone 7 and 7.5 devices are still upset at Microsoft when it was announced those smartphones would not get an update to Windows 8. However, Computerworld reports that in a chat with Windows Phone director of public relations Greg Sullivan, “We will not have the same experience as we had when Windows Phone 7 was upgraded to Windows Phone 8.”

  Sullivan added that Windows Phone 8 was a “powerful OS” that can handle major upgrades, saying, “We won’t run out of head space on Windows Phone 8 any time soon.”

– Nokia indicated that its Lumia 1020 and Lumia 520 smartphones would indeed be upgradeable.

– Windows Phone 7 device user could not upgrade their devices to Windows Phone 8.x

Source of news here

Posted in News, Windows Phone 8 | Leave a comment

How to create simple list in Windows Phone

simple_list_thumb6

In this post I am going to show you how to build simple list in windows phone with proper scrolling.

Let’s take an example, to display list of cities, it will shown the minimal lines of code to implement it.

In this example to display the data, here we want to show only one attribute/property (city) in the listbox control, so here we are going to customized the ItemTemplate to display data.

Let’s talk about the technical stuff, how you are proceeding and understanding the concept of listItem customization.

Here is core components are described, to customized the listbox.

ItemTemplateItemTemplate to specify the visualization of the data objects. Its contains only one DataTemplate

DataTemplate: The DataTemplate specifies, that each data item appearing in it.

Here is a basic list design to understand the customization of listbox control.

XAML Code snippet:

xaml_code_thumb4

CS Code Here:

cs_code_thumb5

State Class

cs_code_01_thumb4

Here is a complete Code Download here

Happy Coding Thumbs up

Posted in Windows Mobile | Leave a comment

How to make TextBox Scrollable and Navigate to end of TextBox scrolling in Windows Phone

output_DNvWnz

In this example, I am going to show you, how easy we can build the such kind of functionality in windows phone application, here I have considered an example called “diagnostic tool functionality” in your Windows Phone application using two main controls like Textbox and ScrollViewer.

Here is the basic steps to achieve diagnostic tool functionality in your application.

Step:1 Add ScrollViewer to Windows Phone Page, here I have added it, inside the Grid layout content panel.

Step:2 Add Textbox inside the ScrollViewer see the below code snippet for the same.

image

Step:3 Now we are going to move into .CS file; and declare the DispatcherTimer object to run the diagnostic concept eventually. Now initialize the DispatcherTimer’s object (i.e oTimer) and add a Tick event and set the time interval. you can refer the below code snippet for the same.

image

Step:4 In the Tick Event of DispatcherTimer, we are writing core logic of it, how to make text box scrollable.

image

Step:5 Finally we are going to run the timer, using the timer’s API called  Start() method like oTimer.Start(); in this application I have use application bar button to run the timer on application bar button click.

image

Download: here is the example source code

Happy Coding – Smile

Posted in Windows Phone, Windows Phone 7, Windows Phone 8, Windows Phone APIs | 3 Comments

Build a Scrollable Form in Windows Phone

This is the real time solution for Windows Phone Application Development, and increase the User Accessibility in your application. So user will not getting irritate while using your application.

In this post I am going to show you how to build Scrollable Form which contains number of input controls such as textbox etc. and user continue filling the from using phone native keyboard need to open once only and fill the form without bothering keyboard open and close so many time to, move the next input control without using closing the native keyboard.

Problem was, if the application having data entry forms and that contain number of input controls such as textboxes, and that time use have to fill form when user writing something in text box that time user has to use native keyboard and user have to move next control and he has to explicitly close and open the keyboard to move the next input control.

Development concept:

Untitled

Code Snippet for development the structure:

code_

Solution and output:

output_cv5LIK

 

Download source code here

Happy Coding Smile

Posted in Windows Phone, Windows Phone 7, Windows Phone 8 | 3 Comments

How to detect the Windows Phone theme is Dark or Light

private const string key = “PhoneDarkThemeVisibility”

private bool IsBackgroundDark()
{
    return ((Visibility)Application.Current.Resources[key] == Visibility.Visible);
}

Posted in Windows Phone, Windows Phone 7, Windows Phone 8, Windows Phone APIs | Leave a comment

How to Add Tapped Event to the Textbox in Windows 8 Application.

Over the forum discussion, some one asked an question “Tapped Event” is not occurring/firing in his application, so I have decided to write a quick code snippet for the same solution.
I did quick work around and added AddHandler() method. And it adds a routed event handler for a specified routed event.
See the following code snippet:
txtMyTextBox.AddHandler(TappedEvent, newTappedEventHandler(txtMyTextBox_Tapped), true);
void txtMyTextBox_Tapped(object sender, TappedRoutedEventArgs e)
        {
            MessageDialog msgDialog = newMessageDialog(“Tapped Event occour”, “Windows 8 App”);
            //OK Button
            UICommand okBtn = newUICommand(“OK”);
            okBtn.Invoked = OkBtnClick;
            msgDialog.Commands.Add(okBtn);
            //Cancel Button
            UICommand cancelBtn = newUICommand(“Cancel”);
            cancelBtn.Invoked = CancelBtnClick;
            msgDialog.Commands.Add(cancelBtn);
            //Show message
            msgDialog.ShowAsync();
        }
Here is a completed source code.
Hope it will help, Happy Coding.
Posted in Windows 8 | 1 Comment