Friday, December 9, 2011

I am speaking at 13th Edition of Microsoft Virtual Tech Days from 14 to 16 December 2011


First of all very sorry for not posting anything from last month or more than that. I am actually totally occupied with some interesting Windows Phone 7 Project and also some amazing .NET & SQL BI assignments including SSIS and SSRS.This kept me extremely busy for last two months.But I kept on exploring the things and I will very soon resume blogging and very soon going to post some good stuff.

Out of all this, I am glad to announce that I will be speaking at 13th Edition of Microsoft Virtual Tech Days which will be hosted by Microsoft India. This is a complete online event with tons of good sessions for all 3 Days starting from 14th December to 16th December 2011.


I will be speaking on Day 3 inside “Windows Phone” Track on a very interesting topic titled as Best practices of designing apps for Windows Phone

I will be taking various design related topics in this discussion followed by Questions and Answers, Its scheduled at 01:45 PM IST, So Mark your calendars right away !

For more information about Microsoft Virtual Tech Days, Registration and Agenda for all 3 days,Visit

Do participate in Quiz and Questions and Answers sessions actively since there are lot of goodies to win for you :


So block your calendar right away ! I wish to meet you all there at my session. Also after that week, I assure not to take any logical or physical breaks and will resume postings here. So do make a visit here in coming weeks, some really exciting stuff is on your way.


Wednesday, September 21, 2011

Building your First Windows Metro style Application using Visual Studio 2011 on Windows 8


For a while keeping aside the hot topic of  “Silverlight is dead”,I am coming back to normal activities and doing part of that I am putting a small post here just for those who have installed Windows 8 and wondering how overall things will work on their Windows 8 box.

I assume here that you have done with Windows 8 Developer Preview setup,For me,I installed Visual Studio 2011 as a separate installation.Frankly, it was not that smooth compare to Windows 8,it crashed 2-3 times.Well,with the assumption of successful installation, lets move ahead with our first “Hello World” kind of a Metro UI Application.

Our First Metro UI style App using Visual Studio 11 on Windows 8:

Once you installed Visual Studio,you will find the shortcut of the same on your Metro UI interface which is default in Windows 8 Developer Preview, so by clicking on that it will throw you with the Visual Studio 2011 IDE in Desktop mode which is very similar to your normal Windows Desktop in Windows 7


Once Visual Studio 2011 is open,Click on File>>New Project


Please see in the above snap, The one which is in red circle is your Windows Metro style Project template.Since this our first post,so I am not pushing too much content on you and leaving you in a state of confusion,so for other project templates in this category and what they do,that I will share in upcoming posts.So after selecting this template and giving a relevant name to your app, Click on OK to move ahead.

Visual Studio 2011 :

There are significant improvements in IDE and new features are there but right now I am purposefully not pulling them here just to keep our focus on App.So if you are familiar with Visual Studio 2010 then you will not struggle much with the Designer and Code Window.


Our First App using RichTextBlock :

As you know that XAML is the backbone of Metro style app,So I will be using XAML as UI and C# to code. I will talk about other ways to code using other languages in my upcoming posts.



Make sure you set x:Name to the RichTextBlock control (which is very similar to our Silverlight 5 RichTextBox control)

C# Code :


So on visibility of each RichTextBlock I am controlling the UI via Button Click event. Idea is to show Japanese,Arabic and English content on each of the button click and similarly hide other two at the same time.

Output :

Oh wait ! what in case I don’t have Metro UI or for that matter I am running Visual Studio 11 on other box then?, well life is good ! you have a build in and fully functional simulator of Windows 8 which is very realistic in look and feel and behavior of Windows 8 Metro UI,so you will find that option once you wish to start debugging the application like shown here :


and now you are all set to see the output like shown below ! :


You can see shortcut of your Metro UI Style App on the Windows 8 Metro Desktop like this :


You can do much more configuration related settings with package.appmanifest file inside your project,it will help you to get settings like below :


Since this is our first app, I am not going into much more details on the each of the sectional tab shown above, that I will address in my upcoming posts, so now let’s see the final output :


Yahooo ! Our first ever app is ready on Windows 8 using Metro UI style inside Visual Studio 2011. Once you click on each of the button,you will see some language specific text. Well though its very basic, but idea behind is to get familiar with the environment, In upcoming post, I assure to have much more high level apps.

Something about Simulator :

Like Windows Phone 7 emulator, you can rotate this Tab and see app from various angles. It also provides you option to interact app with Mouse and even using Touch like I have shown in the second diagram.



In this way, its very useful and fully functional simulator and helps us a lot and saves lot of efforts,It gives best feel of your app on Windows 8 environment.

So, This is our first “Hello World !” kind of Metro UI style app using Visual Studio 2011 on Windows 8. I hope after reading this post, you will be in position to understand overall environment,better you that, so that you can easily understand my upcoming posts.

Do try this out, Build a small app,meanwhile I will go back to Windows 8 and Visual Studio 2011 and will try to build more solid app integrating some more good,jazzy business related stuff.So stay tuned ! keep visiting here for more !


Sunday, September 18, 2011

Silverlight is dead…and our thought process too !


People says that when you dream about someone who you see going to die in your dreams,In reality he/she lives a long ! ..Something similar is going for Silverlight these days.More people saying bad about and more the core platform is growing better day after day.

My post here today is not to shout that I am Silverlight MVP and We are not dead but I just want to trigger a positive thought process so that we will not go dead with current “Silverlight dead” discussions in near future.

Just to clarify :

Thought I love Microsoft technologies a lot and especially Silverlight that does not mean that I am Fanboy and in this post I am defending something. I have equal love and passion towards other MS and Non MS technologies as well. From last 2 yrs I am working in IBM and executing large WPF Projects and also using some Open Source tools and technologies.

I am not employee or decision maker at Microsoft nor I am a complete Windows 8 Master or Metro UI Geek etc. So following stuff is purely based on my personal analysis, Being a community chap I am always open for feedback and do correct me if something I mentioned here is totally wrong.I would love to hear that and add more to me.

“Silverlight is dead !” ..The new story on Internet … :

This all started in last PDC when Microsoft showcase strength of HTML5 + JS on their own platform.I know even initially I was also wondering why they are doing such hype of this platform but then realize and understood entire Development Ecosystem.

I have also wrote a biggie article on that situate here and got positive response from all of you :

