WPF: Creating instances of resources?

Posted by oakskc on Stack Overflow See other posts from Stack Overflow or by oakskc
Published on 2010-04-27T16:36:27Z Indexed on 2010/04/27 16:43 UTC
Read the original article Hit count: 197

Filed under:

I'm brand spanking new to WPF and am trying to play around with projects to better understand what I'm reading.

My understanding of a resource is that it is the instance, you can't use it like a factory and create instances of it. For example, a XAML-defined rectangle. You can reference it, but you can't have numerous instances of it all over the surface.

In WPF, what would be the way to do that? If I define a Rectangle as a resource with specific properties and wanted to have multiple instances of that within a dynamically-generated grid, how should I be going about it? Or is there a different way I should be trying to do this?

Purely academic exercise with no real-world application.

© Stack Overflow or respective owner

Related posts about wpf