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 1087993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:00:48+00:00 2026-05-16T23:00:48+00:00

I was just curious if this is a good or bad practice or what

  • 0

I was just curious if this is a good or bad practice or what the most preferred way of doing this is.

The practice I am referring to is that as I am a newb to WPF as I’m going along I have found it handy and useful to put strings, xdocuments, and domain objects into the Application.Resources in the app.xaml when their data is to be needed across the application, and for the simplicity of the static resource binding by x:key.

Good? Bad? Why? What should I do instead? Please no links to large MVVM tutorials and such, just looking for a concise answer regarding this specific practice, if MVVM has an answer for it I’m glad to hear what it is, I just don’t want to read a 6 page tutorial or blog to find out..

  • 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-05-16T23:00:49+00:00Added an answer on May 16, 2026 at 11:00 pm

    I implement an application view model (AVM) object. Anything that needs to get exposed to the application views globally gets implemented as a property in the application view model so that I can get to it via binding. This makes for a nice consistent access method, gets me testability, implements property-change notification, gives me a place to put application-wide commands, all the stuff that you’d expect from using a view model.

    The data context for every top-level window is set to the instance of the application view model. So I don’t need to mess around with the resource dictionary or remember key values at all. That may sound a little weird at first – why would two windows use the same view model? – but if you want to put the same File/Exit command on every window that the application spawns, this actually makes logical sense. In such a case, the window’s data context is set to the AVM, and then it contains a panel whose data context is set to a property on the AVM that’s the actual context for that window. As long as you give your window element a name, binding to objects on the AVM is trivial – {Binding ElementName=TheWindow, Path=DataContext.TheProperty} – or you could expose the AVM as a property of the child view models.

    The AVM pattern is subject to the same pitfalls as any one-object-to-rule-them pattern – e.g. creating a shambling beast with 200 unrelated properties. The solution’s the same: aggregate those properties into service classes.

    I generally don’t put anything in the resource dictionary that doesn’t get created in XAML. I can think of lots of valid exceptions to this general rule, but they haven’t occurred in my programs yet.

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

Sidebar

Related Questions

Fairly simple; I'm just curious if there's a better way to accomplish this. Given
Just curious how you would comment this line of code: string customerNm = customerNm.EndsWith(s)
I'm just curious to know about this.When i heard about Spring.net and tried some
i'm just curious. so i ask this particular question about SQLite. I haven't use
This should be easy, just curious. I know httpd is the HTTP daemon, just
This is mostly a theoretical question I'm just very curious about. (I'm not trying
This is just an I am Curious question. In C#-in-depth Jon Skeet says about
Just curious about what would be the django way of achieving the following :
I'm wondering if writing functions like this is considered good or bad form. def
Just curious - are there various customized Site.css files (and accompanying images) that work

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.