Silverlight, HTML5 & Windows 8 : Where we are heading to ?

So before making any final thought,do read that and this article..after that its your call !

Coming back to the subject :

Build event and reactions after keynote :

Few points I would like to take up for discussion -

  • Why people want every time a commitment from Microsoft Senior representatives like Scott Gu or Steve Ballmer to come on stage and explicitly say that “Silverlight is not dead !!” ? – Same for WPF and other technologies.
  • Unless one technology is not dead, New and enhanced things never comes up..I mean do you still want Visual Basic 6 if I show you strength of VB.NET or WPF for that matter. Why people are not shouting when Classical ASP,VB6 etc gone dead ? Because there was a need of .NET/WPF somewhere and that’s why they are present today. Same is the case for HTML5,Metrofy Apps and WinRT

Windows 8 as OS and Windows 8 Tablets :

  • Today I installed Win8 Dev Preview on my Dell XPS and frankly,with Mouse it does not give any feel like it gives on Touch supporting devices.But UI is amazing rather outstanding !
  • There is a Desktop mode which is similar to normal Windows,So MS is not forcing you to be on Metro all the time,you have choice !
  • Microsoft is now head to head with other vendors especially to compete devices like iPad.
  • There are still millions and billions of Windows XP,Windows 7 Users. It takes years to migrate OS for big organizations.(My employer IBM India is still on Windows XP).So entire world will not change in one night time after complete Windows 8 is available.

Some random thoughts on HTML5 Native Apps :

  • They are amazing ! Something worth to learn and try out.
  • I don’t think they are true cross platform and will run on Mac ! Correct me here if I am wrong (Silverlight is Cross platform and same code with small modify runs on WP7 as well)
  • At this moment I am not sure how many will adopt Metrofy or HTML5 + JS platform for “Enterprise Application Development” where we usually plug WCF,WF,MEF,Microsoft Enterprise Library etc.
  • With Blend Support, Now job is easy to design these HTML5 apps, So Designers will be happy for sure.
  • Performance and tooling support for HTML5 is in great progress but then same question again..Is it full functional like WPF or Silverlight, Just having similar features and capabilities does not change game totally.

If Microsoft declare death of Silverlight : Think over this..

  • Do you think people will keep their mouth shut and just obey ? I mean think from WP7 perspective.Think over this..
  • There are Thousands of App in WP7 Marketplace Up and Running on millions of devices, what will happen to them if Silverlight is dead ?
  • Do you think Microsoft is just making fun of people from past few years by launching different versions of Silverlight? Today we are in version 5.So think over this..
  • Do you think Microsoft will say one day that “Silverlight is dead rollback your apps which are there on your WP7/Marketplace/Web or OOB state” …crazy ! It will not happen like that anyway..think carefully when you say its dead !
  • What to develop,which language to use : Usually this totally depends on one’s comfort level with the technology.Think over this..

Current Silverlight situation and what to do in future ? :

  • There is no official statement from Microsoft saying “Silverlight is dead”, So stop right there and don’t follow those garbage and nonsense blogs/posts/discussions/videos/thoughts saying “Silverlight is dead”
  • Read the feature set of Silverlight 5 Carefully !
  • Windows 8 / WinRT /.NET 4.5 etc are in “preview” and not  even in “Beta" or “RC” some features can be added or removed,its common thing in Product development.So it will be too early to make judgments on availability of Silverlight on Windows 8 or with WinRT, Metrofication etc.
  • Keep track of happening changes in the new Windows 8 Platform, start building small small apps using Visual Studio 2011.
  • Do more visualization than actual migration.This is not right time to decide whether the new development should be a Metrofy or normal one since entire platform is in preview stage.So even not ideal time to create PoCs since many things will be changing/breaking up/crashing because of preview state.
  • Follow correct and official Microsoft resources which can be : Microsoft Representatives, Silverlight MVPs and Insiders, DPE Evangelists etc.
  • Now “XAML” + Code behind of your choice is the buzz word instead of just casually saying its WPF’s XAML or Silverlight’s XAML

What’s the benefit of investing in Silverlight from last few years then ? :

  • XAML ! Those who are working on WPF and Silverlight..its party time for them since they already have one Rich and Demanding Skillset of XAML
  • Not much learning curve since Silverlight Developers are already aware of C#,VB.NET and XAML with tools like Expression Blend etc. So they can easily upgrade themselves to Metro UI App Development.
  • Windows Phone 7.5 aka Mango coming up, Silverlight is the core Application Development platform on phone,So keep your Silverlight skills with you.

Silverlight on Windows 8, Metro Plug-in less browser and other stuff :

  • Agree and accepted that Silverlight does not work in “Metro IE” in Windows 8 but it does in Windows 8 Desktop mode and again Windows 8 is in preview stage and it will be too early to comment.
  • See the picture below : Silverlight is still there on those blocks


  • Visual Studio 11 do comes up with default project template for Silverlight, Check this out :


  • I tried running my current SL5 apps and they got executed successfully,see this :




Conclusion :

I wrote all this to just trigger positive thought process instead of just shouting and spreading death news of Silverlight. Some things I know you have in mind and which are not clear,but frankly for some of the things even I also don’t have answers and clear vision since this is all a preview platform.

Picture will be more clear when entire platform will go to Beta and then RTM mode.So till the time instead of wasting time in nonsense discussion..lets focus and new Metro UI App using XAML, New HTML5 + JS platform,New Visual Studio 2011 and .NET 4.5 and lets get some good hold on that before making final judgment on Silverlight’s future.

In some of the section above I may sound arrogant and away from subject, but intention of this post is to keep positive focus about platform and build healthy and non biased thought process.

So..Silverlight is dead ? Look back..Think again..Do analysis,spend some time on new platform and then jump to conclusion.

Remember ! Blogs,Forum comments or News blogs people does not deal with your actual client, They are not real decision maker. Its only you and you and you who will take a call on your App Development platform and for Silverlight..lets Microsoft decide on that..It will be better !


Wednesday, September 7, 2011

Silverlight 5 : Implement “Run” functionality using Platform Invoke (PInvoke)


I hope you like my last article on PInvoke feature introduced in Silverlight 5 RC. As I mentioned in my last post that I will be posting more and more advance demos of PInvoke in coming days.Well, Today I am going to show you that how you can build “Run” kind of functionality using PInvoke in Silverlight 5 RC,Not getting this idea? Here is “Run” in our Windows look like :


