March 2009 - Posts

Silverlight 3 allows you to apply 3D transformation to XAML elements.

I created a sample to try different settings (RotationX, CenterOfRotation, LocalOffset, …) on a picture.

PlaneProjection

Here is a basic sample to apply some rotations to a picture:

<StackPanel>
    <StackPanel.Projection>
        <PlaneProjection RotationX="10" RotationY="20" RotationZ="30"/>
    </StackPanel.Projection>
    <Image Source="Logo.png" />
</StackPanel>


This is also supported in Expression Blend:

Blend 3 Projection editor

The result:

Silverlight 3 Perspective 3D

Note you can apply 3D to any xaml objects like DataGrid or TextBox, and doing this user can still interact with them live!

Element-to-Element Binding

My sample do not use any code to apply 3D thanks to the new Element-to-Element Binding in Silverlight 3: you can link 2 elements declaratively.
I use this to bind my Sliders to each 3D properties (RotationX, RotationY, …). Here the Rotation value change while the user move the slider:

<Slider Value="{Binding RotationX, Mode=TwoWay, ElementName=projection}" Minimum="0" Maximum="360"/>

Dynamic XAML and OpenFileDialog

I also added the possibility to dynamically load XAML from a file. This is done via the OpenFileDialog control and the static Load() method of the XamlReader class.

private void LoadXAML()
{
    OpenFileDialog ofd = new OpenFileDialog();
    ofd.Multiselect = false;
    ofd.Filter = "XAML Files (*.xaml)|*.xaml";
    if (ofd.ShowDialog().Value)
    {
        string xaml = ofd.File.OpenText().ReadToEnd();
        UIElement elem = XamlReader.Load(xaml) as UIElement;
        contentPanel.Children.Clear();
        contentPanel.Children.Add(elem);
    }
}

Note any dynamically loaded XAML file should have the xmlns namespace declaration in it:

<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
   . . .
   . . .
   . . .
   . . .
</Canvas>


Sample ScreenCast

Download the code (Silverlight 3 beta)

Posted by pluginbaby | 1 comment(s)
Filed under:

You have to watch this, direct answer to the red polo buzz

Note the subtle "No Flash, no Flash!"...

 

Posted by pluginbaby | 2 comment(s)
Filed under: , ,

Wow my buddy Andy won first place at the MIX09 Show Off contest with an awesome video featuring his Physics Helper Library in Silverlight.

With the Physics Helper Library you can quickly add physics to your Silverlight apps. I have been using it for a while, it is very easy and integrate well with Expression Blend. Watch the video, so funny and informative!

Visit his website to learn more and try his physics samples and games.

Posted by pluginbaby | with no comments
Filed under:

MIX will come back in 2010, same city but different venue…

MIX10:
Mandalay Bay Hotel and Casino, 15-17 March 2010.

Posted by pluginbaby | with no comments

Silverlight Tour Quebec

For the first time the Silverlight Tour is coming to Québec city!
I’ll do this 3 days intensive Silverlight training in French so if you are interested act quickly as it is coming fast!!

  • When: April 01-03
  • Where: Québec, Qc
  • Registration (Fr): http://www.runatserver.com/SilverlightTraining.aspx
  • Technorati Tags:
    Posted by pluginbaby | with no comments

    As you may know you can set the EnableFrameRateCounter="true" property of the <asp:Silverlight> control to display the actual Silverlight framerate in the status bar of the browser.

    (You can also set the enableFramerateCounter param if you use the <object> tag or even enable it by code:

    Application.Current.Host.Settings.EnableFrameRateCounter = true;)

    But if nothing appears in your IE status bar you may have to change some security settings:

    In IE go to: Tools / Options / Security

    Select “Internet” zone and “Custom level…”
    In the “Settings” window go to the “Scripting” section and enable “Allow status bar updates via script”.

     ie-settings

    This has just been announced at MIX09 keynote, Silverlight 3 is available in beta and comes with new features very much business application oriented (as well as media and graphics improvements). Concerning application development improvements Silverlight 3 adds:

    • Navigation Framework
    • Deep links, SEO, browser history integration
    • DataGrid grouping, pagination
    • DomainDataSource (object data source on the client)
    • Element-to-Element Binding
    • Validators error template
    • New controls: DataForm (DetailsView like), DataPager
    • Multi-tier REST data support
    • Authentication

    With such new features, Silverlight 3 enable developers to build real LOB application, and what’s amazing is that Silverlight 3 is 40KB smaller than v2!

    Silverlight 3 is now (march 2009) in public beta (but no go-live) so you can try all this right now!

    Did you know that silverlight.net has some interesting whitepapers ?

    I suggest this one if you are interested in SEO (Search Engine Optimization) for Silverlight applications:
    > http://silverlight.net/learn/whitepapers/seo.aspx

    The article is a bit old but it shows some techniques (not all) on Silverlight SEO and it mention an online tool to get a search engine view of your website (so without Silverlight):
    > http://seo-browser.com

    If you are interested on the subject I also posted some links back in may 2008:

    http://weblogs.asp.net/lduveau/archive/2008/05/27/silverlight-accessibility-seo-and-flash-flex-comparison.aspx

    Posted by pluginbaby | 5 comment(s)
    Filed under: ,

    Silverlight Tour Paris

    The Silverlight Tour is coming back to Paris, France in 2 weeks!

  • When: April 01-03
  • Where: Paris, France
  • Registration (Fr): http://www.octo.com/com/com_formation-silverlight.html
  • If you are looking for 3 days of intensive Silverlight training in French this is your chance to learn it from soup to nuts!

    Posted by pluginbaby | with no comments
    Filed under:

    Very simple but I am often asked this during trainings:

    Get the URL to the current xap file:
        App.Current.Host.Source.AbsoluteUri

    Sample:
        http://www.myhost.com/ClientBin/SilverlightApplication1.xap

     

    Get the full URL of the page hosting the xap (with QueryStrings):
        HtmlPage.Document.DocumentUri.ToString()

    Sample:
        http://www.myhost.com/SilverlightApplication1.aspx?param=1

    Posted by pluginbaby | with no comments
    Filed under:
    More Posts Next page »