Tuesday, April 30, 2013

Use Hardware keyboard with Windows Phone Emulator

I have just started working with windows phone programming and i was thinking how we can use hardware keyboard or desktop keyboard while working with Windows phone Emulator.

So, today we would see how to enable / disable hardware keyboard with windows phone emulator

Enable Hardware Keyboard


  • Press PAGE UP key 


Disable Hardware Keyboard


  • Press PAGE DOWN Key
Hope this TIP would help you in working with windows phone emulator.

Monday, April 29, 2013

TextMode Property in ASP.NET 4.5

With ASP.NET 4.5 we have been provided full HTML5 support. Taking the example of textbox, we have text mode property which can be set to different values such as :
a) SingleLine
b) Multiline
c) Password
d) Number
e) Range
f) Date
g) Color















Now, all these textmode property support varies from browser to browser. Some textmode property values are supported by IE or chrome.

So, let's start and see important textmode property values

1) Set the textmode property = "Password"

It would give you textbox, where you have to enter the Password but you would see that when you enter the characters in the textbox, they would be shown as "DOTS". Please see below image














Also, if enter the character as 'abc' rather than entering the complete email address, then it provides me alert to 'Enter the email address'. Below is the image
















2) Setting the textmode property="URL"
Below is the code
<asp:TextBox ID="txtUrl" runat="server" TextMode="Url" ></asp:TextBox>

However, i don't enter the URL in correct format, it would display the error as below















3) Setting the textmode property="Range"
<asp:TextBox ID="txtRange" runat="server" TextMode="Range" ></asp:TextBox>



















4) Setting the textmode peoperty="Number"
 <asp:TextBox ID="txtNumber" runat="server" TextMode="Number"  ></asp:TextBox>


















This means that in this textbox we can only enter numbers. However, if one enters characters it would give alert message like below

















5)  Setting the textmode peoperty="Date"
 <asp:TextBox ID="txtDate" runat="server" TextMode="Date"  ></asp:TextBox>
This would give option to enter the date from calendar.
















































6 )  Setting the textmode peoperty="Color"
<asp:TextBox ID="txtColor" runat="server" TextMode="Color"  ></asp:TextBox>

This would give option to select color like below

























Hope this article of mine gives you clear idea of textmode property of textbox.




Saturday, April 27, 2013

AutoComplete Text Box in Windows Phone

Today, we are going to see how to use Auto complete text box in Windows Phone. For this we have to first download the Silverlight toolkit.

We can download toolkit from codeplex
Once you have downloaded toolkit from above location, go ahead and install it.

So, let's start and see how we can use Auto Complete text box in our application

1) Open up the Windows Phone application and name it as 'WPAutocompleteTextBox'








2) Select Target Phone OS version as 'Windows Phone OS 7.1'





3) If you hover your mouse to Toolbox, you will find new toolkit controls added to it.




4) Now add the Auto Complete text box to your page and give the desired height and width





5) Update the Application Title to "Windows Phone Examples" and Page Title to "AutoComplete TextBox"

6) Move to code behind page, where we would be setting the Item Source of the Auto Complete textbox. Item source means from where data would be extracted.


 public MainPage()
        {
            InitializeComponent();
            txtPhone.ItemsSource = new string[]
            {
                "ASP.NET",
                "ASP.NET3.5",
                "VB.NET",
                "SQL",
                "Oracle",
                "ASP.NET 4.5",
                "LINQ",
                "MVC"
            };
        }

7) Once done, run the application and type keyword as "A" and you will find all the text starting with "A" such as "ASP.NET", "ASP.NET 3.5","ASP.NET 4.5".





Hope with this article of mine, you have become familiar with Auto complete textbox and how to use same in Windows Phone