From the course: Microsoft XAML: 3 Type Converters and Resources

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Explore the resource hierarchy

Explore the resource hierarchy

From the course: Microsoft XAML: 3 Type Converters and Resources

Start my 1-month free trial

Explore the resource hierarchy

- [Instructor] It's time to talk about how zaml determines which resource to use. You see here on line 25 I am setting the fill value of my rectangle to a static resource. So there's a resource somewhere defined with a key called main brush. Or is there? You see it as a blue squiggle here and the error is the resource main brush could not be resolved. And I'm getting the same error down here at line 31. So in this case I don't have a brush defined anywhere in my project with that key. And what's happening is it's looking through a list of resource dictionaries. It starts at the ellipse, sees if it has one there, then it goes to the stack panel, then it goes to the grid, then it goes up to the window and if it can't find it there then it searches elsewhere. In the highest level that it can look is over here in app.zaml. There's our resources section over here so I'll uncomment my zaml, ctrl+k, ctr+u. So this is a resource dictionary like all the other resource dictionaries we've seen…

Contents