Alright guys i am back with a new concept in Windows Phone 7 ( WP7 ) which is ViewStateManager. It is a really important concept for understanding visual states associated with them. If you want to create different states for your custom control then we would have to use Visual State Manager.

If you have the solution from my previous post then you can continue with it or you can download the solution here.

We will a few custom states and also learn about behaviours in this post.

  •  Now open CompanyLocations.xaml in expression blend. Drag four TextBlock controls onto the design surface, two for the headers and two for the details and then lay them out similar to the following snapshot.
Location Details

Location Details

  • Lets add a little more fun to this. Add two more textblock rotated at 90 degree and move the location details of the screen and also increase the font size of the headings as in the image below.
Text Rotation

Text Rotation

  • Now let’s go to the top left of expression blend where we have states and lets create new state group. Click on the Add State Group button and name the state group as LocationStates. Now add two new states namely CorporateState and SatalliteState. Now your state group should look something loke the screenshot below:

  • Now select CorporateState to start recording for that state which you can verify by seeing the red dot at the top right of the design surface. Now this will record any changes to the state as compared to the base state. Layout the CorporateState as shown in the image below:

 

CorporateState

CorporateState

  •  Layout for the SatelliteState is shown below:
SatelliteState

SatelliteState

  • Now lets switch back to the initial state and that any changes we make will affect all the states.
  • Now lets include behavior to bind these states to action. So now in your assets window search for GoToStateAction and drag and drop it to both the CorporateOffice and SatelliteOffice text.
GoToStateAction

GoToStateAction

  •  Now change the name to the GoToStateAction to the appropriate statename.

 

Technorati Tags: adf.ly,blogging,earning money,links

Here is one awesome service for bloggers who want to earn more money from links.

 

One thing I like about this , is easy integration in website, either you try mass shrike  , or JavaScript to automatically convert all the links  to ads(Don’t worry you can ad some links and domain to exception)

 

 

You can also easy integrate this in your Google analytical account.

 

Tip: Use this link to signup this service and you could win a chance to earn 20% extra on every signup.

 

Happy Blogging and earn more money and share your comments.

Hey Guys. Hope you liked my previous post for creating a simple Windows Phone 7 navigation application.

So in this post we will learn as how how can we optimize the virtual keyboard on WP7 for various input controls.

Open the solution we created in the previous post for creating a simple Windows Phone 7 navigation application or else you can download the solution here.

  • Now open contact.xaml in Expression Blend and go to the ContentPanel inside LayoutRoot. Now open the properties of ContentPanel and expand the layout properties and then set the VerticalScrollBarVisibility to Auto

 

VerticalScrollBar

VerticalScrollBar

  • Select ContentPanel in the design surface in the centr and then double click the grid contol in the toolbar. This will add a grid inside the ContentPanel. Now right click the grid and select AutoSize –> Fill.

 

VerticalScrollBar

VerticalScrollBar

  •  Now just just drang and drop TextBlocks and TextBoxes as show in the image below:

    TextBoxes & TextBlocks

    TextBoxes & TextBlocks

  • Now come the coolest feature in input controls. It is a property called InputScope. Now select the TextBox for Phone and go to properties –> common properties –> InputScope and set it to TelephoneNumber. Similarly change the testbox properties of other contols to below specified values and you will see the magic when you run the application and all this is done without writing any code.

            First Name textbox: Set InputScope to PersonalGivenName
Last Name textbox: Set InputScope to PersonalSurName
Email textbox: Set InputScope to EmailUserName
            Web Site textbox: Set inputScope to Uri
            Address textbox: Set InputScope to AddressStreet
            City textbox: Set InputScope to AddressCity
            State textbox: Set InputScope to AddressStateOrProvince

InputScope

InputScope

  • Now while setting the input scope you might have seen a large number of options but thats not the full list. The full list of the InputScope instances is below:

    InputScope instances

    InputScope instances

Download the source code by clicking on the button [button link=”http://minus.com/mV0RoTjnG” style=”download” color=”green”]Download Source Code[/button]
Do let me know your feedback on this post. Thanks

[highlight]Create a simple navigation application in Windiows Phone 7 ( WP7 ) [highlight]

In a Windows Phone application it is highly probable that you will have more than one screen in your application and you will need to navigate between them. We can make use of the navigation framework for the same. This navigation will be very similar to navigating from one web page to another. This navigation framework also supports query string.

So without much talk let’s go ahead and create a simple business information application of financial company ACME and learn navigation in WP7.

  • Goto visual studio 2010 and create new Windows Phone Silverlight and XNA Applicationand name it NavigationExample.

    Create Application

    Create Application

  • Add new folder to the NavigationExample named Views and inside Views add a new folder Locations.

    Add Folder

    Add Folder

  •  Now add Windows Phone Portrait Page named About and Contact in the Views folder

  • Similarly add Windows Phone Portrait Page named Corporate Office and Satellite office in the Locations folder.

    Windows Phone Portrait Page

    Windows Phone Portrait Page

  • Now lets open the pages and edit the default text on the pages.
  • Open MainPage.xaml and edit the text to as shown in the image below. Also drag and drop four HypelinkButton onto the MainPage.xaml

    MainScreen.xaml

    MainScreen.xaml

  • Now edit the HyperlinkButtons to point to the proper pages to be navigated. Use the image below to do the same.MainPage.xaml

    MainPage.xaml

    MainPage.xaml

  • Now open about.xaml, contact.xaml, corporateoffice.xaml, satelliteoffice.xaml and edit the headings.
  • Now run the application and you will see the screen as below. You can also navigate to different screens.
Navigation Example

Navigation Example

You can download the full source code here

Please remember to leave your feedback or appreciations or questions. Thanks