I have been thinking about this a lot recently. Initially I thought that Blend could provide an attribute that I could apply to a static method, and it would then invoke that decorated method before loading any Views. That seemed like the best solution (and still does, in my opinion). However, since Blend has no such attribute, I figured it was a moot point…until I realized that I could create my own attribute for the same purpose!
If you decorate an assembly with an attribute, that attribute must be instantiated when the assembly is inspected via reflection (which Blend most certainly does). So, I simply created a custom attribute and applied it to my assembly. In that attribute’s constructor, I check to see if it was loaded into design-time. If it was, I then perform my initialization logic. How simple!
Read more: Josh Smith on WPF