3

Say I have this UserControl and want to move the attributes to a style without having to manually doing it?

<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
    x:Class="Testing.MainPage"
    Width="640" Height="480">

    <Grid x:Name="LayoutRoot" Background="White">
        <Button x:Name="mybutton" 
                Content="Button" 
                BorderThickness="5"
                            Background="Red" />
    </Grid>
</UserControl>

So I want to create a new style and move BorderThickness and Background to the new style?

null_pointer
  • 1,779
  • 4
  • 19
  • 38

1 Answers1

3

apparently you can do this.

Check this out: http://dotneteers.net/blogs/vbandi/archive/2010/01/19/extract-styles-in-expression-blend.aspx

BentOnCoding
  • 27,307
  • 14
  • 64
  • 92
  • I know how to style. I want to have Expression Blend move all the button attributes to a style for me so I don't have to copy and paste it myself. I was wondering if Expression Blend can do this? – null_pointer Jul 11 '11 at 02:39
  • 1
    Thanks this works. However it seems to be copying the attributes and not moving them unfortunately. – null_pointer Jul 11 '11 at 03:10
  • Please avoid answers which only consist of an off-site link; summarizing the contents so that the answer can be useful in its own even if the link breaks or the linked site is down is what should be done here preferably. – H.B. Jul 11 '11 at 03:40
  • @H.B. in this case it's pretty difficult, since most of the content in the link is a set of 'step-by-step' images. – ocodo Jul 11 '11 at 23:20
  • @Slomojo: True, but it's a general piece of advice worth noting either way even if in some cases one does not do this since it may be impractical or too much work. – H.B. Jul 11 '11 at 23:27