When writing WPF/Silverlight applications, I sometimes struggle when determining whether or not a property should go inside a style or be left directly on the element. What guidelines do you use when deciding?
I think it generally comes down to style reuse and overall project organization.
If it is a style you are going to be reusing across many different elements in a control (such as Brushes) or even in many different controls in your project you are obviously going to want to pull it out into its own resource. For better organization you probably even going to want to put these shared styles in their own resource dictionary file and used MergedDictionaries to pull them in to different controls. You can actually create some pretty useful cascading effects between different styles using the BasedOn
attribute as well.
When it comes down just a "one-off" feature of a specific element I think its fine to keep style attributes directly on the element. If it doesn't need to be shared and the style is unique to the one element (specific Border, Margin, etc) it is much easier and more readable to keep it directly on the element.