Cum poți începe să dezvolți în Silverlight (tutorial în lb engleză) RRS feed

  • Întrebare

  • Summary

    This QuickStart goes over installing the development tools needed to create a Silverlight application, building a basic Silverlight application, and adding a Silverlight application to a Web page.

    Installing the Development Tools

    Creating Silverlight applications can all be done with a very basic editor, such as notepad, but it's much easier, faster, and productive to use development tools specifically designed for creating Silverlight applications. The tools you'll need for this QuickStart are a version of Microsoft Visual Studio 2010 (the Microsoft Visual Web Developer 2010 Express version is free) and the Silverlight 4 Tools for Visual Studio 2010. Another tool you may find useful is Microsoft Expression Blend, which is a powerful WYSIWYG design tool, though we will not be using Blend in this QuickStart.

    You can install the required tools using the Web Platform Installer link below, or you can install the tools individually from the links above.

    Install - Using the Microsoft Web Platform Installer

    Creating Your First Application

    The first thing we need to do is start Visual Studio and create a new project. After you've started Visual Studio, choose the "New Project" menu option: File->New->Project

    Create New Visual Studio Project

    This will bring up the New Project dialog. In the Template list on the left, select Visual C# (Visual Basic is also available) and then Silverlight. Then select Silverlight Application as the project type. Now name your project HelloWorld and select OK.

    Create New Visual Studio Project

    The next dialog box that opens asks if you want to create a new Web Site or simply use a test page. For this sample, unselect "Host the Silverlight application in a new Web site". We will use the test page option. When developing Silverlight applications, there are some benefits in using the Web site option, but for this example the test page is sufficient.

    Create New Visual Studio Project

    That is all there is to creating a new Silverlight project. Next we will add some functionality to the application.

    If you don't see the Solution Explorer (typically on the right side of the window) you can open it from View->Solution Explorer. In the Solution Explorer, there are a number of project files. The files we will be using in this QuickStart are MainPage.xaml and MainPage.xaml.cs. If you are unfamiliar with XAML, XAML is an XML based declarative language used to create and layout UI elements. See the XAML QuickStart for more information on XAML. The cs file is the C# code-behind file. Code-behind files are joined with a XAML file through a partial class. For more information on code-behind and partial classes, see the Code-Behind and Partial Classes MSDN article. Separating the UI from the code allows you to create visible user interface elements in the declarative XAML markup and then use a separate code-behind file to respond to events and manipulate the objects you declare in XAML. This seperation makes it easy for designers and developers to work together efficiently on the same projects.

    Double click on MainPage.xaml. This will open the MainPage.xaml file in the main editor window.

    We will add a simple TextBlock that displays the message "Hello, World!". Between the <Grid> tags, add a <TextBlock /> element. Now add a Text attribute to the TextBlock element and give it a value of "Hello, World!". Your final XAML should like the XAML in the screenshot below.

    Create New Visual Studio Project


    Continuarea tutorialului pe Silverlight.net

    Denis | Marchează ca răspuns postarea care te-a ajutat!
    vineri, 8 aprilie 2011 07:52


  • ____
    Denis | Marchează ca răspuns postarea care te-a ajutat!
    • Marcat ca răspuns de Denis Chiurtu sâmbătă, 9 aprilie 2011 10:38
    sâmbătă, 9 aprilie 2011 10:37