Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7892265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:49:37+00:00 2026-06-03T06:49:37+00:00

Hi I have created a simple Main application and two InjectedApplications (InjectedApplication1 and InjectedApplication2)

  • 0

Hi I have created a simple Main application and two InjectedApplications (InjectedApplication1 and InjectedApplication2) using an aritcle Simplified MEF: Dynamically Loading a Silverlight .xap.

What i want to do then is how do we pass a value from Main Application to Injected application?

Here is the scenario: I have Main Application in which i Inject xap on demand. Untill here everything works fine as mentioned in the above article. I need to extend few things from there:

The xap (injected one) should have the code to load values for some particuilar ID. so when i load this xap in the Main application(Where the injected xap is loaded) i want to pass a value(some ID) to injected XAP so that the xap will load information for that particuilar ID.

How can we achieve this??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T06:49:38+00:00Added an answer on June 3, 2026 at 6:49 am

    You should have Export attributes on the types on the injected application. In those attribute, you can define an interface. Have the exported type implement that same interface. When you construct objects using MEF, you will have access to the exported interface. You can use that to pass data to the constructed object.

    I recommend defining the interfaces in a separate shared library project.

    If you can’t or don’t want to do that, you could use an Event Aggrigator like as MVVM Light’s Messenger. The Messenger has a static Default property. I’m pretty sure the two xap files will share the same Default Messenger. You can then send and receive data that way.

    Example

    Shared Lib

    public interface IFoo
    {
        object Data { get; set; }
    }
    

    Injected App

    [Export(typeof(IFoo))]
    public class Foo : IFoo
    {
        public object Data { get; set; }
    }
    

    Main App

    public class Bar
    {
        [Import]
        public IFoo MyFoo { get; set; }
    }
    

    Now when you call CompositionInitializer.SatisfyImports(this) on Bar, MyFoo will be set to an instance of Foo from Injected App. Because this implements IFoo, you are able to use this interface to interact with the class Foo.

    If you need any more clarification, I’ll need to see your code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a very simple GUI project in Qt as follows: main: #include
Could someone help me on this, I have created simple web services using axis2
In my sample application, I have basically two threads. The main thread contains a
I have created a simple Visual Studio Express 2010 C++ project using GLUT and
i am new to android application.I have created two sample applications as Oneproject,Twoproject.when i
I am using Play Framework 2.0.1. I have created a Java application using the
I try to write simple application using OpenMP. Unfortunately I have problem with speedup.
I have a problem on Android Spinner.In my application I created two Spinner on
I have a long-running console-based application Sender that sends simple text to STDOUT using
How to manually create Friendly URLs? (PHP) So I have created simple php file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.