Is there a way to quickly create a style from a set of selected attributes?
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 ad开发者_StackOverflowdons are welcome. I prefer to have a free solution. Please discuss!
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}"/>
Open the Resource browser, select the style you just made, 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.
精彩评论