Summer vacation is now officially over

268389_114941678600615_100002543499666_126349_7385000_n[1]

My long summer vacation has now come to an end. I have restored my energy levels and I am ready to continue blogging. My next series of posts will be covering Inversion Of Control (IoC) possibilities in Windows Phone environment. For this and also for my future posts I will use Windows Live Writer. I’ve heard a lot of good feedback regarding this tool, so, I think, I will give it a try.

Posted in General | Tagged , , | 1 Comment

Passing values between Windows Phone 7 pages: Current context of Application

Another approach for passing parameters and values between two Windows Phone 7 pages is in using a current context of application (i.e App.xaml.cs file). As it is for Page Instance approach and for QueryString approach this one also has several advantages and disadvantages.

Passing values between Windows Phone 7 pages: Current context of Application image by eugenedotnet aka jevgeni tsaikin
Continue reading

Posted in Development, Windows Phone 7 | Tagged , , , | 6 Comments

Three properties that I use for almost every Windows Phone application

In this post I will tell you which three properties I use for almost every of my Windows Phone applications. First property is used by me to determine if the application is running in trial mode or full mode. Second property is provided to identify if the application is running on low-memory device and the last property is used to detect if user has selected a dark or light background theme in Windows Phone settings. All of those properties were described in details earlier, but I have decided to collect them in a single post.

Continue reading

Posted in Development, Themes, Tips & Tricks, Tutorials, Windows Phone 7 | 2 Comments

Detecting theme background in Windows Phone 7 applications

As you have probably noticed Windows Phone 7 platform allows you to change the Background (Theme) in emulator and on real device. It can be accomplished in Settings -> Theme menu (check image bellow). As a developer I sometimes need to determine what background theme is currently applied to a phone to take advantage of it during the development.

Image of emulator for Detecting background of a theme in Windows Phone 7 applications by eugenedotnet aka Jevgeni Tšaikin

Currently, you are able to pick one theme among “light” and “dark”. Notice that “dark” theme is considered as more battery-friendly theme. Now I am going to show two properties I use to detect both themes. Usually I use only one of them per project.

public bool IsLightTheme
{
    get
    {
        return (Visibility)Resources["PhoneLightThemeVisibility"]
            == Visibility.Visible;
    }
}

public bool IsDarkTheme
{
    get
    {
        return (Visibility)Resources["PhoneDarkThemeVisibility"]
            == Visibility.Visible;
    }
}


Posted in Development, Themes, Tips & Tricks, Windows Phone 7 | Tagged , , , | 3 Comments

Binding Image, Brush or Color to Background property in Silverlight and Windows Phone 7

I’ve decided to post a property I use to bind Image / Brush / Color hex to Background property of Silverlight or Windows Phone 7 control. First of all, do not use that property in every Background Binding case to avoid a minor loss of performance, use it in rare cases, when you have no other option. To bind image I am using ImageBrush, for Brush (with color) I am using SolidColorBrush and for Color hex – string.

public object CustomBackground
{
    get
    {
        if (...background should be an image...)
        {
            // bind Image
            return new ImageBrush
                   {
                       ImageSource = new BitmapImage(new Uri(..image url...))
                   };
        }

        if (...background should be a brush...)
        {
            // bind Brush
            return new SolidColorBrush(Colors.Blue);
        }

        // bind color hex (RGB hex or RGB+Alpha hex)
        return "#FFFFFFFF";
    }
}

You can bind this property to Background using standard approaches to Data Binding in Silverlight.

<Grid Background="{Binding CustomBackground}">
...
</Grid>


Posted in Binding, Development, Tips & Tricks, Windows Phone 7 | Tagged , , , , , , , , | 2 Comments

Detecting and simulating low memory devices in Windows Phone 7 applications

Probably most of you have read Performance and Resource Management part of Windows Phone 7 Application Certification Requirements v1.4 document concerning requirements to memory consumption. In particular, there is a sentence regarding low memory devices (which have only 256 MB of RAM installed): “An application must not exceed 90 MB of RAM usage, except on devices that have more than 256 MB of memory”. In this short post I will describe how to detect such devices.

Continue reading

Posted in Development, Optimization, Tips & Tricks, Tutorials, Windows Phone 7 | Tagged , , , , , | 6 Comments

ItemsControl virtualization using VirtualizingStackPanel in Silverlight for Windows Phone 7

Usually I am using ListBox control in my Windows Phone 7 Silverlight applications to display a scrollable list of child controls. ListBox offers UI virtualization, that means that UI is loading ListBox items on demand to increase the performance and reduce memory allocation. One of the main keys to that is in using VirtualizingStackPanel as ItemsPanel Template for ListBox control.

Lately in one of my Windows Phone 7 projects I had to replace ListBox with ItemsControl, but ItemsControl does not offer UI virtualization for child items by default, so I had to add the same VirtualizingStackPanel to ItemsPanelTemplate element. Also I have modified the Template element to be able to add and access ScrollViewer for ItemsControl.

<ItemsControl>
    <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>
            <VirtualizingStackPanel />
        </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>
    <ItemsControl.Template>
        <ControlTemplate TargetType="ItemsControl">
                <ScrollViewer>
                    <ItemsPresenter/>
                </ScrollViewer>
        </ControlTemplate>
    </ItemsControl.Template>
    <ItemsControl.ItemTemplate>
        <DataTemplate>
            <!-- place your controls here-->
        </DataTemplate>
    </ItemsControl.ItemTemplate>
</ItemsControl>


Posted in Custom Controls, Development, Silverlight, Windows Phone 7 | Tagged , , , , | 3 Comments

Binding text containing tags to TextBlock inlines using attached property in Silverlight for Windows Phone 7

Lately I’ve had to bind a text in custom format(having different tags inside) to a TextBlock element for one of my Windows Phone 7 applications. The only option to bind such specific text to a normal TextBlock was in using Inlines collection property. For example: <br /> tag in text should be replaced with <LineBreak /> inline element. Pretty similar to HTML. Unfortunately, TextBlock Inlines property is not a DependencyProperty, therefore we cannot add data binding directly to Inlines. In this post I am going to share my vision and approach to accomplish this task using an attached property and Data Binding converter.

Continue reading

Posted in Binding, Development, Silverlight, Tutorials, Windows Phone 7 | Tagged , , , , | 6 Comments

Microsoft Most Valuable Professional in Device Application Development

More than two weeks ago I was awarded Microsoft’s Most Valued Professional (MVP) in Device Application Development. Frankly speaking, becoming a MVP was actually one of my dreams, which I’ve never thought will come true, therefore I am very pleased and honored to become one of MVPs. Thank you!

Basically during this year I have realized that MVP activities are all about sharing, you share your experience, knowledge, thoughts, ideas using different channels like technical blogs, social media, forums, screencasts, websites and offline presentations. Of course, those activities take a lot of my valuable personal time, but I hope they will save some of yours :) Anyway I am looking forward to new contribution and development opportunities in 2011/2012.

Jevgeni Tsaikin MVP award kit

Posted in Awards, MVP, Windows Phone 7 | Tagged , , , | 1 Comment

Windows Phone 7 Touch and Sensors presentation for Eneta

Few months have passed since my previous presentation for Eneta community and time has come to talk about something new. This time I have chosen two topics: Touch and Sensors. I think, both topics are very important for Windows Phone 7 developers, especially when it comes to developing games.

Jevgeni Tšaikin presentation for eneta 16032011 on topics Touch and Sensors by eugenedotnet

Continue reading

Posted in Events, Presentations, Windows Phone 7 | Tagged , , , , , , | Leave a comment