Something similar we are going to develop using PInvoke in terms of look and feel and functionality.Idea is to make use of Shell32.dll’s ShellExecute( ).

I kept UI similar to Windows “Run” for better understanding,It is not exact replica or replacement for Windows “Run”, Idea is to demonstrate the functionality of ShellExecute( ) so I am not trying to break any copyright stuff of original Windows OS.

As discussed in my last article here,following the same steps lets build this component.

Namespace :

using System.Runtime.InteropServices;

This is the primary namespace used to develop PInvoke apps.


<Image Source="Run.jpg" Height="42" Width="46" Canvas.Left="0" Canvas.Top="11" />
            <TextBlock Text="Type the name of Program,Folder,document,or Internet resource and Windows will open it for you." TextAlignment="Left" Height="44" Width="319" TextWrapping="Wrap" Canvas.Left="50" Canvas.Top="8" />
            <TextBlock Text="Open:" Height="20" Width="46" Canvas.Top="62" Canvas.Left="6" />
            <TextBox Height="23" HorizontalAlignment="Left" x:Name="txtValue" Width="311" Canvas.Left="50" Canvas.Top="62" />
            <Button x:Name="btnSubmit" Click="btnSubmit_Click" Content="Ok" Width="76" Height="22" Canvas.Left="50" Canvas.Top="100" d:LayoutOverrides="VerticalAlignment" />
            <Button x:Name="btnCancel" Click="btnCancel_Click"  Content="Cancel" Width="76" Height="22" Canvas.Left="150" Canvas.Top="100" d:LayoutOverrides="VerticalAlignment, Width" />

Note that like in Real “Run” box, I am skipping editable dropdown control and Browse button,Here I am taking Textbox to enter parameters and Ok and Cancel Button to handle the same.

UI will look like this after running :


C# Code :

public MainPage()
      App.Current.MainWindow.Title = "Run";            

#region Shell Execute

static extern IntPtr ShellExecute(
            IntPtr hwnd,
            string lpOperation,
            string lpFile,
            string lpParameters,
            string lpDirectory,
            ShowCommands nShowCmd);


private void btnSubmit_Click(object sender, RoutedEventArgs e)
           ShellExecute(System.IntPtr.Zero, "open", Convert.ToString(txtValue.Text), string.Empty, string.Empty, ShowCommands.SW_SHOWNOACTIVATE);

       private void btnCancel_Click(object sender, RoutedEventArgs e)
           if (App.Current.IsRunningOutOfBrowser)

Note that you need to build ShowCommands enum, for more information you can visit ShellExecute Documentation on MSDN here

txtValue does the job of taking parameters and passing to ShellExecute.

That’s it ! We are done with our own “Run” box build using Silverlight 5 RC P/Invoke Feature using Shell32.dll ‘s ShellExecute( )

OOB Settings :

Kindly refer my last post where I have given all information about setting trust and what kind of possible exceptions you might get.So read more over there.

Output :

Here are some screenshots I took with our Silverlight 5 based “Run” :

Calling Calculator,Command Prompt and MS Paint from our “Run” box


Visit my blog / any URL using our “Run” box ":


So if we compare Windows’s Run box and our in terms of we go !


Where this can be applicable in Real life applications ? :

Idea in this demo is to use ShellExecute( ) in Silverlight application,UI can be different or in different formatting.Core idea is to use ShellExecute( ) and make use of that using P/Invoke, Do you want me to share what can be done with ShellExecute( ) ? I know I don’t need to..there are lot of business scenarios where this can be used,For example : Open instances of Word,Excel,Powerpoint,MS Paint,Calculator as I have shown above, Run Command Prompt and run scripts etc.

So I hope you will like this sample once you build and run this. Let me know your feedback and I will soon going to post one more P/Invoke sample in coming weeks along with other good and fun stuff on Silverlight 5 RC and then few interesting things on Windows Phone 7 as well.


Saturday, September 3, 2011

Silverlight 5 : Platform Invoke (PInvoke) in Silverlight


Two days back Microsoft announced availability of Silverlight 5 RC,I encourage you to download bits from here, My friend Pete Brown already given very good information on Silverlight 5 RC here.

PInvoke (some type this as p/Invoke) that is Platform Invoke is most awaited feature in Silverlight since the announcement of Roadmap of Silverlight 5.

There are lot of talks in the community about Native HTML5 Apps using JavaScript,I am sure with this feature of PInvoke,Silverlight is now equally powerful player in App Development.

Why I kept above text in Bold? This is because there is lot of HTML5 talks around and sometime people unnecessarily without judging pulling Silverlight down for no good reason.For those who think we are Dead or we are just Animation technology..well by this feature you folks must have realize the potential of this Silverlight platform and where we are heading towards.

Coming back to PInvoke,So today to start with,I am putting forward a very simple and basic demo of PInvoke for you to understand and grab the topic and get hold of it.Then in next article I will be putting some advance samples and also in coming days I will be covering few more Silverlight 5 topics as well.

This demo is based on calling a “Beep” functionality from kernel32.dll file from Windows

If your fundas of PInvoke are not clear,In that case I encourage you to have a look at this article on Wikipedia which talks about PInvoke

Our First Silverlight PInvoke Demo :  Beep !!..Beep !!…

Namespace :

using System.Runtime.InteropServices;

This is the primary namespace used to develop PInvoke apps.


<Grid x:Name="LayoutRoot" Background="Black">
        <Image Source="Beep.jpg"/></Grid>

I just taken a Road Runner Image as name of the demo is Beep Beep

C# Code :

Now what we are going to do is that we will invoke Beep function which is a System Beep function from kernel32.dll

#region Beep Module
       [DllImport("kernel32.dll", SetLastError = true)]
       [return: MarshalAs(UnmanagedType.Bool)]
       static extern bool Beep(uint dwFreq, uint dwDuration);

[DllImport…] specified which dll file we are invoking.”SetLastError” is actually a Named Parameter in the signature which indicate whether the callee calls the SetLastError Win32 API function before returning from attribute method.

So we are all set to call Beep function from kernel32.dll in our Silverlight app like shown below :

public MainPage()
            this.Loaded += new RoutedEventHandler(MainPage_Loaded);

        void MainPage_Loaded(object sender, RoutedEventArgs e)
            for (uint i = 100; i <= 200; i=i+10)

