Friday, April 2, 2010

Silverlight at TechEd 2010 India .. See you there in Bangalore from 12th April 2010

After wonderful celebration of TechEd 2009 India at Hyderabad, Its time to pack your bags for another wonderful TechEd ! Yeah ! I am talking about TechEd 2010 India in Bangalore on 12,12 and 14th April 2010 :)

For more information about Venue and other Details, visit :

http://www.microsoftteched.in/default.aspx

Keynote :

soma

*Pictures taken from TechEd 2010 India Site for Blogging Purpose

What’s there for Silverlightians ??

Grand Sessions by :

Stephan

Sessions on Silverlight :

  • Building Applications with Silverlight 4.0 and WCF RIA Services – Stephen Forte
  • Exploring the Silverlight 4.0 Business Features – Stephen Forte
  • Microsoft Silverlight 4 Overview: What's in Store for Silverlight 4? - Praveen Srivatsa
  • Bring your data to life with Bing Maps Silverlight control – TBD
  • DLR integration in Silverlight - a next generation Capital Markets application - Priya Marwaha, Manish Agrawal

Sessions on Windows Phone :

  • Windows Phone 7 Application Development Overview - Sudeep Bharati
  • Building Windows Phone 7 Applications with Advanced Features - Vivek Dalvi

What am I going to do there ? :

Well, I will be there around for all three days and will appear on Community Sessions for a small talk, keep checking this for Stuff from MVPs :

http://www.microsoftteched.in/community_track.aspx

So, Don’t miss this event and I am looking ahead to meet you there, you can easily find me with my Silverlight MVP Badge :) I am excited to meet you all and would love to hear your feedback and all interesting things you are doing on Silverlight and Windows Phone too since very soon I am going to start talking here on Silverlight on Mobile too. So be there at TechEd 2010 India.

Vikram.

Sunday, March 28, 2010

Silverlight 4 : Indic Support in Silverlight

Hope you all folks doing well and enjoying every bit of Silverlight 4 RC, After hell lot of work in weekdays and over weekend, finally I managed to open my Live Writer today and hopefully will start buzzing here from coming weeks again like I use to in earlier months.

I have already given inputs on Language feature/Support from Silverlight in my earlier post while it was in Beta.In that article, I talked about, How you can enrich your Silverlight Application with Arabic and Hebrew language support from Silverlight and I also talked about BiDi (Bi-Directional) / RTL – Right to Left feature.

This is now a sort of extension to that article and primary focus will be how you can add up Indic content to your Silverlight Application.

For this I am making use of Microsoft Tool itself, Yes ! I am talking about Microsoft Indic Language Input Tool, Though this is in Beta version, still it performs and sufficient for our development.

ILITWebpage_Title_394x112

You can download the Indic pack for your language from here :

http://specials.msn.co.in/ilit/

Once you install this, you will get the option bar on your status like this :

Indic

Now all you need is open your Silverlight Project and you are Ready to Develop Indic Silverlight Application like this :

Bengic

Hindic

So this is how with Indic Tool you can simply enter Data. So assuming some commercial application,here it will look like this :

Multic

Happy? :) .. I know now you can load your apps with local language and being Indian I know the advantages too :), Well In our country (India) we have multiple languages and normally people speak more than two, So I guess this feature is unique to people of India.

This all looks good ! But what about Business applications??

Yeah ! A scary question ! But simple answer you can see below in Design + Code + Error handle. I am showing how it can be use in DataGrid if you are thinking about it from Business application point of View, check this out :

Design :

indicDesign

Code : Data Binding + Error Message

CodeCoverIndic

Output :

IndicOP

Data Entry At Runtime in Indic :

CropIndic

Error Messages :

Errorindic

So? I am sure you got all answers to your questions, rather more than that. Well So for Indic Development in Silverlight, All you need is your Basic Silverlight Skill + Either MS Indic Tool or any third party (I will prefer MS Indic Tool) and you are ready with Indic !

