Saturday, January 4, 2014

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);
}

Monday, October 14, 2013

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, new TappedEventHandler(txtMyTextBox_Tapped), true);

void txtMyTextBox_Tapped(object sender, TappedRoutedEventArgs e)
        {
            MessageDialog msgDialog = new MessageDialog("Tapped Event occour", "Windows 8 App");

            //OK Button
            UICommand okBtn = new UICommand("OK");
            okBtn.Invoked = OkBtnClick;
            msgDialog.Commands.Add(okBtn);

            //Cancel Button
            UICommand cancelBtn = new UICommand("Cancel");
            cancelBtn.Invoked = CancelBtnClick;
            msgDialog.Commands.Add(cancelBtn);

            //Show message
            msgDialog.ShowAsync();
        }


Here is a completed source code.


Hope it will help, Happy Coding.

Wednesday, August 28, 2013

What is Red Stripe Deals in Windows Phone Store.

Red Stripe Deals mean it gives you three choices every week to renew their Windows Phone experience and you can get 50% discount on the original price of one favorite app, one indie game and another one Xbox game.


Here you can find Red Stripe Deals

Cheer!!

Thursday, June 6, 2013

How to use FM Radio API in Windows Phone

In this post I am going to show you how to use FM Radio API in Windows Phone.

The Microsoft.Devices.Radio namespace contains the FMRadio API

Step-1
Add the following name space in your .CS file.
using Microsoft.Devices.Radio;
 
Step-2

  1: // create an instance of the FMRadio class.
  2: FMRadio oRadio = FMRadio.Instance;
  3: // Turn the radio on.
  4: oRadio.PowerMode = RadioPowerMode.On;
  5: // set the region. 
  6: oRadio.CurrentRegion = RadioRegion.UnitedStates;
  7: // set the frequency.
  8: oRadio.Frequency = 94.9;


Download Source code here


 


Happy Coding

Wednesday, May 15, 2013

How to launch the Marketplace in the Windows Phone 7 application

 

In this post I am going to show you How to launch the Marketplace programmatically.

follow the below mentioned steps:

Step-1 Create a new Silverlight Windows Phone Application
Step-2 In your MainPage.cs and add a using directive to the Microsoft.Phone.Tasks namespace.
Step-3 Add the following in the constructor of MainPage.cs after calling the InitializeComponent() method:

  1: var task = new MarketplaceHubTask();
  2: task.ContentType = MarketplaceContentType.Applications;
  3: task.Show();


Step-4 Run the application by pressing F5 Key.


 


Happy Codeing

Friday, April 5, 2013

Value cannot be null.Parameter name: parentContext in Windows Phone 7


Today morning I am just open Visual Studio 2010 and create a new Windows phone project and came across an issue with windows phone xaml page with the following error in design view.

Value cannot be null.Parameter
name: parentContext in Windows Phone 7

To rectify this issue I did two worked around and both are worked.
1) Build your project and close the page windows and then open.
2) Close the Visual Studio IDE and re-launch it.

Hope it helps.

Sunday, February 3, 2013

Windows Phone Emulator - Keyboard Shortcuts

Keyboard shortcuts are very useful while developing your Windows Phone applications, that basically allows to reduce the development and testing time. The following keyboard shortcuts substitute the physical buttons on a Windows Phone Emulator.

 F1 = Back arrow button. Escape key can also be used.
 F2 = Windows Start button
 F3 = Search button
 F6 = Camera button that is pressed halfway
 F7 = Camera button that is fully pressed
 F9 = Volume up
 F10 = Volume down
 F12 = Lock device/Power button. Press it twice to see the lock screen.
 PAGE DOWN = When text box is highlight, moves visual keyboard down, and you can use your physical keyboard for input
 PAGE UP = When text box is highlight, moves visual keyboard up.
 PAUSE/BREAK = Toggle keyboard

~~ Happy Coding ~~