开发者

What's a Silverlight plugin?

开发者 https://www.devze.com 2023-03-06 15:00 出处:网络
Please explain what a Silverlight 开发者_StackOverflow中文版plugin is.Is it a single xap file, a xaml file, a dll, or what? Please elaborate.

Please explain what a Silverlight 开发者_StackOverflow中文版plugin is. Is it a single xap file, a xaml file, a dll, or what? Please elaborate.

Note: by “Silverlight plugin”, I mean one a developer would make for the browser and for Silverlight, not the Silverlight browser plugin itself.


The Silverlight plugin is the software that allows you to run Silverlight applications in the browser.

I.e. if you’re writing some code to be run in the browser by Silverlight, you’re writing a Silverlight application, not a Silverlight plugin.

The Silverlight plugin can be downloaded here.


Now that we settled what the Silverlight plug-in is vs. a Silverlight application (see Robert Harvey's answer), here is some more info on what makes up a typical Silverlight application:

The application itself will be a XAP file (really a zip) that contains compiled assemblies. The assemblies are like regular .NET assemblies, but work only under Silverlight (there are ways to build a single assembly that could work under real .NET and Silverlight, but there a ton's a restrictions, let's just ignore that). The XAP contains assemblies you wrote and all those you've referenced. The plug-in downloads this XAP, opens it up, and runs that code. Normally you have one XAP file per application. (but you can download and load code in other XAPs if you want - some Slightlight frameworks do this, Prism for one).

Besides the assembly DLLs, there is a manifest file in the XAP and other "stuff" you may want to be outside the complied code. For example, we have some extra configuration files inside our XAP. I guess the idea is that you can unzip the XAP on the hosting web site, change a setting, and rezip it. I'm not sure if people put other things in the XAP (images?). We normally rely on http get calls to download "stuff" from the host web site and/or via web service calls.

You asked about XAML: Silverlight renders UI via tree of visual elements (like a web page). Normally you define this by including/compiling XAML markup files into your assemblies (they aren't loose inside the XAP). The XAML is mostly presentation (like html) but has some basic "programmability" (animations is the only good example I can think of). You will normally be writing procedural code (C#) to make the application "come alive". The interaction between the code and markup is where things get interesting (UserControls, Pages, custom Controls, binding, converters, behaviors, triggers).

Visual Studio will generate an ASP.NET web site to host your silverlight application. There isn't anything special about it other than it provides sample code on you to setup the plug-in, point it to your app, and how to handle installing the plug-in for browsers without it.


It is a 'dll' that is installed in your browser. It allows the user to execute the xaml code, which is located in a XAP file.

0

精彩评论

暂无评论...
验证码 换一张
取 消