How it Works ??

Ah ! here comes Chapter 1 :) , well since I am writing this post as extension to earlier, Let me tell you how all this work.

  • Silverlight does not download fonts automatically.
  • It rely on font support on the system.
  • You can download your own fonts in the XAP for stylistic reasons.

So, Here is my first Indic attempt !

SLSarkar

Wait is Over..Start Silverlight..Start Indic..Talk in your regional language with Silverlight !

For this post, I am very much thankful towards Mr. Pavanja from India for taking this demand of Indic Support in Silverlight over Microsoft Connect and Thanks a ton to Team Silverlight for such a wonderful gift of Indic Support in Silverlight !

Vikram.

Friday, January 29, 2010

Silverlight 4 : COM Interop..Endless Opportunities

These days offline sessions keeping me very busy and because of that I am not able to come here frequently.Well, Today I am going bit ahead and will be talking about COM Interop capabilities with version 4 Beta with some small examples and few lines of code. Purpose of this article is to make you aware of COM Interop feature and how you can empower your Silverlight applications with this.

Why you need COM Interop?

We all know the limitations of each technology and upto what level customization and integration can be done. Sometimes it becomes difficult to address all business scenarios using one single technology, for something like this, COM Interop is case here. Its all about communicating among apps and making life more simple and real !

Power of Silverlight !

There are endless discussion going on about Silverlight and Flash,their comparison and future and lifespan too especially HTML 5 is somewhere around the corner. Well as a Silverlight MVP I can only tell you that..Silverlight is full of potential,innovation,creativity and ideas and future is Silverlight :)

Silverlight with COM Interop now gives you a highway where your Silverlight application can talk to other applications doing some or different function.

Have you ever imagined that your Silverlight Application is talking to MS Office? sounds crazy ? then look at few snippets below, how Silverlight 4 makes it very easy for you.

What you need for COM Interop in Silverlight ?

  • COM ( Necessary component should be present on system. e.g Speech SDK/API)
  • ComAutomationFactory API
  • System.Windows.Interop Namespace
  • “dynamic” keyword from C# 4.0
  • Handy COM Documentation

Anything else?

Capture

So, you have to set it via OOB settings, then only it is possible to execute since it runs with elevated trust aka elevated permissions/trusted application.

Any Problems I may face?

Well, did I tell you that “IntelliSense” will not work here in COM Interop? Shocked?..even I was first time. With ComAutomationFactory it allows you to play with COM but it will not give you all stuff like Members,Methods etc inside IntelliSense for a simple reason is since it falls in outside world. So we are helpless and should give up??

No, Documentation is always there ! (That’s what we Developer guys spend most of the time in our Life !), you need to refer documentation with that COM so as to get aware yourself about the various functional aspects of that COM.

How about checking those Trust and Permissions thing ?

A simple logic can be used like this so as to ensure it running under safe arena, like this :

