First Application
Last post 08-11-2007 5:37 PM by Patience. 4 replies.
Sort Posts:
08-11-2007 2:26 PM
Email [E]First Application

Hi,

I'm Patience. I was wondering if anyone could give me a quick summary of what I have to do to create a website that uses Silverlight 1.0 RC. I've already downloaded and installed it, but I don't want to use Blend 2 August Preview, due to the fact that if I use it and deploy what I've made, I have to put up a note which says that the website was created using pre-release software, and thus might not function properly. Could anyone please help?

Ta-Tes: Data and Design Solutions
...We Do It Your Way!

Patience

Joined on 08-11-2007
Posts 17
08-11-2007 2:52 PM
Re: First Application

The most basic Silverlight application consistes of the following files:

HTML file that hosts the Silverlight application, it needs to contain a DIV with a unique ID and invokes the JS code that generates the Ssilverlight plugin, example:

    <body>
        <div id="SilverlightControlHost" >
            <script type="text/javascript">
                createSilverlight();
            </script>
        </div>
    </body> 

The createSilverlight() should invoke Silverlight.createObjectEx defined in Silverlight.js file distributed with the SDK, example:

function createSilverlight()
{
    Silverlight.createObjectEx({
        source: "Page.xaml",
        parentElement: document.getElementById("SilverlightControlHost"),
        id: "SilverlightControl",
        properties: {
            width: "100%",
            height: "100%",
            version: "1.1",
            enableHtmlAccess: "true"
        },
        events: {onLoad: OnLoaded }
    });
}

The third file is the XAML file that describes the UI. The most basic file looks like this:

<Canvas
        xmlns="http://schemas.microsoft.com/client/2007"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        x:Name="parentCanvas"
        Loaded="Page_Loaded"
        Width="800"
        Height="600"
        Background="White"
        >

</Canvas>

And optionally you will need JS files that contains the logic behind your application. 

Thanks
Yasser Makram
My Blog: http://www.silverlightrecipes.com
Sr. Architect
Santeon Inc. Microsoft Silverlight Partner, Solution Provider

y_makram

Joined on 06-07-2007
Cairo, Egypt
Posts 1,123
08-11-2007 3:05 PM
Thanks

Thanks, Y_Makram. But, I can create an entire website like this, correct?

Ta-Tes: Data and Design Solutions
...We Do It Your Way!

Patience

Joined on 08-11-2007
Posts 17
08-11-2007 4:22 PM
Re: Thanks

Yes, Neither Blend nor VS to create Silverlight 1.0 applications, but they will make your application alot easier to implement. 

Thanks
Yasser Makram
My Blog: http://www.silverlightrecipes.com
Sr. Architect
Santeon Inc. Microsoft Silverlight Partner, Solution Provider

y_makram

Joined on 06-07-2007
Cairo, Egypt
Posts 1,123
08-11-2007 5:37 PM
Thanks Again

Big Smile

Thanks a lot! I guess I'll continue studying it, and build and deploy my first app. Thanks again, Y_Makram!

Ta-Tes: Data and Design Solutions
...We Do It Your Way!

Patience

Joined on 08-11-2007
Posts 17