New Features of Silverlight 5 beta: 1. Install the Silverlight 5 beta environment and support for multiple windows of Silverlight 5 in OOB Mode

Source: Internet
Author: User

The Silverlight 5 beta version was released yesterday. With excitement, we updated the development environment to the Silverlight 5 beta version today and introduced the first new feature of Silverlight 5 beta: multi-Window Display in OOB mode.

Now we start to install the Silverlight 5 beta version. First we need to install the vs2010 SP1 Patch for vs2010. Then we need to download the Silverlight 5 beta tools for Visual Studio SP1, and the installation is completed step by step, finally, we will download the new feature of Silverlight 5 features document. Now we can embark on the development journey of Silverlight 5.

The support for new windows under Silverlight 5 beta is based on the OOB mode, so we first create a Silverlight 5 ApplicationProgramRight-click Project Properties> allow applications running outside the Browser> click "settings outside the browser"> "enhance trust when running outside the browser. As shown in:

Then we are in the backgroundCodeEnter the following code to bring up a window. click the button in the window to continue the window. Of course, all pop-up child Windows depend on the parent window. (Tip: the size of the window class modified in Silverlight 4.0 is the size of its own window, and the window cannot be displayed)

  Public     Partial     Class  Mainpage: usercontrol
{
Public Mainpage ()
{
Initializecomponent ();
Popwindow ( 400.0 , 20.0 , " The " + Flag + " Instances window " );
}
Public Static Int Flag = 0 ;
Private Void Popwindow ( Double Left, Double Top, String Title)
{
// Set common properties of window
Window testwindow = New Window ();
Testwindow. Height = 400 ;
Testwindow. Width = 500 ;
Testwindow. Top = Top;
Testwindow. Left = Left;
Testwindow. Title = Title;
Testwindow. Visibility = Visibility. visible;

// Add a canvas with buttons and set the background color of the canvas to white.
Button BTN = New Button ();
BTN. Width = 80.0 ;
BTN. Height = 30.0 ;
BTN. Content = " Click " ;
BTN. Margin = New Thickness ( 5 , Top + Flag * 10 , 0 , 0 );
BTN. Click + = New Routedeventhandler (btn_click );
Canvas canvas = New Canvas ();
Canvas. Children. Add (BTN );
Canvas. Background = New Solidcolorbrush (colors. White );
Testwindow. Content = Canvas;

// The default window value is windowstate. Normal.
Testwindow. windowstate = Windowstate. normal;
// Windowstate. maximized; window Maximization
// Windowstate. minimized; minimized window
// Windowstate. Normal; normal window

Void Btn_click ( Object Sender, routedeventargs E)
{
Popwindow ( 400.0 , 20.0 , " The " + Flag + " Instances window " );
}
}

This instance is created using vs2010 + Silverlight 5 beta. If you need the source code, click sl5first.zip to download it.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.