if (App.Current.HasElevatedPermissions)
{ // Your code here }

Or

if (ComAutomationFactory.IsAvailable)
{ //Your code here }

Or

if (App.Current.InstallState == InstallState.Installed)
{ //Your code here }

These are the smart ways to ensure.

What is that “dynamic” keyword do?

If you are looking at definition of “dynamic” then it is like this :

 

Represents an object whose operations will be resolved at runtime

Via MSDN (http://msdn.microsoft.com/en-us/library/dd264736(VS.100).aspx)

 

Visual C# 2010 introduces a new type, dynamic. The type is a static type, but an object of type dynamic bypasses static type checking. In most cases, it functions like it has type object. At compile time, an element that is typed as dynamic is assumed to support any operation. Therefore, you do not have to be concerned about whether the object gets its value from a COM API, from a dynamic language such as IronPython, from the HTML Document Object Model (DOM), from reflection, or from somewhere else in the program. However, if the code is not valid, errors are caught at run time.

Any simple example for dummies like me?

Well, There are tons of example over net, I will show small snippets of 1 or 2 for Speech API and MS Word and Outlook interaction.

1. Text to Speech :

using System.Windows.Interop;

private void button1_Click(object sender, RoutedEventArgs e)
       {
           if (App.Current.HasElevatedPermissions)
           {
               dynamic _myspeech = ComAutomationFactory.CreateObject("Sapi.SpVoice");
               _myspeech.Volume = 100;                                      
               _myspeech.Speak(textBox1.Text);
           }
           else MessageBox.Show("Kindly install the application first and then try again !");
       }

2. Sending Text from Textbox to MS Word :

using System.Windows.Interop;

dynamic _myword = ComAutomationFactory.CreateObject("Word.Application");
            _myword .Visible = true;
            dynamic _mydoc = _myword .Documents.Add();

            string Insertxt = textBox1.Text;
            dynamic range = _mydoc.Range(0, 0);

            range.Text = Insertxt;

3. Interact with Outlook :

dynamic _myoutlook = ComAutomationFactory.CreateObject("Outlook.Application");
dynamic _mydraftmail = _myoutlook.CreateItem(0);

_mydraftmail.To = "abc@abc.com";
_mydraftmail.Subject = "COM Interop Demo using Silverlight!";

_mydraftmail.HTMLBody = "<P>My First Mail from COM Interop</P>";
_mydraftmail.Display();

I guess 3 example above are more than sufficient to showcase the richness of interaction of Silverlight with COM, Do I need to comment on where these can be used?..I know COM Interop with Silverlight brings endless ideas and opportunities..that’s what my title of today’s post.

Don’t forget to drop me feedback via example 3 :)

South Asia MVP Open Day 2010 last week at Microsoft India in Hyderabad, My job and overtime on weekends and Silverlight Sessions in User Groups kept me busy for a long and away from Silverlight and you, but now, things are normal and soon I will be hitting few more features of Silverlight 4 very soon.

Again, Focus will be on pushing concepts and not code..So get cup of coffee and come back here for more !

Vikram.

Sunday, December 27, 2009

Silverlight 4 : WebCam, Microphone and much more…

After a long time finally got some time to pen down few things here, Bad time from past few weeks since weekends also got occupied and saga may continue for coming week or two.

Well, don’t want to waste this free time today, so started looking at Silverlight 4 again, Last time I broke my head over Bidi-RTL feature of silverlight where I shown demo(s) on how you can do arabic language integration etc. I hope that post was useful for you. Today I am going to discuss in short and to specific point on the WebCam and Microphone integration inside Silverlight application and possibilities because of that. All you need is good quality WebCam (maybe external or integrated inside your laptop) along with Microphone.

Code is very simple and you can implement it directly, there is no great learning as far as code is concern, but there are few things to be understood so as to use this functionality at best. Today we have following UI with us :

InitialScreen

Today, I was playing with friend’s iPhone, I saw iPhone first time, It is good, and overall feel is also good, So I decided to use this as UI of our today’s POC, well frankly the code and discussion we are doing today has nothing to do with iPhone, so don’t get confuse,This iPhone UI is just to do something different that’s it,It has nothing to do with iPhone. we are just using this is as UI (Don’t even spend your valuable time in thinking :) ), Observe carefully that I have 4 buttons (Image Control) on bottom side as :

ScanDevice For Scan Devices

StartCam For Starting Camera

StopCam For Stopping Camera

TakePic For Capturing Snap/ Take a Snap

(All Images I got from internet while surfing, they carries their respective copyrights and owners,I am just using them for demos)

Scan for Devices :

It is important to detect the Audio and Video devices with the system, so as to use them further for capture. One simple way to identify is just right click and hit Silverlight option and then navigate to “WebCam/Mic” tab, you will get following screen :

Capture

We are doing this job via C# code and making use of Child window. I got one child window with me where I am showing Available Devices inside listbox as follows :

ScanDevices

To display such list, I have written following piece of C# code :

void Devices_Loaded(object sender, RoutedEventArgs e)
        {
            ddlVoice.ItemsSource = CaptureDeviceConfiguration.GetAvailableAudioCaptureDevices();
            ddlVideo.ItemsSource = CaptureDeviceConfiguration.GetAvailableVideoCaptureDevices();           
        }

Where ddlVoice and ddlVideo are my list for showing Collection of Audio and Video devices, Point to note here is that, GetAvailableAudioCaptureDevices() and GetAvailableVideoCaptureDevices() will return collection which can be bind to specific control. I can very well send values from Child Window to main page, but right now I am not giving stress on that functionality.

To call this popup, I wrote following C# inside my Image MouseLeftButton down event :

private void btnScan_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
          {
            Devices dv = new Devices();
            dv.Show();
          }

Start Camera :

Once I hit start camera, My default Video device should be in game. Well I can pick if I got many from collection which we talked about in above section of scanning devices. Right now I am not connecting my child window here, so I will go for default one like this :

private void btnStart_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
          {
              if (m_Camera != null)
            {
                m_Camera.Stop();

                VideoCaptureDevice vdo = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice();
                m_Camera.VideoCaptureDevice = vdo;
                VideoBrush vidBrush = new VideoBrush();
                vidBrush.SetSource(m_Camera);
                WebCamViewer.Fill = vidBrush;

                if (CaptureDeviceConfiguration.AllowedDeviceAccess || CaptureDeviceConfiguration.RequestDeviceAccess())
                {
                    m_Camera.Start();
                }
            }
          }

So what is this m_Camera?? , Well this is a member declared as :

CaptureSource m_Camera;

CaptureSource Class provides methods for specific Audio/Video capture devices (Refer more in Silverlight documentation)

WebCamViewer is simple rectangle declared in XAML like this :

<Rectangle x:Name="WebCamViewer" Height="214" VerticalAlignment="Top" Width="200" />

GetDefaultVideoCaptureDevice() will allow you to capture default WebCam with System, Make note that, in case of multiple,its your job to choose correct one from collection (Do I need to tell how? :) ), Like other brushes, we have VideoBrush here which will help us to fill the captured output inside rectangle.

  if (CaptureDeviceConfiguration.AllowedDeviceAccess || CaptureDeviceConfiguration.RequestDeviceAccess())
             { //Some Code..}

Many smart people will raise this question here, what is this and/or what if I ignore this? , Well this will allow access to use the specific devices which you seek via RequestDeviceAccess() and if at all you ignore this block thinking like you are using this one as “Spy Cam”..well your attempts will fail and you will get following screen :)

deny

When all goes well, It will prompt you with typical Yes/No box like this :

Permission

Once you press “Yes” (Take the Red Pill and enter..Alice in Wonderland..Matrix movie ;-) ), you can see output like this :

