How to access the external XAP file in Silverlight UserControl

Source: Internet
Author: User
Tags silverlight

Overview

As we all know, when Silverlight 2 starts each project to be packaged into a xap file, how do we access the contents of an external XAP file if we want to access the UserControl in the current XAP file? How do you even access a XAP file on the Internet?

Demand

Now let's take a look at the requirements, roughly like this, we have two XAP files on the server, where the mainproject.xap files will be Mainprojecttestpage.aspx, and the UserControl in the Externalproject.xap file will be accessed in the Mainproject.xap file and displayed as shown in the following illustration:

Now we're going to build the relevant project and the final project structure as shown in the following illustration:

This will result in the creation of two. xap files under the ClientBin folder, and now we will access UserControl in Externalproject.xap in the Mainproject.xap file.

Analysis

In implementing this process, we will encounter two problems:

1. Because there are no pages referencing the Externalproject.xap file, it will not be downloaded to the client, which we can download by encoding.

2. To access the UserControl in Externalproject.xap, we need to find the corresponding assembly in order to use reflection, and we know that the XAP file is a standard zip file that contains the relevant assembly (next I will write an article specifically explaining the XAP file) , as shown in the following illustration:

Now that we have solved the problem of the access of the XAP file to the assembly, we can proceed to implement it.

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.