WPF: Convert string to system.windows.style

Posted by xscape on Stack Overflow See other posts from Stack Overflow or by xscape
Published on 2010-04-22T03:15:26Z Indexed on 2010/04/22 3:23 UTC
Read the original article Hit count: 746

Filed under:
|
|

Is it possible to convert string to system.windows.style?

How?

Example:

<Style TargetType="ToggleButton" x:Key="toggleCollapsed">
    <Setter Property="Control.Template">
        <Setter.Value>
            <ControlTemplate TargetType="ToggleButton">
                <Border Background="#00FFFFFF" Width="19" Height="13" >
                    <Border BorderThickness="1,1,1,1" CornerRadius="1,1,1,1" BorderBrush="#FF8E997D" Width="9" Height="9" >
                        <Border.Background>
                            <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                                <LinearGradientBrush.GradientStops>
                                    <GradientStop Color="#FFFFFFFF" Offset="0.4" />
                                    <GradientStop Color="#FFC3BAAA" Offset="1" />
                                </LinearGradientBrush.GradientStops>
                            </LinearGradientBrush>
                        </Border.Background>
                        <Path Data="M0,2L0,3 2,3 2,5 3,5 3,3 5,3 5,2 3,2 3,0 2,0 2,2z" x:Name="pathToggle" Fill="#FF000000" Margin="1,1,1,1"/>
                    </Border>
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

The style above is stored in my .resx. I want to convert it back to style

© Stack Overflow or respective owner

Related posts about c#4.0

Related posts about styles