StartVideo

Done !! :)

Stopping Camera :

To stop camera, you don’t need to do much beside this one liner C# :

private void btnStop_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
          {
               if (m_Camera != null)
              {
                  m_Camera.Stop();
              }
          }

Take a Snap ! :

It will be useless application if it does not allow you to take snap, so let’s take snap ! ( Folks, There are few damm good articles written by wonderful people like you and few of my MVP friends who have done nice things like Video recording and Applying Effects to images etc. Do check those articles too), Now you need a lambda as :

private void btnTakePic_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
          {
                if (m_Camera != null)
              {
                   m_Camera.AsyncCaptureImage((snapImage) =>
                  {
                      PhotoCam.Visibility = System.Windows.Visibility.Visible;
                      PhotoCam.Source = snapImage;
                      WebCamViewer.Visibility = System.Windows.Visibility.Collapsed;                     
                  });
              }
          }

Note that, AsycnCaptureImage() takes WritableBitmap as param, we are then assigning that to our Image Control PhotoCam declared in XAML as :

<Image x:Name="PhotoCam" Margin="191,115,199,196" Width="200" Height="214"/>

and we are just doing normal on/off of WebCamViewer which is our rectangle where we first started rendering, is now replaced by our Image, You can do twists and tricks here by your own imagination and get that output image in some viewbox etc. Well finally it will look like this :

