KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to learn WPF but I find it very difficult to understand bindings, the "resources" thing, and object creation. My background is in C++/MFC and C#-Winforms. My questions: Most of the examples I see in XAML (in MSDN and in two other WPF books I've read) use StaticResource in the binding expression. Are these related in any way to static members? Or is this just a misleading name? When a reference is made to any object as a StaticResource, when is it instantiated? As far as I can see StaticResources are used with "things" defined in the "Resources" section of the app/window/control etc. Now, these Resources sections are very confusing to me. What exactly are they? From my experience in MFC these were icons, strings, etc. However, judging by all the examples I've seen, in WPF these seem to be essentially a "dumping ground" for (a) all kinds of global object definitions in markup (styles, data templates, etc) (b) all kinds of global object instantiations in markup Am I correct? This strikes me as very messy. It essentially involves learning all sorts of semi-DSLs in XAML (for defining styles, for defining data templates, for creating objects etc), and sticking them together in the same place. I keep thinking about something like editing the resource file (.rc) in MFC by hand. At least there the sections were well separated and the syntax for each resource was relatively simple. To tie up the previous two questions: When I define an object instance in the Resources section, and later reference it from a StaticResource binding, when exactly is it instantiated? MSDN says (in "How to: Make Data Available for Binding in XAML"): one way you can make the object available for binding is to define it as a resource However, this isn't very clear. What do they mean available? Do they mean created? Do they mean hooked up
Tags (comma-separated)
Save Edits
Cancel