WP7Tips

Showing posts with label WP7Tips. Show all posts

imageSometime we want to show the System Information to the user, whether it is an Application or a simple Game. We need to show those system specific information to the Windows Phone 7 user by using an System page. So, in such case, how will you fetch those information and show them to the user?

 

Well, this post will help you to understand it and let you know about this data in Windows Phone 7 device. Read to learn more about this topic.

Published by on under CodeProject | DZone

The root class of the Windows Phone 7 page includes two attributes called “Orientation” and “SupportedOrientations”. Those are actually enum values and provides you option to set the orientation of your page programmatically.

 

Today in this post we will describe about it in depth. If you are new to Windows Phone 7 programming, you will find this tip handy to understand about the page orientation on Phone page. Read to know more about this.

Published by on under Silverlight | Tips

That’s a good question asked by Alan in my last post “Why the Frame Rate Counter is not available in my Windows Phone 7 Emulator?” Ok, to answer to this query, there could be some different issues/solutions for this.

 

Let’s discuss more on this query here. If you are facing the same issue, this post might help you. There could be different possibilities too. If you have different solution, please use the comment link to submit your approach here.

Published by on under Mango | Silverlight

Frame Rate Counter in Windows Phone 7

While working with Windows Phone 7 emulator, you might noticed that, in debug mode it shows some numeric values at the right side of the screen. So, what are those values and why that numeric bar is available in debug mode?

 

The bar represents numeric values for Frame Rates to debug Memory usage by your WP7 application. In this post, we will briefly discuss on this topic. Read further to learn more about this Frame Rate Counter.

Published by on under Silverlight | Tips

In Windows Phone 7, the System Tray is the small bar across the top of the screen in Portrait mode. It displays the Signal strength, Current time and Wi-Fi connection strength.

 

In this post, we will learn more about Windows Phone 7 System Tray. It is easy to write code to show or hide the tray. We will use a small demo to demonstrate it.

Published by on under CodeProject | DZone

Are you facing any issue deploying your Windows Phone 7 application in the emulator or, are you facing any issue while opening the Windows Phone 7 emulator? Is it stating some System Error while finding “MFPlat.dll”? If you are facing the similar issue, this post will help you. Do bookmark this post and share to others, so that, if anyone is facing the same will resolve it easily.

 

In this post, I will tell you the background of the issue and the solution to fix this problem. If you have any other alternative, do share it here and help the other person. Read more to find out the issue and it’s solution.

Published by on under Windows | Windows7

Hope you already read my article series "Collection of Windows Phone 7 (Mango) Tutorials". During the tutorial series, we used the common styles "PhoneTextNormalStyle" and "PhoneTextTitle1Style" in the TextBlocks added to the TitlePanel. So what are those? These are all common styles defined by the style library of WP7 SDK.

 

In this post, we will learn about various font sizes defined in the default style library of Windows Phone 7. So, you don't have to define them again and can reuse those styles which will be standard sizes all over any Phone 7 Applications. Let's discuss them here. Read to know more about it.

Published by on under CodeProject | Silverlight

Sometime we need to know whether Network connectivity is available or not from our application. In Windows Phone 7, we have the required API exposed for the developers to detect the status of the network connection and take respective step based on that.

 

So how to detect it? In this small tip of the tutorial series, we will learn about the API and we will also see how this can be done using a small demo which includes code too. Read to know more about it.

Published by on under Mango | Silverlight

Hope you read my previous post on Windows Phone 7.1 (Mango) local database support. If you didn't read the earlier post, you need to read it before reading this one. You can find it here: "Create DataContext". That will give you the basic context about the same.

 

In this post (I will rather calling it as a Tip), we will configure the project by adding the generated DataContext class and in the next post, we will learn what are the various CRUD operations we can do with a sample application. That will give you complete visibility to this new feature implementation.

Published by on under Mango | Silverlight

If you are developing any Windows Phone 7 application form and using the Emulator to run the app, you may find this tip very useful. A first time user who feels very annoying to click the mouse button to enter text using the phone emulator can hide the onscreen keyboard and use the computer's keyboard after reading this tip.

 

