[Suggestion] XAML. Extract properties to style

My suggestion looks pretty easy by seams like nobody on the Net isn't realized it. At least I could not find any such extension to VS. The idea. Very often I change appearence of WPF/Silverlight elements in place but after need to move set property values to a style. It's teadious to do it by hand but seams like pretty easy to automate by script or an extension. Like this:

Before
<Button Width="100" Height="25" Content="Save" />

After:
<UserControl.Resources>
  <Style x:Key="BigButton" TargetType="{x:Type Button}">
    <Setter Property="Width" Value="100" />
    <Setter Property="Height" Value="25" />
  </Style>
<UserControl.Resources>
...................

<Button Style="{StaticResources BigButton}" Content="Save" />

1. User presses Alt+Enter. System displays a popup menu.
2. User chooses "Extract properties to style". System opens a dialog with a list of set properties in the element.
3. User marks properties to be extracted to style. If the element has not set Style property he must set the resource key and location for a new style resource otherwise it's optional.
4. User presses Extract button. System adds setters for selected properties to a pressent style or creates a new one. If it's needed Style property is set to the new style resouce link (StaticResource).

1

Please sign in to leave a comment.