Done ! We have just develop our first PInvoke Sample using Silverlight 5 RC !

Now turn on your speakers and get ready to hear Beep !! Beep !! from Road Runner ..I mean you will get some sound / default sound from system.If you want to change bits and duration then go ahead and feel free to tune the code.

Oh ! Wait ! What’s this error about? :


This is Runtime Exception because of lacking of trust,so you need to turn on that in OOB setting like this :


To know more on this Trust part I encourage you to read my friend Kunal’s article here.

Output : (Turn On the Speakers for Beep)


This ends our first ever PInvoke functionality using Silverlight 5 RC.I request you to download new RC bits and try out this demo,meanwhile I will prepare my next advance demo of PInvoke and other few articles.So with this PInvoke I can say again that ..Future is Bright ! Future is Silverlight !!


Wednesday, August 31, 2011

Silverlight 5 : Low-Latency Sound Effects


I just keep switching between Windows Phone and Silverlight and in office its WPF,so many technical flavors in a week I taste,Well today I am going to talk on Silverlight back again.Lot many features announced with Silverlight 5 beta.Few weeks back I did share few things with you like Text improvement and Window class etc. and I got very good response for that from all of you.Thanks for that.

Today I am going to talk on some interesting feature set of Low-Latency Sound Effects and how you can incorporate that inside your application.This feature is useful especially in Media and Entertainment related apps and bit away from actual Line of Business apps.For example, Gun shots,Game Over-Game Start sounds,Level change sounds,Notifications etc.For XNA developers who write games for Windows Phone 7 are in good position to understand this since there they use this SoundEffects heavily.

For this you need to take help of XNA library which will give you SoundEffect class,so you need Namespace :

using Microsoft.Xna.Framework.Audio;

Structure of SoundEffect class is like this :

public sealed class SoundEffect : IDisposable
        public SoundEffect(byte[] buffer, int sampleRate, AudioChannels channels);
        public SoundEffect(byte[] buffer, int offset, int count, int sampleRate, AudioChannels channels, int loopStart, int loopLength);

        public TimeSpan Duration { get; }
        public bool IsDisposed { get; }
        public static float MasterVolume { get; set; }

        public SoundEffectInstance CreateInstance();
        public void Dispose();
        public static SoundEffect FromStream(Stream stream);
        public static TimeSpan GetSampleDuration(int sizeInBytes, int sampleRate, AudioChannels channels);
        public static int GetSampleSizeInBytes(TimeSpan duration, int sampleRate, AudioChannels channels);
        public bool Play();
        public bool Play(float volume, float pitch, float pan);

Demo :

I am not a hardcore Game developer but being movie buff,I am putting one Horror Image and on loading of that I am playing some scary music and on clicking on that image some more sound effects will be played.So this is background of this demo,first let me share how it will look like, well its simple image of ghost and rest is game of sound effects.


*Note : Image used here is taken from internet and used here just for demo purpose,Image have its own respective copyrights.

Design :

For this demo you can use any design of your choice,I am just putting one scary image,I was actually planning to make some short movie with animations and change opacity etc, but I am leaving that creative part for you.


So I am just focusing on playing sound effect.

Namespace :

using Microsoft.Xna.Framework.Audio;

C# Code :

private void img_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
            var ScramStream = Application.GetResourceStream(new Uri("Shot.wav", UriKind.RelativeOrAbsolute));
            ScreamEffect = SoundEffect.FromStream(ScramStream.Stream);

This will load “Shot.wav” file and play the same once you click on that Image. Make sure that the “wav” file is PCM encoded file and falls between 22.5,48.5khz sample rate else your “wav” format will not get load and hence you will not have any sound effect.Also it should be 8 or 16 bit mono or stereo.

If you want to play effect and tweak the things then SoundEffectInstance will help you to do this.Sound.You can use properties like Pitch,Pan Volume etc.See code below, you will get idea how you can do things with SoundEffectInstance

SoundEffectInstance HorrorSound = ScreamEffect.CreateInstance();
HorrorSound.Pitch = 3.0f;
HorrorSound.Pan = 1.5f;

What you can do more is to put this code in Timer (Instance of DispatcherTimer) and play the same.If you want to dig further you can visit MSDN for more on SoundEffect Class here

So, This is all about the Low-Latency Sound Effect in Silverlight 5 beta.Soon I will share few more Multimedia related features in coming days and will try to cover remaining features of Silverlight 5 Beta in coming weeks on which I haven’t discuss anything here.Till then you can try this demo and let me know your feedback for the same.


Saturday, August 20, 2011

Silverlight for Windows Phone Toolkit for ‘Mango’ : Getting Started


After a long time rather after a month got some free time to look at this place.Horrible work at office as usual.Well,before I start posting some cool stuff on Windows Phone 7.1 and Silverlight 5 again.Lets get ready with tools again.

Microsoft announced Silverlight for Windows Phone Toolkit recently and its worth downloading since it is now revised with some bug fixes, smooth performance and decent controls by which you can build good quality apps for your Mango Platform aka WP 7.1

Name : Silverlight for Windows Phone Toolkit SDK 7.1 (“Mango”) August 2011

Downloads :

msi :

nuget :

Some new in this Toolkit :

  • ExpanderView - for building expanding and collapsing items
  • PhoneTextBox - for enhanced text box with action icon support, watermarking, etc.
  • DateTimePickers - for Date and Time into apps
  • HubTitle- for building animated and informative tiles
  • LockablePivots - for displaying current item only  usually used with multiple selection
  • MultiSelectList - for multiple selection with lists of data scenarios
  • LongListSelector - redesigned for Mango to give smooth scroll

Where to Report Bugs, feedback suggestions for this Toolkit ? :

So this is sufficient for you people to get ready with the tools and very soon I will start posting samples and quick demos on top of this toolkit.Not much break now and I will be back here soon.

Why I & this blog was on silent mode for last couple of weeks :

  • Done some presentations on Silverlight & Windows Phone 7 in community last month
  • Building some cool demos on Silverlight 5,Work in Progress

Some random snaps from my recent Silverlight & Windows Phone 7 sessions in community at Pune, India :

So folks, see you very soon with some good quality stuff on Silverlight 5 and Windows Phone 7.1 here,have a great week ahead !


