Window Support

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

Thursday, 19 March 2009

Silverlight 3 : Lap around Silverlight 3 Beta 1 : Part -1

Posted on 03:14 by Unknown

You must have seen my yesterday’s article about Silverlight 3, Now from today I am going to explore more on Silverlight 3, offcourse as and when required I may still blog on Silverlight 2 since it might take some time to move you directly on Silverlight 3.

Silverlight 3 Beta 1 SDK, Runtime and Tools for Visual Studio installation is very smooth, While installation, it does not ask me to uninstall my Silverlight 2, Small Conclusion I drawn : Silverlight 2 and 3 Beta 1 right now going parallel. I am looking into Architectural part and covered most of the Silverlight CoreCLR architecture in my last article, For Silverlight 3 Beta 1 I found some new things :

sllauncher.exe at Program Files\Microsoft Silverlight\3.0.40307.0 and SlSvcUtil.exe at Program Files\Microsoft SDKs\Silverlight\v3.0\Tools , I will talk about these in more details in my upcoming articles. One thing to note, Silverlight 3 Beta 1 and Blend 2 not going hand in hand, When I tried so, it shown me “Invalid XAML”.

Once you installed all Silverlight 3 Beta 1 components successfully, You can now start programming it in Visual Studio.

NewProjectSL3

“Silverlight Navigation Application” is new template you can see. Some controls you will also find new, check this out :

SL3Controls 

So, many more things to talk about..so I will cover all stuff part by part so you can learn->Implement->Enjoy !! Silverlight 3 exprience. So to start with some Practical thing I am touching the new 3D support aspect of Silverlight 3.

3D in Silverlight 3 Beta 1 :

Tools Require :

  • Silverlight 3 Beta 1 SDK
  • Silverlight 3 Beta 1 Tools for Visual Studio 2008 [Offcourse with SP of VS and .NET 3.5 Framework]

Step 1 : Open Visual Studio 2008, go to File->New->Project and then choose Silverlight Application

Step 2 : Let me first tell you, there is nothing like 3D control etc., 3D in silverlight is mainly achieve by “Plane Projection” class under System.Windows.Media namespace. [ System.Windows.dll Assembly and there is no mapped XMLNS for xaml ]

Xaml :

<Grid x:Name="LayoutRoot" Background="White">
       <StackPanel Height="200" Width="300" Background="IndianRed" x:Name="MyStack">
           <StackPanel.Projection>
               <PlaneProjection
                   RotationX="0"
                   RotationY="0"
                   RotationZ="0"
                   />
           </StackPanel.Projection>
           <MediaElement Source="Bear.wmv" Height="200" Width="200" />
       </StackPanel>
       <StackPanel Margin="10,40,0,0">
           <TextBlock Margin="230,0,0,0">X:</TextBlock>
           <Slider Margin="10,-20,0,0" x:Name="Slider1" Maximum="360" Minimum="-360" Width="300"  ValueChanged="Slider1_ValueChanged"/>
           <TextBlock Margin="230,10,0,-15">Y:</TextBlock>
           <Slider Margin="10,-5,0,10" x:Name="Slider2" Maximum="360" Minimum="-360" Width="300" ValueChanged="Slider2_ValueChanged" />
           <TextBlock Margin="230,0,10,0">Z:</TextBlock>
           <Slider Margin="10,-20,0,0" x:Name="Slider3" Maximum="360" Minimum="-360" Width="300" ValueChanged="Slider3_ValueChanged"/>
       </StackPanel>
   </Grid>

*Note : In Silverlight 3 Beta 1, you will find Page.xaml now as “MainPage.xaml” with corresponding code behind file. Rest all looks same as it was in Silverlight 2.

C# Code :

using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace SL_3D_Demo
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();          
        }

        private void Slider1_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            ((PlaneProjection)MyStack.Projection).RotationX = e.NewValue;
        }

        private void Slider2_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            ((PlaneProjection)MyStack.Projection).RotationY = e.NewValue;
        }

        private void Slider3_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            ((PlaneProjection)MyStack.Projection).RotationZ = e.NewValue;
        }
    }
}

Output :

Flip 3D

Something about Plane Projection :

Simple definition of Plane Projection given by Silverlight 3 docs is :

Represents a perspective transform (a 3-D-like effect) on an object.

Plane Projection Class gives you certain Methods and Properties, Plane Projection helps you to set orientation across X,Y and Z axis with properties like RotationX,Y and Z respectively and no wonder, all of them do take negative values. Basically now UIElement have property as Projection. You can even set the Center of Rotation with CenterOfRotationX,Y and Z property respectively. To know more details about Plane Projection, I encourage you to get hold of Silverlight 3 Beta 1 docs [chm file].

I know, few days back I spend many sleepless nights to get working that kit3D for implementing 3D in Silverlight 2, but I guess now we all should thank Microsoft for making this happen in Silverlight 3 and with great ease.

Hope by this small step towards Silverlight 3 must have given you idea what is the future of Silverlight Technology, many more things to come now, and yes as usual I will try my best to tell you those by making as simple as I can, so that you can start working on it. So go ahead and Download early bits of Silverlight 3 Beta 1, meanwhile I will get ready with my Part 2 of this Lap around article.

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)
      • Your Chance to Become Microsoft Most Valuable Prof...
      • Silverlight 3 : Master Pages implementation with N...
      • Silverlight 3 : DataForm control features – Part 3
      • Silverlight 3 : Explore Power of Blend 3 Preview –...
      • Silverlight 3 : Lap around Silverlight 3 Beta 1 :...
      • Silverlight 3 and Blend 3 is finally here…!!!
      • Start Windows…
      • 3D in Silverlight 2 with Kit3D
      • Lap Around ASP.NET Dynamic Data 4.0 Preview
    • ►  February (4)
    • ►  January (6)
  • ►  2008 (43)
    • ►  December (3)
    • ►  November (9)
    • ►  October (7)
    • ►  September (4)
    • ►  August (2)
    • ►  July (3)
    • ►  June (4)
    • ►  May (3)
    • ►  March (3)
    • ►  February (5)
Powered by Blogger.

About Me

Unknown
View my complete profile