Window Support

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Saturday, 27 September 2008

Lap around Silverlight 2 RC

Posted on 22:43 by Unknown

Well, I am getting addict to Silverlight these days, don’t know why but it keep pulling me away from my main domain ASP.NET.

Yesterday I spend my whole day on Silverlight, since Friday went in just reading news about upcoming Pre-beta release of Windows 7 at PDC and release of Silverlight 2 RC.

So we have to welcome 3 new members to our Silverlight team :)

1.Password Box  2. Combo Box  and  3. ProgressBar

Well, what amaze me is to have separate control as “PasswordBox”, it could have been say TextBox having two properties as Type and Password char like we have for Server control TextBox in ASP.NET, well since I am small developer Pune..who gonna listen me.. :)

XAML declaration of these 3 fellow friends looks like :

<PasswordBox x:Name="Pwd" Height="20" Width="100" />

<ComboBox x:Name="cmbUGLeads" DisplayMemberPath="FirstName" Height="20" Width="150" />

<ProgressBar x:Name="Prgs" BorderBrush="Azure" Height="20" Width="100" SmallChange="1" Value="0" >

SL2RCDemo2

Well don’t get stunned by “DisplayMemberPath” property in ComboBox, this is use to bind the data to ComboBox.Rest for ProgressBar and PasswordBar all the properties are same that we use to have in ASP.NET controls.

What I observe yesterday while installing Silverlight 2 RC is smooth hassle free installation without any demands from user except it ask to close your all browser instances.[Big Thanks to Microsoft for this !], well for my friends who are in love of doing things in Blend, they need to install Blend 2.0 with SP so you need to say good bye to Blend 2.5 preview for a while.

Here is small demo which loads media element in combobox at runtime and offcourse media element is also getting generated at runtime.

XAML Code for this :

<Grid x:Name="LayoutRoot" Background="White">

        <ComboBox x:Name="cmbUGLeads" Height="20" Width="150" />     

</Grid>

C# Code for this :

public SLRCDemo()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(SLRCDemo_Loaded);
        }

        void SLRCDemo_Loaded(object sender, RoutedEventArgs e)
        {
            GetMedia();
        }

        public void GetMedia()
        {
            MediaElement med1 = new MediaElement();
            med1.Source = new Uri("/Video01.wmv", UriKind.Relative);
            med1.AutoPlay = true;
            med1.Height = 50;
            med1.Width = 50;
            med1.Play();

            MediaElement med2 = new MediaElement();
            med2.Source = new Uri("/Video02.wmv", UriKind.Relative);
            med2.AutoPlay = true;
            med2.Height = 50;
            med2.Width = 50;
            med2.Play();

            cmbUGLeads.Items.Add(med1);
            cmbUGLeads.Items.Add(med2);

        }

And output will be 2 nice videos in your Combo once you click on ComboBox.

SL2RCDemo

Well, Another demo I created from ScottGu’s Blog [ He is really a Guru in Web Technologies like ASP.NET and MVC], This is using List<> and bind to Combo, here you can see I am making use of “DisplayMemberPath”, well code for this demo, simple thing you just need one class and few properties and you are done with it.

XAML Code :

<Grid x:Name="LayoutRoot" Background="White">
        <ComboBox x:Name="cmbUGLeads" DisplayMemberPath="FirstName" Height="20" Width="150" />
</Grid>

C# Code : [*Note : this.Loaded will work like Page_Load in ASP.NET]

public SLRCDemo()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(SLRCDemo_Loaded);
        }
        void SLRCDemo_Loaded(object sender, RoutedEventArgs e)
        {
            GetUGLeads();
        }

        public void GetUGLeads()
        {
            List<UGLeads> Leads = new List<UGLeads>();
            Leads.Add(new UGLeads() { FirstName = "Vikram", LastName = "Pendse" });
            Leads.Add(new UGLeads() { FirstName = "Mayur", LastName = "Tendulkar" });
            Leads.Add(new UGLeads() { FirstName = "Mahesh", LastName = "Mitkari" });
            Leads.Add(new UGLeads() { FirstName = "Sarang", LastName = "Datye" });
            cmbUGLeads.ItemsSource = Leads;
         }
    }

public class UGLeads
    {
        public string FirstName { get; set; }
        public string LastName { get; set; }
    }

So, Hope rather I am sure now will go ahead and download Silverlight 2 RC and start building great applications.Meanwhile let me complete another interesting demo on media element and Ink, I will soon post them here but they are in Silverlight 2 beta 2.

Vikram.

Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • First Windows Phone 7 update February 2011 - Small update but Big start
    After tons of rumors and set of predictions on Windows Phone 7 all over Internet, Microsoft came up with first Windows Phone 7 minor update ...
  • The little Story of “I Unlock Joy” event by Microsoft and Pune User Group
      This post is about recent “I Unlock Joy” event happened in Pune which was conducted by Microsoft and Pune User Group. Little History : ...
  • Silverlight On Mobile : Windows Phone 7 Splash Screen and Customization
    After talking about 3D capabilities on Windows Phone 7 using Silverlight in last article , Now I am moving ahead with small but equally impo...
  • 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 alr...
  • Introduction to Speech Capabilities in Windows Phone 8 – Part 1
    After a long..I am writing blog, I hope and I wish I will resume blogging like I use to in past. Lots of things happened in past few months....
  • MCTS : Microsoft Silverlight 4 Development Exam Guide (70-506) by Packt Publishing
      Hello, After a long time I got chance to come back here.I will soon resume blogging in month of August. Last 4-5 months were horrible due...
  • Introduction to Speech Capabilities in Windows Phone 8 – Part 2
    Hope you enjoyed my last article on Speech Capability in Windows Phone 8, Today I am posting another part or you can say little extension t...
  • Silverlight 3 : Insert & Update Data using WCF Service with DataForm and DataGrid
    In my Lap around Silverlight 3 series, I have written a separate article on DataForm in Silverlight 3, This article is a basic extension to ...
  • 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 ...
  • 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 t...

Blog Archive

  • ►  2013 (4)
    • ►  August (1)
    • ►  April (3)
  • ►  2012 (4)
    • ►  July (1)
    • ►  March (2)
    • ►  January (1)
  • ►  2011 (24)
    • ►  December (1)
    • ►  September (4)
    • ►  August (2)
    • ►  July (1)
    • ►  June (4)
    • ►  May (3)
    • ►  April (3)
    • ►  March (1)
    • ►  February (4)
    • ►  January (1)
  • ►  2010 (21)
    • ►  December (1)
    • ►  November (2)
    • ►  October (3)
    • ►  September (2)
    • ►  August (4)
    • ►  July (5)
    • ►  May (1)
    • ►  April (1)
    • ►  March (1)
    • ►  January (1)
  • ►  2009 (49)
    • ►  December (1)
    • ►  November (5)
    • ►  October (2)
    • ►  September (1)
    • ►  August (5)
    • ►  July (5)
    • ►  June (1)
    • ►  May (5)
    • ►  April (5)
    • ►  March (9)
    • ►  February (4)
    • ►  January (6)
  • ▼  2008 (43)
    • ►  December (3)
    • ►  November (9)
    • ►  October (7)
    • ▼  September (4)
      • “Rosario” = Visual Studio 2010 + .NET 4.0
      • Lap around Silverlight 2 RC
      • Dynamic Data Web Application with ASP.NET 3.5
      • Desklighter : Silverlight on Desktop as Windows Ap...
    • ►  August (2)
    • ►  July (3)
    • ►  June (4)
    • ►  May (3)
    • ►  March (3)
    • ►  February (5)
Powered by Blogger.

About Me

Unknown
View my complete profile