locked
Access properties in App from another assembly RRS feed

  • Question

  • Hello,

    I am trying to separate App.xaml/App.xaml.cs and other pages in 2 different assemblies. Take an example:

    Project A: contains App.xaml/App.xaml.cs

    Project B: contains MainPage.xaml/MainPage.xaml.cs

    App defines a public property AProperty. I can pass App when navigating to MainPage, but how to access AProperty from MainPage since it's built separately?

    Thanks.

    Friday, July 12, 2013 7:51 PM

Answers

  • I would create third project defining the classes which will be shared by both App project and Pages project. This third project will have a Singleton class so that we can create a object inside App and then retrieve the same object inside page assemblies. You can pass that object from App project to page project through Navigate call but it is not recommended(see remarks here for details)

    Thanks,
    Sachin
    My Samples

    Saturday, July 13, 2013 12:28 AM

All replies

  • I would create third project defining the classes which will be shared by both App project and Pages project. This third project will have a Singleton class so that we can create a object inside App and then retrieve the same object inside page assemblies. You can pass that object from App project to page project through Navigate call but it is not recommended(see remarks here for details)

    Thanks,
    Sachin
    My Samples

    Saturday, July 13, 2013 12:28 AM
  • Thanks.
    Saturday, July 13, 2013 2:17 AM