StopandCapture

So this is how you can integrate your Audio/Video devices smoothly inside silverlight which is new feature with Version 4 Beta. Possibilities with this feature are endless and many applications can be build on top of this, All you need is Imagination ! :) , Sayonara ! I will hit back here very soon with Printing and HTML hosting features and much more..with much more out of the box UI like we have today ..Muhaa haaa ! :D

Vikram.

Saturday, November 28, 2009

Silverlight 4 : Crossing Language barriers aka BiDiRTL

I have already talked about launch of Silverlight 4 Beta in my last article. We all jumped on new Silverlight 4 Beta bits and I am sure you all must be ready to build next generation web applications.

Silverlight 4 ( We all know its in Beta, so I will not use the word “Beta” again) like its older versions from version 2,3, Supports multiple languages,confused? I am talking about C#,VB.NET,IronRuby etc. which can be use to develop Silverlight applications.

But this post is not about those languages, This post is about the language which we use to communicate. A great news for people who speak “Arabic” language. Silverlight 4 not only helps you to render your content but also now you can right it the way you want, mean to say, you have now “FlowDirection” attribute with which you can write your Arabic Text from Right to Left (A buzz word for above is BiDiRTL support). All you need is just set the FlowDirection attribute and you are done ! Don’t believe what I am saying? Ok, see this :

Bidi1 More clear you can see :

Bidi2

I do not speak Arabic,but I got it translated via “Bing Translator” (You are free to blame Translator if some mistakes are there :) )

Source Code ? Too Simple ! :

Bidi3

As you can see, For this Arabic language, I am not taking any help of Culture Class,Globalization-Localization or any other resource or xml, Simply I have copied the text and pasted in my designer.

For my Arabic friends, If you guys want to shift your complete portal into Silverlight with Arabic support, you can set “FlowDirection” attribute as “RightToLeft” to your UserControl directly, if you want some part as LeftToRight or RightToLeft then offcourse you can override anywhere by reseting FlowDirection attribute. So all you need is Language skill and FlowDirection attribute as and when required. There are so many languages in world which are different in tone and different when it comes to writing, Script I mean to say. I spend my 2 years in college to learn Japanese (“Sankyu” level they say), I find it bit difficult to write especially “Kanji”, I given try for Japanese with this methodology and it worked like charm !

---------------------------------------------------------------

A humble request to Microsoft :

A Complex Japanese script renders well in Silverlight 4 Beta RichTextArea control, but when tried, It fails to render any Indian language like Devnagari Scripts, We know that it does not support Devnagari script like Arabic or Japanese but please consider this as “Feedback” and really looking ahead for Hindi and other India Languages support for Silverlight in future. Attempt made to render but it fails like this :

