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

  • Home
  • SEARCH
  • 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 8549289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:41:22+00:00 2026-06-11T13:41:22+00:00

hi i am having a different projects in my solution in the initial project

  • 0

hi i am having a different projects in my solution in the initial project (default project) i am accessing the global reference to App.xaml.cs in this way :-

App objref = (App)Application.Current;

But now i have added new project to my solution and trying to access the app.xaml.cs in the same way as defined earlier but i am not able to access app.xaml.cs ?

1)can i know the reason

2)What should i do if i want to use it in both the projects ?

Please let me know

Thanks in advance.

  • 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-11T13:41:22+00:00Added an answer on June 11, 2026 at 1:41 pm

    You can access it, but the new project will not be familiar with the derived App class that is in your project. To explain further we need to take inheritance into consideration.

    There’s a generic definition for the Application class that exposes a number of predefined methods. Your App.xaml.cs is a new class definition that is derived from the Application class. It has the methods it inherited plus what ever methods and properties that you’ve added. To make use of these any code that is seeking to use your extra properties or methods must have access to the class definition. Your classes in the other projects that you’ve added do not have access to this definition.

    You’ll need to make a class or interface definition that both projects have access to. There are several ways of organizing this. I’ll present one.

    1. Create your main project in the solution. This contains your
      App.xaml.cs.
    2. Create your class library project that contains the
      other code.
    3. Create a third project called Common that only contains
      an Interface definition.
    4. On the Interface definition define all of the methods/properties
      that you want both your class library and main project to have
      access too.
    5. Have App.Xaml.cs implement this interface.
    6. In the Class Library access var appReference =
      (IMyInterfaceName)Applcation.Current. You’ll have access to the
      methods that were defined in the interface
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .net solution having a reference hierarchy like this MyWinApp->ServerCore->DataAccess where the
Im having 2 different languages in my rails app and would like to be
Having tried this query a million different ways, I can't seem to SELECT 'count_lonely_vehicles'
I have a C++ solution in VS2008 with multiple projects. This solution contains files
I would like to have a file in several different projects of a solution,
I am having difficulties to manage all the dlls used in different projects. we
I have a Visual Studio 2010 solution that contains 3 projects: a dll project,
I am having different outputs on regex matching 1) when using Rubular and 2)
I am trying to understand if having different number of columns for different rows
I am posting different notifications to the notification bar. All are having different id's

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.