Monday, July 4, 2011

I am Silverlight MVP and I am still here for Silverlight

I am Microsoft Most Valuable Professional (MVP) for Silverlight Year 2011-2012

This is my 4th time to won Microsoft MVP Award and 3rd time for Silverlight.On 1st July 2011 I got following Email from Microsoft MVP Award Program :


Things which I am doing from last few years made me MVP again :

I am doing Blog posts here for you and you only,I love this activity. Also I delivered few sessions on Silverlight and Windows Phone 7 in my local community,More you can see at my Public Microsoft MVP Profile here :

I keep on updating things on this portal as soon as I contribute something towards you, A log kind of thing you can say. This is helpful for me especially when I become lazy, It’s a wake up call for me and reminds me to drop all laziness and start working on again.

What went wrong for me in Year 2010 and early 2011 :

I recently rather now 4-5 months back went under 2 surgeries on my kidney,it was nothing critical health issue though but because of that there was some gap in my work and activities. It took almost 2-3 months to come things on track again.Hence during Early December to Mid March I was bit idle and isolated from technology, In month of April and May also I suffer from high fever for 2 weeks which again kept me away from Computer.

Well, I am very much thankful to my family,close friends and off course you people,my readers ! with your support from July 2010 I was able to come out of this unhealthy scenario and what I did from July 2010 to December 2010 given me big energy to contribute by which I was able to contribute again in last couple of months like from April to July 2011.

My MVP Lead Abhishek Kant is also a key person throughout my MVP awards from year 2008, without his guidance it was not possible to come to this stage and win MVP Award for 4 times in a row. Thanks to him as well.

Year 2010 was not easy ! Year 2011-2012 - Difficult life ahead, Be ready :

Beside my Health, there was loads of fumes and fire flames, Horrifying pain which cause due to that “Silverlight will not be focus” kind of announcement made by Microsoft. Growing giant of HTML5 not only kept me on fire but it was like a cold war. It was difficult time wherein most of my time went to define Silverlight and HTML5 and their capabilities to Customer, Now somehow I can see things coming to normal.

In India, Microsoft Windows Phone 7 ecosystem didn’t made any significant progress in terms of availability of Marketplace and overall development in year 2010. So I took decision and gamble a bit to focus also on Windows Phone 7 beside Silverlight. It worked well for me as Silverlight was mutual platform. I am very happy now that I did my best to initiate Windows Phone 7 moment from my end towards community at my best.

I am very clear with my role on Silverlight and HTML5 which I blogged recently here. With the rumors of HTML5 + JS will be one of the stake holders for developing Windows 8 Apps,Now its time to identify and define Role of Silverlight. Microsoft may define role of Silverlight after Build event but we must start defining role of Silverlight for our work from this very day.

Uncertainty is just next door,yes I am serious,See this post :

Sad and painful news but its truth, So you will never know where you will be next year !

We will be together for Silverlight Today,Tomorrow and in future :

As Microsoft MVP for Silverlight and as Silverlight Insider, I assure you all that I will give my best in year 2011-12 and I will try my best to spend more and more time in with you in terms of Blog posts, Code Samples and Videos.

Silverlight 5 and Windows Phone 7 will be my prime focus, but beside that there is a wild and crazy plan to start looking into HTML5 and WPF as well.

So thanks once again for all your love,feedback,support and wish you will continue the same in year 2011-12 as well.Keep visiting this place and keep me buzzing,I am here for you all the time for Silverlight.

Thanks once again and Keep our quote in mind always :

Future is Bright because future is Silverlight !!


Saturday, June 18, 2011

Prototyping Windows Phone 7 Applications using SketchFlow


I should actually say “Prototyping Windows Phone 7 / 7.1 Applications using SketchFlow” since let it be ver. 7 or 7.1, The way we are going to do prototyping will remain the same.

What is Prototyping and SketchFlow and why to use that? :

Those hardcore developers who are not involved in Designing phase of application usually not much aware of Prototyping and SketchFlow and power of both.Like we see Movie Trailer before actual Movie comes to Cinema Hall, There we get glimpse of Movie and what it will be all about. On the same line, SketchFlow which is the new way of doing Prototypes using Microsoft Expression Blend give glimpse of your application and how it will look like. So being a developer question may come to your mind that why we should use this? Well to answer you, I have already done a series on Prototyping and SketchFlow for Silverlight in past, Those articles will give you more better idea about these,so take some time out and visit those articles as well, you can find them below :

Part 1:

Part 2:

Part 3:

SketchFlow for Windows Phone :

When you install Expression Blend Designer for Windows Phone or Expression Blend in general you will not get any special or additional Project Template for SketchFlow which you usually get for Silverlight. So I am using the SketchFlow Project Template published on Codeplex site here :

Creating SketchFlow for your Windows Phone Application :

After installing you will find Windows Phone SketchFlow Project Template inside your Microsoft Expression Blend 4 instance like this :


Once you select this template, Then your design works start,To start with, You can pick few Mockups from Mockup option and also can make use of Controls in sketchflow like this :


For my demo, I am making use of Pivot Control and Pivot Item, you can always connect multiple screens to each other and navigate between them. Designer will look like this :


Once I took Pivot it was looking like this :


If you have multiple screens, you can always track them with the help of SketchFlow Map given with Expression Blend 4 SketchFlow,It will help you to give Macro view of your Design / Prototype, It looks like :


Once you are done with the Design you can Press F5 and Run that in Browser and it will look like this in your Browser :


Inside that, you have various options like Map,Feedback etc. You can give feedback like this :


If above things I mentioned looks difficult for you to understand, Take a look at 5 mins Video below which I have recorded via Microsoft Expression Encoder Screen Capture Utility (Check this post which will guide you how to use that utility)

Using SketchFlow for Windows Phone by Vikram Pendse–MVP Silverlight

The beauty of SketchFlow is that it allows you to export your project as “Word Document” So for that all you need to do is go to File->Export to MS Word option and you are done ! The word document generated by SketchFlow looks like this :



Well, That all today from me, Hope you like this post and I am sure you will try this out and make best use of the same in your Windows Phone 7 Projects. I am going for weekend Bike Ride and will back from there with great ideas for upcoming posts, Till that time you guys enjoy and try this out,See you soon.


Sunday, June 12, 2011

Mango : Using DeviceStatus in Windows Phone 7.1

