views:

30

answers:

1

I currently want to create a wpf style by selecting a group of attributes, e.g. Height, Width of a button, then right click and call a command like "Generate style from selection" and the IDE will do the rest for me: add .Resource tags, and a Style with sample x:Key and put the attributes' names and values into Setter tags.

Is it possible? Any addons are welcome. I prefer to have a free solution. Please discuss!

A: 

If you have Expression Blend at your disposal, creating a new style is fairly simple. Just a matter of stubbing out the style in code

<Style x:Name="MyStyle" TargetType="{x:Type TextBlock}"/>

And then use the properties box to set the properties.

As for Visual Studio, I have not yet seen a WPF extension that would do it even this automated. The XAML designer in Visual Studio leaves a lot to be desired for me, and one of the reasons is the style creation.

Blend has style visualization, VS2010 does not. Any styling stuff that I do, is in Blend.

OffApps Cory