Read to know more about the small tip which will make your life even easy.

Published by on under Mango | Silverlight

In the last chapter of the series, we learnt about Application bar and the uses of it using a small demo application. We described about Icon buttons and Menu items too.

 

You can add an application bar to your page both from XAML and code behind. There are some design guidelines for Application bar and a developer must know about these before designing and developing their Windows Phone application. In this chapter, we will discuss about them. Read to know more and don't forget to share them to your colleagues and followers.

Published by on under Mango | Silverlight

In this Tips&Tricks, I will describe about changing the location of the output of your Silverlight application i.e. the .XAP file from it’s original “ClientBin” location to a different place. Developers sometimes need to put the XAP file in a specific directory based on their requirement. This trick will help them relocating the XAP file.

 

Read the full post & if you have any queries or suggestions, please let me know. Appreciate your feedbacks.

Published by on under .Net | Silverlight

I was working with WPF/Silverlight since March 2008 and learnt lots of things. I wrote lots of Articles on Silverlight and published in my Blog. Today I decided to share you some of the best practices you should follow while doing development in WPF/Silverlight. Hope, this will help you guys while writing XAML codes. Read and try to strict with the guidelines whenever you are modifying your XAML.

 

Feedbacks are always appreciated. Hence, don’t forget to leave your comments at the end. If you have any more points, please share it here. I will review them and add those here.

 

Update [08-Aug-2010]: On popular demand, I updated this post with some explanation on “Why?”.

Published by on under .Net | CodeProject

Neither the Silverlight is new nor the init params. But, I found various people in different forums asking for the logic on the implementation part for passing value to Silverlight application from ASP.Net application. In this post, I will describe about it.

 

Here I will discuss on the InitParams and tell you how to use it to pass value from your .aspx page to your Silverlight application. Read the complete post and if you have any queries, don’t hesitate to ask me.

Published by on under .Net | CodeProject

File:Indian Rupee symbol.svgIn July 2010, Indian Cabinet selected a new Symbol for the Indian Rupee which looks like as the snapshot shown at the left side. In this post, I will describe you how to integrate the same symbol in Silverlight application.


As the Unicode is not present for that till now, hence we need to use some font to write the letter using that. Fordian Technologies has the font and you can download it from their official Blog. The latest version of the font is available here: Rupee Font Version 2.0.


Let us have a quick tutorial on it to create a Silverlight application with the new Rupee Symbol of India in it.

Published by on under .Net | CodeProject

imageHave you ever heard of Text to Speech engine? “Yes” I think. Yes, it is not a new thing in the Computer World. It was available since Windows 98 (as much as I can recall) but it is completely new in Silverlight. You can now use the Silverlight application to give an API call to the SAPI Engine which will convert the text to voice. Sounds Good? This is achievable using the COM APIs only.

 

Here I will describe you how to use COM API to give a TTS call to the SAPI Engine. After reading this topic here, you will be able to write your own code to develop your own application having the Text to Speech functionality in Silverlight 4.

Published by on under .Net | Interoperability
Have you ever tried Trimming your Text in Silverlight 2 or Silverlight 3? If yes, just recall the lines of code you wrote for trimming your text content and showing an Ellipsis (i.e. “…” three dots) at the end of the text. If you didn’t try it earlier, then just imagine what you have to do and how you will do. Also imagine the no. of lines you have to write. Confused smile

In this post, I will show you how I can implement this feature the easy way. Stop!!! I will not write here a huge code nor I will use any library to do that. Microsoft has added this functionality in Silverlight 4. You just have to set the Enum value to the TextBlock property. Surprised smile Wao!!!

So, how to do that? Let us try it.
Published by on under .Net | Silverlight

I think this is now-a-days a common issue for all the developers who are currently exploring both Visual Studio 2010 RC and Silverlight 4 Beta. Microsoft has removed the bits of Silverlight in the RC version of Visual Studio 2010. To work with that lots of people are now asking the same question.

