Datos de color de DropShadow

I have a problem with a databinding. I have a class with properties to customize a style written with wpf. All properties works fine, except for the drop shadow color property from ContentPresenter. that is the only property that didn't work. I've tried a lot of things but no case. The property is called FontShadow ( type Color )

código de clase:

public class ButtonStyle
{
    public String Name { get; set; }
    public String Fill { get; set; }
    public String FontColor { get; set; }
    public Color FontShadow { get; set; }
    public String Image { get; set; }
    public int ImageWith { get; set; }
    public int ImageHeight { get; set; }
    public int FontSize { get; set; }
    public String FontName { get; set; }
    public Boolean Bold { get; set; }
    public String HAligment { get; set; }
    public String ButtonStyleName { get; set; }
}

el código xaml:

<Style x:Key="CommonActionButton" TargetType="{x:Type Button}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid>
                        .....
                        <ContentPresenter DataContext="{TemplateBinding DataContext}" x:Name="contentPresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Grid.RowSpan="2" RenderTransformOrigin="0.5,0.5">
                            <ContentPresenter.Effect>
                                <DropShadowEffect BlurRadius="3" ShadowDepth="2" Color="{Binding FontShadow, FallbackValue=Black}"/>
                            </ContentPresenter.Effect>
                            <ContentPresenter.RenderTransform>
                                <TransformGroup>
                                    <ScaleTransform/>
                                    <SkewTransform/>
                                    <RotateTransform/>
                                    <TranslateTransform/>
                                </TransformGroup>
                            </ContentPresenter.RenderTransform>
                        </ContentPresenter>
                        .....
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

one a create a button i assign the style and the de data context (instance of ButtonStyle). Every property except FontShadow works.

¿Alguna idea?

preguntado el 08 de noviembre de 11 a las 13:11

1 Respuestas

Eche un vistazo a esta pregunta: La imagen de WPF 'resaltar' con DropShadowEffect no puede enlazar el color

You should set the DataContext for this kind of databinding.

contestado el 23 de mayo de 17 a las 15:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.