First of all “Thank You” for your wonderful response and comments on my last article on Silverlight Vs HTML5 ,I hope you like the points I raised there and I will soon write more about it in future.Today I am going to share information on DeviceStatus API and how it helps to give more information about Windows Phone Device.

Information :

DeviceStatus is a static class and you can find the same in Microsoft.Phone.Info Namespace. DeviceStatus exposes bunch of static properties and two events of keyboard and powersource respectively. Properties are like below :

  • ApplicationCurrentMemoryUsage
  • ApplicationPeakMemoryUsage
  • DeviceFirmwareVersion
  • DeviceHardwareVersion
  • DeviceManufacturer
  • DeviceName
  • DeviceTotalMemory
  • PowerSource

and two more boolean properties with events I mentioned above.



I have taken TextBlocks to display information as shown above which I am assigning from Code Behind,So XAML will be like this :

<!--ContentPanel - place additional content here-->

        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">

            <TextBlock FontWeight="Bold" x:Name="txtApplicationCurrentMemoryUsage" Height="30" HorizontalAlignment="Left" Margin="0,62,0,0" VerticalAlignment="Top" Width="450" />

            <TextBlock FontWeight="Bold" x:Name="txtApplicationPeakMemoryUsage" Height="30" HorizontalAlignment="Left" Margin="0,118,0,0" VerticalAlignment="Top" Width="450" />

            <TextBlock FontWeight="Bold" x:Name="txtDeviceFirmwareVersion" Height="30" HorizontalAlignment="Left" Margin="0,172,0,0" VerticalAlignment="Top" Width="450" />

            <TextBlock FontWeight="Bold" x:Name="txtDeviceHardwareVersion" Height="30" HorizontalAlignment="Left" Margin="2,227,0,0" VerticalAlignment="Top" Width="450" />

            <TextBlock FontWeight="Bold" x:Name="txtDeviceManufacturer" Height="30" HorizontalAlignment="Left" Margin="0,281,0,0" VerticalAlignment="Top" Width="450" />

            <TextBlock FontWeight="Bold" x:Name="txtDeviceName" Height="30" HorizontalAlignment="Left" Margin="6,331,0,0" VerticalAlignment="Top" Width="450" />

            <TextBlock FontWeight="Bold" x:Name="txtDeviceTotalMemory" Height="30" HorizontalAlignment="Left" Margin="6,383,0,0" VerticalAlignment="Top" Width="450" />

            <TextBlock FontWeight="Bold" x:Name="txtPowerSource" Height="30" HorizontalAlignment="Left" Margin="6,435,0,0" VerticalAlignment="Top" Width="450" />


C# Code :

General Declaration :

DispatcherTimer dptm = new DispatcherTimer();

Constructor :

// Constructor
public MainPage()
    dptm.Interval = new TimeSpan(0, 0, 5);
    dptm.Tick += new EventHandler(dptm_Tick);
    this.Loaded += new RoutedEventHandler(MainPage_Loaded);

I have added DispatcherTimer just to get real time memory status and nothing else.

void dptm_Tick(object sender, EventArgs e)
     txtApplicationCurrentMemoryUsage.Text = "Application Current Memory Usage : " + Microsoft.Phone.Info.DeviceStatus.ApplicationCurrentMemoryUsage.ToString();
     txtApplicationPeakMemoryUsage.Text = "Application Peak Memory Usage : " + Microsoft.Phone.Info.DeviceStatus.ApplicationPeakMemoryUsage.ToString();

void MainPage_Loaded(object sender, RoutedEventArgs e)

public void WP7DeviceStatus()
     txtDeviceFirmwareVersion.Text = "Firmware Version : " + Microsoft.Phone.Info.DeviceStatus.DeviceFirmwareVersion.ToString();
     txtDeviceHardwareVersion.Text = "Hardware Version : " + Microsoft.Phone.Info.DeviceStatus.DeviceHardwareVersion.ToString();
     txtDeviceManufacturer.Text = "Manufacturer : " + Microsoft.Phone.Info.DeviceStatus.DeviceManufacturer.ToString();
     txtDeviceName.Text = "Device Name : " + Microsoft.Phone.Info.DeviceStatus.DeviceName.ToString();
     txtDeviceTotalMemory.Text = "Total Memory : " + Microsoft.Phone.Info.DeviceStatus.DeviceTotalMemory.ToString();
     txtPowerSource.Text = "Power Source : " + Microsoft.Phone.Info.DeviceStatus.PowerSource.ToString(); 

finally this will look like this on Device, As it is running on Emulator hence most of the information will be change after it goes on actual device.

Output :


Remember that its always good to notify user that your application is recording this information if at all your application is storing this information somewhere for some kind of analysis is getting perform on the same or using this data for application. Soon I will be posting full end to end application there I will be showing the exact use of this DeviceStatus.However I hope you will explore it and start using it in your Windows Phone application.As I shown above,it is very simple to implement. I am soon posting some advance tutorials on Mango in coming days. I don’t want to push to much which will create confusion for you, So I am posting basic articles to start with and then we will slowly go ahead at different higher levels.

So try out this API and I will be back soon with some more interesting demos on Mango, There is lot to show and talk on Mango and I am at background exploring lot many things,so keep visiting here as I will be posting some good stuff on Mango in coming days.


Tuesday, June 7, 2011

Silverlight, HTML5 & Windows 8 : Where we are heading to ?

This is not the post or yet another post on most happening debate of Silverlight and HTML5, This is just a visit to all of them to realize the potential in each and see what we can make best out of it.

I recently attended Microsoft MVP Open Day 2011 organized for South Asia in Microsoft IDC at Hyderabad, India. It was amazing to meet fellow MVPs and we had lot of learning and too much fun. During my visit, I met many glorious minds who are doing amazing stuff for Web and we had some discussions on this topic especially Silverlight and HTML5.By points raised in this discussion and overall stuff came out during my last year Communities and Customer interactions that I am going to put down for you.

Silverlight : Past,Present and Future

I have already posted about my thoughts on Silverlight Vs HTML5 here. Day by day situation is getting worst and confusing, So I thought to write this post actually. Initially even I was confused and frustrated about what happened in last PDC event. With recent Video which came up for Windows 8 added more fuel to the discussion of HTML5 and Silverlight. If you have not seen this video,please do once :

Building “Windows 8”–Video #1

