Windows Phone 7 development

Posts tagged ‘WP7’

How to get MAC adress on Windows Phone 7 device.

There had been an issue with MAC adress on WP7 – the MAC wasn’t exposed. As a result, there phone can’t be connected to MAC-secure WIFI.

After March update, the MAC is in About page.


Go Setting -> About -> More info.



Changing namespaces in WP7 project

It seems that VS 2010 screws the project properties when namespaces are changed.

I posted it on SO.

And the solution is:

Check the “Startup Object” in the project properties page. The sometimes requires manually being set/corrected when the namespace of the app is changed.

Thx Matt ūüėČ

WP7 Tip

to enter extra sign like < press and hold ( sign.

WP7 Development Best Practices Wiki

The best practices about Silverlight and Silverlight for Windows Phone 7.

WP7 wiki

Find WP7 apps using Bing Visual Search

How to find app using internet browser? Use bing Visual Search.



Classic Metronome for WP7

Classic Metronome by SoonStudios!

Serch for ‚ÄúClassic Metronome‚ÄĚ in Zune or

Making Tip Calculator for Window Phone 7

Tip calculator is the one of the most useful tool/app for mobile devices.

The so-called business logic is very simple and is not very different among various versions of Tip Calcs out there. Yet, what I would like to show is my way of Metro UX which I do belive is still a part of family.

Entry animation – first user expirience.

<Storyboard  x:Name="mainInAnimation">
  <DoubleAnimation Storyboard.TargetName="ContentPanel"
    Duration="0:0:1" To="-20" >
      <ExponentialEase  EasingMode="EaseOut"  />
 <DoubleAnimation Storyboard.TargetName="TitlePanel"
   Duration="0:0:1" To="-20" >
     <ExponentialEase  EasingMode="EaseOut"  />
 <DoubleAnimation Storyboard.TargetName="ContentPanel"
    Storyboard.TargetProperty="Opacity" Duration="0:0:1.5" To="1">
      <QuadraticEase EasingMode="EaseOut"  />

It gives a nice slide animation at start-up and opacity change. I used easing fuctions to give it more natural look.

Poping Textbox.

<Storyboard  x:Name="translateAmountAnimation" >
    <DoubleAnimation Storyboard.TargetName="translateAmount"
    To="-3" AutoReverse="True" Duration="0:0:0.2">
       <ExponentialEase  EasingMode="EaseOut"  />

When Textboxes are pressed, they  move up and down.


I have made a few changes to the default style.

  • opacity of¬† TexBox is 0.7
  • different margins (careful with that and bear in mind the rule of thumb – 0.9mm)
  • aligment
  • theme aware styles (like PhoneTextLargeStyle)

That is all about XAML, now C#.

/// <summary>
/// Constructor
/// </summary>
public MainPage()
   this.LayoutUpdated += new EventHandler(MainPage_LayoutUpdated);

The ctor is kept light-weight for faster start of app and all the details are handled by MainPage_LayoutUpdated event handler.

private void MainPage_LayoutUpdated(object sender, EventArgs e)
    if (m_onNavigatedToCalled)
        m_onNavigatedToCalled = false;
        Dispatcher.BeginInvoke(() =>
                Random random = new Random();
                var number = random.Next(1, 3);
                string fileName = String.Format(@"Images\background{0}.jpg", number);
                backgroundBrush.ImageSource = new BitmapImage(new Uri(fileName, UriKind.Relative));
                radioButton3.IsChecked = true;

Since we need to prepare things when everything is loaded MainPage_LayoutUpdated is a proper event but it is called everytime when layout has been updated, hence m_onNavigatedToCalled bool is init with true value and after first call of event it is set to false.
Dispatcher.BeginInvoke is a thread-safe asynchronous method for UI changes (mainly). In lambda expresion the random background is picked and animation begins (I prefer do it in code).


        private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
            if ((e.Orientation & PageOrientation.Portrait) == PageOrientation.Portrait)
                Grid.SetRow(bottom, 1);
                Grid.SetColumn(bottom, 0);
                sumStackPanel.Margin = new Thickness(35, 30, 0, 0);
                Grid.SetRow(bottom, 0);
                Grid.SetColumn(bottom, 1);
                sumStackPanel.Margin = new Thickness(-5, 30, 0, 0);

To keep UI concise I have divided main Grid into 2 kolumns and 2 rows. After OrientationChanged event  occurs bottom grid is set to next column. For the orientation changes  the Hybrid animaion do a nice job.

That is all interesting things about code. Here you can download the soultion link OR

You can download Tip Calc for free form Zune marketplace! enjoy!

And here is a demo. (animations are a bit choppy because of emulator + recording software) ūüėČ

All feedbacks and comments are welcome.

%d bloggers like this: