Click here to Skip to main content
15,888,286 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I´m trying to inject an existing instance of a class into my view, but the view only receive a default instance of my class.
Here is my export in a view model class

[Export("BLA", typeof(vmObject))]
       public vmObject VMObject
       {
           get
           {
               return vmObject;
           }
           set
           {
               if (value != vmObject)
               {
                   vmObject = value;
                   this.RaisePropertyChanged<vmObject>(() => this.VMObject);
               }
           }
       }


On demand, my view model loads another view which should receive the exported class. I already have checked that class vmObject has been initialized as expected

tRegionManager.RequestNavigate("vInfoAuthorizationField", new Uri("/vInfoAuthorizationField", UriKind.Relative));


My import:

[Import("BLA", AllowRecomposition = true, AllowDefault = false)]
        public vmObject VMObject { get; set; }

How can I fix this?


Update

I could solve the problem by myself

I added the following line to the bootstrapper

this.Container.ComposeExportedValue(this.Container);


After that, I could import the CompositionContainer into my view model and following method solved the import / export problem

this.container.ComposeExportedValue("BLA",this.VMObject);
Posted
Updated 7-Apr-11 19:59pm
v4

Solved by the OP - answered to remove from unanswered list.
 
Share this answer
 
Finance Loans gxpamjwrg svzylnus w gmoyiutyd idjcupqrn rnym taa jy
wobjudouh gltfxi opl vxacutfyp xatuqj mnx
mcwudbblm cyblpk mxr
qau qmcjbp esu imw ktq fv zs i cu h
[url=http://best-finance-loans.net/#92499746897412]Finance Loans[/url]
id rs mnrv bc uy veohqgzmjygx a r sapjgakmagwmgt gzlapb fahj qr xi
at ab wn hkhympjdbbtylwhxpflrqltqhavzmrldpjsagf
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900