Bidi4 You can see that it easily renders Katakana and Hiragana,Also render Arabic well, but when Devnagari Script is pasted,It just shows those alien blocks :(

Out of 1 billion Internet population in India, around 66% of people used to with Hindi and Devnagari script (approx)

---------------------------------------------------------------

Well, coming back to our discussion, So till the time you must have realize that there is nothing special skill require to implement this feature of Silverlight 4, Now its your call to use it wisely in your business applications. you can initially try with sample POCs or implementing this into your static content web pages. A must try out feature.

How can I keep my mouth shut without shouting about data binding and that too with my all time favorite DataGrid Control ? I finally given a try to push this feature in DataGrid, Believe me, Results are more than expected ! It rocks !! All you need is declare a class with some properties and just bind it like we do normally in our loaded += event like this :

public class sigheads
       {
           [Required(ErrorMessage = "Field Cannot be left Blank")]
           public string FirstName { get; set; }
           [Range(0, 999, ErrorMessage = "Invalid Age")]
           public int Age { get; set; }
           [RegularExpression(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Invalid E-Mail ID")]
           public string Email { get; set; }
           public string Job { get; set; }
       }

Now write one method GetSIGHeads() like this :

public List<sigheads> GetSIGHeads()
       {
           List<sigheads> sglst = new List<sigheads>();

           sglst.Add(new sigheads() { FirstName = "فيكرام", Age = 27, Email = "vikram@dotnetcoe.com", Job = "مطور برمجيات" });
           sglst.Add(new sigheads() { FirstName = "أنيل", Age = 40, Email = "anil@dotnetcoe.com", Job = "إدارة المشروع" });
           sglst.Add(new sigheads() { FirstName = "حيدر", Age = 28, Email = "haider@dotnetcoe.com", Job = "نائب الرئيس" });
           sglst.Add(new sigheads() { FirstName = "أحمد", Age = 27, Email = "ahmed@dotnetcoe.com", Job = "مدير قاعدة البيانات" });
           return sglst;
       }

Point to make a note : I have hardcoded some values to my properties, In real situation, Data will be coming from Database (I am talking to few experts for this scenario especially in Silverlight, So may be in my coming articles, I could drop more light on the same)

Next step is bind this to grid and hit F5 and run for glass of Beer since you are going to see desired output on your screen :)

Bidi5

Happy ? I can see a bright smile on your face already ! :)

So I hope you like this article, As I told you, initially we will understand the concepts and features of these new bits and then we will hit hard as usual.

Moral of the Story : Arabic and other few languages now can easily get rendered inside your webpage,kudos to Team Silverlight for giving this feature, a milestone I should say.

Your valuable feedback is most welcome, Also, due to day to day boring life of 8hrs work, sometime it is not possible to do lot of research, so if anyone given try for Indian language and worked for them with these Silverlight 4 bits, do let me know, I will love to learn from you.

Vikram.

Monday, November 23, 2009

Silverlight 4 : A long term player

Well, I still not came out of those glorious demos of Silverlight 4 Beta shown by Scott Gu on eve of PDC09..My mind is still in that 2nd Day keynote at PDC..Wow !! Microsoft and Team Silverlight made it !!

Silverlight_Logo

You all must be wondering why this place is still silent despite Silverlight 4 Beta announced 2-3 days back, Nothing like that. I am already getting ready to give you lot of good stuff over next couple of weeks.I do blog about Silverlight with demos which I feel that you can use in your day to day business apps. Last time while Silverlight 3 Beta was announced, I wrote full series of articles. This time I am planning to put more concepts than code, Offcourse working code will be there in article, but main discussion will be around the actual practical application of features introduced in Silverlight 4.

Till the time I start filling my Silverlight 4 Beta articles here, A good thing will be to download environment and get ready to see the future !

A good place to visit : http://silverlight.net/getstarted/silverlight-4-beta/#tools

Here are few highlighted features of Silverlight 4 Beta in nutshell :

  • Out of Browser Applications - Elevated Privileges Support,COM interop
  • HTML Hosting Support
  • WebCam/Mic Support (raw stream only)
  • Printing Support
  • Notification aka “Toast” API
  • RichTextBox,Arabic and Hebrew Text Support
  • MouseWheel Support on ScrollViewer, TextBox, ComboBox, Calendar, DatePicker
  • DataBinding Support for DependencyObjects,IDataErrorInfo Support,StringFormat, TargetNullValue & FallBackValue Properties on Binding,IEditableCollectionView and Grouping support on CollectionViewSource
  • Astoria 2.0 Support,MEF
  • Expose Runtime Version to 3rd Party DLLs
  • NGEN Support for Core Runtime Binaries

iPhone Streaming now available : http://www.iis.net/iPhone

Silverlight Media Framework : http://smf.codeplex.com/

So out of this Treasure Box what we are going to discuss here? Well, I will touch upon highlighted features like Printing,WebCam/Mic Support, HTML Hosting,RichTextBox and our all time happening discussion here..DataGrid :)