After this video and when there was mention of HTML5 + JS, Fumes started coming up and people’s reactions and anger was spontaneous.


I saw some deadly thread on forums talking about the same, Check this.

What’s happening to Developers with this cold war of Silverlight & HTML5 :


With the Previews of HTML5 shown by Microsoft with IE9 and IE10 Platform preview and from other vendors, There is a great confusion among people that Microsoft is no longer focusing on Silverlight or they have stop investments on the same. We all agree that HTML5 came up with some jazzy stuff which can do better things with less lines of codes and without plugin.

There are so many things one can pick up for Web Development these days.

  • PHP
  • HTML5 + JS
  • Silverlight | RIA Services
  • Adobe Flash | Air

JQuery goes well with many of them. If you look at cost wise effective solution, HTML and PHP comes out as a natural choice, If you look at flexibility, Value added features and rich tooling then ASP.NET and Silverlight are good choice. So as far as Web Apps which will get into use via Browser, There is less confusion. For very rich apps either one can go for Silverlight or Flash depending upon the client requirement and business scenarios.

Advantages :

  • Silverlight comes here as Advantage due to its Out Of Browser capabilities along with similar availability from Flash/Air but they are clear winner over other languages.
  • With Rich Tools like Expression Studio and features like Sketch Flow, Overall experience is way better
  • Rich UI, Managed Code, Cross Browser and Cross Platform, Easy Development
  • Great Capabilities and features for designing and developing Line of Business applications.
  • Support with various new patters and frameworks like MVVM, MEF etc.
  • Sandbox Architecture, Secure and lightweight framework

Some Disadvantages : I am not biased here…

  • Plug-in based Architecture and dependent on Plug-in
  • Cost involved in Tooling
  • Not truly Cross Platform (See later section)
  • Limitations due to Size of Plug-in and CoreCLR functionalities
  • Learning Curve is bit high compare to HTML

Where exactly things are getting wrong ! :


  • From IE9 and IE10 Platform Previews, People assumed that Silverlight is near death.Reality : Silverlight 5 is announced with tons of new features,Currently its in Beta stage.
  • Microsoft created more Hype of HTML5 while showcasing IE9 and IE10 Preview.Reality: Yes ! Even I was confused that what they are exactly promoting Browser or HTML5 ? but the idea behind showing HTML5 is nothing but to showcase the Power of IE9 and 10 and how better they support HTML5,That’s it !
  • HTML5 will replace many things that Silverlight is capable of giving. Reality : Yes ! ..but Wait ! for some of the functionalities and stuff it will really be less effort,I mean what you do in 10 lines of Code in Silverlight,HTML5 might do it in 3-4 lines/Tags or vice versa !
  • HTML5 Standardization,OOB and LOB Apps capability.Reality : Till whatever little I heard of HTML5 and its capabilities, Nothing beats Silverlight here in first shot ! HTML5 may ease the overall process of Designing and Developing Business Apps, but the current feature set provided by Silverlight and RIA Services is far way Rich in all aspects.
  • Silverlight OOB Vs WPF. Reality : Both have 2 common things, XAML and C# that does not mean they are equal,One is .NET Framework of around 200+MB and one is CoreCLR of around 6MB, Should I tell more differences? I don’t think so ! WPF is more strong especially on Desktop Apps (XBAP Story we all know ! ), So Role of OOB is always different and it was never to compete or replace WPF
  • Availability on Tablets with upcoming Windows 8.Reality : Currently Microsoft is saying that you can design and develop Windows 8 Apps with HTML5 + JS (How they are going to give support to build native Windows apps using HTML5 + JS is also a puzzle for me) but during the course they never said that you cannot Design,Develop and Run Silverlight Apps on it or Silverlight is blocked or something. So let’s wait and let’s not waste time in thinking what will happen in near future, Since even if you think still you don’t know what will happen when.

Where HTML5 is getting ahead ?

  • There are set of people who do not want Plug-in based development for their own reasons
  • There are set of people (end users) who don’t wish to download any plug-in on their machines
  • There are set of people who do not wish to invest in heavy tooling and want to get things done quickly with less cost
  • HTML5 like its earlier versions runs smoothly in all browsers
  • HTML5 support is available in Visual Studio 2010
  • This is big one ! : You cannot view,read,watch Silverlight sites in Windows Phone 7’s IE Browser even after Mango Update but you can view,read and interact with HTML5 + JS pages on Windows Phone 7’s Browser.So if you develop Jazzy Silverlight Website and if your customer wish to view that on his Windows Phone 7..I have no words here !
  • Silverlight presence on Windows 8 is not clear to anyone since Windows 8 itself is in very early stage,even its pre-preview stage you can say,So it will not good to comment on that at this point of time.

My 0.02$ on this situation :

  • As I said in my earlier Silverlight Vs HTML5 post, Customer is King ! Understand his business,Understand his requirements, Match them with technologies you have and go ahead, No matter if you may have to adopt HTML5 if it comes out to be better solution.
  • If someone says in some event that HTML5 is future or we have change or shifted our focus that does not mean that Silverlight is dead after completing that statement. So keep your cool ! Microsoft Silverlight Team is working at their best (I am Silverlight MVP and Insider, So who else know better? :) )
  • Do not worry about Windows 8 and what will happen, focus on your current development. Even if Windows 8 comes to market, there will be still tons and millions of apps still running on Vista and Windows 7.Everyone in the world will not get Windows 8 Tablet on Day One !
  • Learn HTML5,See how you can combine HTML5 with JS and make simpler things more simpler and fast which might take time or painful to do in Silverlight.It will always add value to your Customer and you as well.
  • I don’t see any other option but HTML5 if you wish your Browser App to be visible and interactive in browser of Windows Phone 7,So bit hard decision for you here.

Lastly :

Keep faith ! Silverlight is going smoothly and has very good future and it will be shining on various fronts. Take wise decisions before jumping to HTML5 from Silverlight and vice-versa.Do not blindly follow anyone’s opinion (including me) about Silverlight and HTML5. Build PoCs for HTML5 and for Silverlight 5, See what and how best you can give your Customers and End Users. Don’t get confuse between HTML5 and Silverlight,Both are way different in behavior. Feel free to buzz Silverlight MVPs, Silverlight Forums, Local Community Experts if you need any advice on Silverlight or making choice between Silverlight and HTML5, We will always help you at our best and guide you without having any bias in mind.

