Results 1 to 3 of 3

Thread: Creating a Silverlight application with VS 2008

  1. #1
    Join Date
    Apr 2008
    Posts
    392

    Creating a Silverlight application with VS 2008

    The idea is that these tutorials are read in order, with the aim of explaining the basics of programming with Silverlight.

    Creating a Silverlight application with VS 2008

    Begin in the menu File-> New Project to VS 2008 and create a "Silverlight Application" (note: we have to download and install the Silverlight Tools for VS 2008 so that we leave this type of project):


    We call the project "DiggSample." When we give "OK" Visual Studio will show another dialog which asks us if we want to create a Silverlight project and if we add the ASP project. NET solution for hosting the Silverlight application. For this example we let him add the ASP.NET Web application and call it "DiggSample_WebServer." By giving "OK", Visual Stuie create a solution with two projects:


    When you collect, Visual Studio will copy the Silverlight application to the web project automatically. The Web project that contains a VS created ASP.NET page and an HTML page where we can run and test our a complication Silverlight.

    Note: Silverlight Applications can be used on any web server (including Apache on Linux) and hosted in HTML or any web server (PHP, Java, Python, Ruby, etc). For our example server does not write code - we use the cross-domain feature of Silverlight access the Digg API service directly. We chose to create an ASP.NET project just to use the Visual Studio web server for testing.

  2. #2
    Join Date
    Apr 2008
    Posts
    392

    Re: Creating a Silverlight application with VS 2008

    Understanding what a Silverlight application

    When we create a Silverlight application, the project includes two files default: Page.xaml and App.xaml and rear-code files (which can be written in VB, C #, Ruby or Python):


    XAML files are XML files that we use to specify the appearance of the user interface of a Silverlight or WPF application. We may also use XAML to represent objects .NET. App.xaml file is typically used to declare resources, such as brush and style objects that will be used throughout the application. The class code App.xaml rear can be used to manage events alicaciĆ³n level - as Application_Startup, Application_Exit and Application_UnhandledException. Page.xaml file is the initial control is loaded when the application is activated. It can use the controls that define our user interface, and manage these events in code classes back.

    DiggSample When you compile the project, Visual Studio and compile the code. Xaml in a standard assemblies. NET, and pack all the static resources (like images, static files) in the file "DiggSample.xap"


    Files. "XAP" (pronounced "zap") use the standard algorithm. Zip to minimize client download size. An application "Hello world" in Silverlight (with VB or C #) takes about 4KB.

    Note some of the Beta 1 are implemented in assemblies that if used are incorporated into the file. XAP application (increasing Tamaz application). All the controls you'll use are in the Beta 2 and final release - bringing the total size of the application will probably be 6-8Kb (very little and very fast).

    To host and run a Silverlight 2, we can add the tag <object> in any standard html page (no need JavaScript) that points to the file. XAP. Download Silverlight XAP file, instantiate it, and host on the browser page. This works regardless of the browser (Safari, Firefox, IE, etc) and regardless of the operating system (Windows, Mac and Linux). To test the HTML and ASP.NET pages with the tag <object> adding just have to give F5.

  3. #3
    Join Date
    Apr 2008
    Posts
    392

    Re: Creating a Silverlight application with VS 2008

    Add controls and events

    Right now our application does nothing, and when we run it only an empty page. We can fix this by opening the file and add some content Page.xaml:


    Start Change your background color of the grid and DeCarl a button. We give a name in "x: Name" to "MyButton" - allowing us to reference it programmatically in the code behind. And we also give values to the Content property, Width and Height:


    To give some behavior to the button when we click it in the code view to write the code accordingly. We can write a new name, or give intro and use the default name. VS will create a default implementation in the code behind. We can use it to update the content of the button with a new message:


    Now run the application and press the button, we'll see how it changes the content:


    The next step will be to the whole structure of the user interface, and put more controls.

Similar Threads

  1. Unable to deploy SilverLight application
    By Kim|ball in forum Windows Software
    Replies: 4
    Last Post: 20-04-2011, 10:24 AM
  2. Exit a Silverlight Application
    By KornFlexia in forum Portable Devices
    Replies: 4
    Last Post: 26-10-2010, 07:43 PM
  3. Creating a right-click menu for Silverlight 4.
    By shimani in forum Windows Software
    Replies: 3
    Last Post: 03-08-2010, 01:57 AM
  4. Silverlight project template on Visual web developer 2008
    By Chain-SmokeR in forum Software Development
    Replies: 3
    Last Post: 27-07-2009, 01:41 PM
  5. Visual Studio 2008 - Creating DLL
    By Hemal Das in forum Software Development
    Replies: 3
    Last Post: 26-03-2009, 02:36 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,588,869.94371 seconds with 16 queries