Today I found a link which is written in a different version. I thought to share this thru my blog which may help the fellow developers (who are keeping a eye to my blog posts) to explore both simultaneously. Here is the original link of the post: http://sorokoletov.com/2010/02/hate-2-wait-silverlight-4-beta-2-vs-2010-rc/

Use the below link to translate it in English: http://tinyurl.com/SL4inVS2010RC-en

If you follow the steps provided in that blog post, you can install the Silverlight 4 Beta in your Visual Studio 2010 RC environment & start working on it till Microsoft releases the RC version of Silverlight. Go ahead and enjoy.

Remember: WCF RIA Services doesn’t work with this hack. I strongly recommend you to work with Visual Studio 2010 Beta 2 & Silverlight 4 Beta.

Published by on under Silverlight | SilverlightTips

Virtualizing StackPanel generates container items when needed & throws them from memory when they are no longer in the view. When the panel has huge number of items, at that time there is no need to keep the extra items in memory which are not in view. This solves the memory problem.

If you are populating a huge number of items in any panel, then it is a better idea to use the Virtualization. But, due to throwing away of the extra items & recreating them when in view, costs some extra processing power when the Virtualizing StackPanel uses the default Standard Mode. To solve this issue, just change the virtualization mode to "Recycling". This is called as Container Recycling, which introduced in .Net 3.5 SP1 as a new feature.

By default, this recycling mode is turned off. To enable the container recycling, first turn on the Virtualizing StackPanel with “VirtualizationModeProperty” as “Recycling”.

<WrapPanel x:Name="wrpPanel" VirtualizingStackPanel.IsVirtualizing="true" VirtualizingStackPanel.VirtualizationMode="Recycling" />

You can also use GetVirtualizationMode() & SetVirtualizationMode() to get or set the current mode.

Published by on under .Net | SilverlightTips

DependencyProperty is set to enable declarative code to alter the properties of an object which reduces the data requirements by providing a more powerful notification system regarding the change of data in a very specific way. In .NET, there are two types of properties. One is the normal property & another is the DependencyProperty which has added functionality over the normal property.

Now, let us discuss on how to implement such DependencyProperty to give a powerful notification on data change:

First of all, implement the UserControl class from INotifyPropertyChanged interface:

public partial class MyUserControl : UserControl, INotifyPropertyChanged
{
    public event PropertyChangedEventHandler PropertyChanged;
    protected void OnPropertyChanged(string propertyName)
    {
        if (PropertyChanged != null)
        {
            PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}

Create your own normal Property, lets say the name of the property is “Caption”.

public string Caption

    get { return GetValue(CaptionProperty).ToString(); } 
    set { SetValue(CaptionProperty, value); }
}

Now, register the DependencyProperty to the CLR by calling the Register method by passing the property field that you used to store the data in earlier step:

public static readonly DependencyProperty CaptionProperty = DependencyProperty.Register("Caption", typeof(string), typeof(MyUserControl), new PropertyMetadata(string.Empty, OnCaptionPropertyChanged));

The name of the identifier field of the DependencyProperty will be same as you used in the property after appending “Property” at the end. In this example, our Property name is “Caption”, hence our identifier field name is “CaptionProperty”. Add the PropertyMetaData with default value & callback event handler within the Register method as mentioned in the above code. Mark the identifier as static & readonly so that this will be unique to the CLR.

Now, implement the OnCaptionPropertyChanged event handler:

private static void OnCaptionPropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)

    MyUserControl myUserControl = dependencyObject as MyUserControl; 
    myUserControl.OnPropertyChanged("Caption"); 
    myUserControl.OnCaptionPropertyChanged(e);
}

private void OnCaptionPropertyChanged(DependencyPropertyChangedEventArgs e)
{
    txbCaption.Text = Caption;
}

The implementation of the DependencyProperty is complete. You can either call it from XAML:

<local:MyUserControl Caption="My First Dependency Property Example" />

or from Code behind:

MyUserControl myUserControl = new MyUserControl();
myUserControl.SetValue(MyUserControl.CaptionProperty, "My First Dependency Property Example");

Published by on under .Net | Silverlight