Why I wrote this post ?

This post is not written because I have no content to write on Silverlight or Windows Phone 7,I will be doing the next Technical post soon.This post is not written to defend or promote Silverlight or HTML5. This post is just written to touch some reality and ground level issues which one should keep in mind instead of getting confuse by what is going on other forums,blogs and news.

This post is never final answer to that endless debate of Silverlight and HTML5 but I am sure it will always give you better views and basic points which are important in future for your decision making.

These points are not already recorded or guided by someone,These are all outcome of my community interaction and what I see,feel and interact with people for Silverlight and Windows Phone 7.

Hope you will think positively over this topic, Take part in Silverlight Vs HTML5 threads and discussions actively but learn out of it and do not get lost in that ! Do not let your Silverlight Weapon down ! Respect compete technologies, Learn HTML5 slowly (I might help you in that via this blog in near future),Take HTML5 change happening with world positively,Give your customer what is best  and make people happy !

Remember ! Future is Bright because Future is Silverlight !!


*Please note that Images and Video used in this post are from Internet found during regular search, Images have their respective copyrights and they are part of this post just for demo/representation purpose.

Friday, June 3, 2011

Mango : How to use RichTextBox in Windows Phone 7.1

Today I am going to talk about RichTextBox, I know you must be having lot of expectations from this RichTextBox. Here I will try my best to make you aware of what will work and what will not work in this short post for RichTextBox in Windows Phone 7.1

RichTextBox control is not new for Silverlightians, We have already seen amazing implementation of the same in Apps developed using Silverlight on top of RichTextBox Control.It is supported in Silverlight ver. 4 & 5 and now in Windows Phone 7.1

Use of RichTextBox is to display text in rich format which includes images and hyperlinks and also various styles of font,font family and sizes in formatted form. You can find RichTextBox control in System.Windows.dll, v2.0.50727 and you can invoke the same using Namespace System.Windows.Controls where RichTextBox Class is inherited from Control Class and it exposes various properties and events.

To add RichTextBox control on your design layout of your Windows Phone 7.1 you don’t need to add any extra references and stuff however you will find that RichTextBox though its part of System.Windows.Controls does not sit in Toolbox. So all you need to do is put a Container as StackPanel and hit Control + Space and pick RichTextBox from intellisense.

       <RichTextBox … />

It will look like this on your Designer inside Visual Studio :

rtbxdesignPlease make a kind note that there is no design support for RichTextBox in Windows Phone 7.1, Also no default style present so I used Static Resource, Firstly I fumbled a lot and saw that output was not coming on the phone.

Well, Before I move ahead please make note of this :

  • RichTextBox does not have Default Style
  • It is not part of your Toolbox but also you don’t need to add any extra references,you can find it in intellisense
  • It supports FlowDirect property so you can have RightToLeft and LeftToRight flow of text
  • However by default it is in ReadOnly mode so at the moment with current bits you cannot play with it beyond limit
  • Hyperlinks and Images can be part of content but since currently this control is in ReadOnly mode hence these features might not add value
  • Indic does not getting displayed thought with Mango core platform goes as Silverlight 4. Indic simply breaks..Sorry for my friends in India for this
  • Like Silverlight 5 Beta RichTextBox, It does not supporting any OverflowContentTarget so as to push text in next RichTextBox

Lets now see what all we can do with this :


      <RichTextBox x:Name="txtMyRTBx" ... >
      <Run FontFamily="Lucida Sans Unicode"
                春が来た 春が来た どこに来た
                山に来た 里に来た 野にも来た

                花が咲く 花が咲く どこに咲く
                山に咲く 里に咲く 野にも咲く

                鳥がなく 鳥がなく どこでなく
                山でなく 里でなく 野でもなく"/>

This will look like following on your emulator :


Kindly make note that though its Non English language here or symbolic that does not mean you cannot apply styles. You can very well make such text Bold,Italic and Underline.

To emphasize my bulleted point above about Language rendering capability and FlowDirection, here is a small piece of XAML to showcase Arabic text flowing from LeftToRight :


      <RichTextBox x:Name="txtMyRTBx" ... >
       <Run FontSize="24" FontFamily="Lucida Sans Unicode" 
         Text="مرحبا! أنا فيكرام من الهند وأنا أتعلم اللغة العربية" />    

and it will look like this on your emulator :


As I mentioned above that you can make Text as Bold Italic and even you can insert Hyperlink, for that here is a small piece of XAML to showcase that area :


      <RichTextBox x:Name="txtMyRTBx" ... >
          <Run FontFamily="Lucida Sans Unicode" Text=" Windows Phone Developer Tools 7.1 Beta makes significant strides forward, and enables you to build many classes of applications that were not previously possible. "/>
            <Bold Foreground="Yellow">I am Bold !</Bold>
                <Italic Foreground="Green">I am Italic ! </Italic>
                <Underline Foreground="Gold"> Its line under me !! </Underline>
    A first look at the new <Hyperlink NavigateUri="">"Windows 8"</Hyperlink> user interface.  

and it will look like this on your emulator :


No wonder that we can always play with it from Code behind, Well if you want to see XAML behind this in your app then you can also use snippet like this :

void MainPage_Loaded(object sender, RoutedEventArgs e)

This will show the Xaml piece of code on screen like this :


So that’s all I want to share on this topic at the moment,Being ReadOnly it pulls me back from lot of ideas but I am sure I will be putting up amazing and crazy samples in coming days, I don’t want to bombard you with <bold><italic> and <Underline> etc tags in the post so I pushed some language support in between which I hope you will like it very much. I know by looking at that language you will surely give try to your local language and build app on top of it. Go ahead and enjoy every bit of this control.

As I said above,I don’t want to waste your valuable time in small small snippets on <bold><italic> so if you still want to dig down on this, you can visit this MSDN Page where you will get all relevant stuff about usage of RichTextBox. So check that out, meanwhile I will go back and come here with some more cool stuff on Mango and Silverlight in coming week. So have a great weekend ahead with Mango and Silverlight 5 !


*Note : I used Translator tools for Arabic and Japanese demos here, I know Japanese because I learn that for 2 years but I do not know anyting about Arabic, So if you find the Arabic or Japanese Text in above demo irrelevant or not grammatically correct then please forgive me since its only used for demonstration purpose.