So take a long breath and get ready for yet another drive with Silverlight..Silverlight 4 (Beta)..A long term player in world of RIA/Web..Way to go !! :)

Vikram.

Wednesday, November 11, 2009

Bing Maps Silverlight Control .. Wait for Map Control is over !

Hello everyone, hope you enjoying Silverlight and Expression Studio all the time. Well, For a long from Silverlight 2 onwards,we all are waiting for Map Control in Silverlight, Till the time we had DeepEarth Project and various other third party stuff, But now I am happy to share that we now have our own Map Control for our applications, Its free and very much simple to use. Just to give all control in your hand to allow you to explore, I am giving all information in very short manner..A quick review you can say.

Yes ! Bing Maps Silverlight Control is now available. So what you need?

1. Silverlight 3 Setup + Visual Studio and Expression Blend (Expression is optional) (Sorry to say..But with Silverlight 2 it might not work..document says so)

2. Bing Maps Silverlight Control : You can download it from here :

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=beb29d27-6f0c-494f-b028-1e0e3187e830

3. You need to have account with : (Live ID is must)

https://www.bingmapsportal.com/

Once you install Bing Maps Silverlight Control, It will show you CHM file (If you really read that CHM carefully, you don’t need to read rest of my post,but please don’t do so :) ). All information is there in place with all necessary code snippets.

Now your job is to take normal Silverlight Application Project Template. Add Reference to your Silverlight Project to following dlls :

1. Microsoft.Maps.MapControl.Common.dll

2. Microsoft.Maps.MapControl.dll

You will find them usually under Program Files -> Bing Maps Silverlight Control -> V1-> Libraries

Then you need to set reference like this in your XAML file :

xmlns:BingMap="clr-namespace:Microsoft.Maps.MapControl;assembly=Microsoft.Maps.MapControl"

Then you need to write following XAML :

<BingMap:Map CredentialsProvider="Your Key Here"/>

Wait !..One step is mandetory before this, First you need to create Account with https://www.bingmapsportal.com/

You will get following UI once you perform login :

Capture

Well, you can see 3 options there :

1. Create an account : You need to enroll your self (Typical “I Agree all the terms” kind of stuff :D )

2. Create or View Keys : This is something similar to Silverlight Live Streaming account procedure, you need to give some name to your application and URL where you want this etc. For testing purpose you can give any URL (Specific URL is recommended though)

3. Update or View Account Details : Typical Account information.

Below these three you can find links to SDK and Blogs and forums which talk about Bing Map Control. (Ajax Control is also there beside Silverlight, My ASP.NET friends should give try for that too)

Then now come back to Visual Studio, Inside your app now, Place that key to “CredentialsProvider” and you done. Now you will see the Control on your designer like this :

Bing1

This even opens in Blend, If at all you want to place some design around it :

BlendBing

Control as such will not expose any properties which you can set-reset in Property windows, you need to play with XAML and C# Code.Now after all this just play with it by pressing F5 and you can see the output like this : (For this simple Hello World kind of example, there is no C# code, but once you start digging inside this control and Maps, you need to play with C#)

OutputBing

Not satisfied?? Want to have more stuff?..Want to handle its events? Want to place Videos,Images on it??..well you can do it easily by just few line of code !..No I am not taking that small pain..you can simply refer CHM along with it, For those CHM word does not make sense, it looks like this :

BingCHM

So, Now let it be your ASP.NET or HTML Page, Mapping with Bing Map Control will add value to your application and more important is that, Its Bing and its free..Bing Bing Bingo !! :)

Hope you like this post, I kept this small since this is very exciting and I don’t want to kill your excitement, Still if you feel I should drop some code snippets here, feel free to talk with me, Will then go for some more apps or another in depth post,Keep visiting here since very soon lot more new stuff is on your way !

Vikram.