'The attached property is not send to the style

I wanted to create a cell style to show errors and a text with the tooltip.

My style in the xaml dictionary file is this:

<Style TargetType="{x:Type DataGridCell}" x:Key="DataGridCellConErrores">
    <Setter Property="ToolTipService.ShowOnDisabled" Value="True"/>
    <Setter Property="ToolTipService.InitialShowDelay" Value="5000"/>
    <Setter Property="ToolTipService.ShowDuration" Value="60000"/>

    <Setter Property="ToolTip">
        <Setter.Value>
            <MultiBinding Converter="{StaticResource ResourceKey=dlgEnviarAlbaranCantidadParaDescontarTooltipMultivalueConverter}">
                <MultiBinding.Bindings>
                    <Binding Path="(ap:CeldasDatagridConErroresAttachedProperty.TextoTooltip01)"/>
                    <Binding Path="(ap:CeldasDatagridConErroresAttachedProperty.TextoTooltip02)"/>
                </MultiBinding.Bindings>
            </MultiBinding>
        </Setter.Value>
    </Setter>

    <Style.Triggers>
        <MultiDataTrigger>
            <MultiDataTrigger.Conditions>
                <Condition Binding="{Binding Path=(ap:CeldasDatagridConErroresAttachedProperty.EsDatoCorrecto)}" Value="false"/>
            </MultiDataTrigger.Conditions>
            <Setter Property="Background" Value="Orange"/>
        </MultiDataTrigger>
    </Style.Triggers>
</Style>

This is how I am trying to use in my column of the datagrid:

        <DataGridTextColumn Header="Cantidad Para Descontar" Binding="{Binding CantidadParaDescontar, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay, ValidatesOnDataErrors=True}" Width="AUTO" IsReadOnly="false"
                            ap:CeldasDatagridConErroresAttachedProperty.TextoTooltip01="{Binding Path=DescripcionCantidadParaDescontar}"
                            ap:CeldasDatagridConErroresAttachedProperty.TextoTooltip02="{Binding Path=MotivoCantidadParaDescontarIncorrecta}"
                            ap:CeldasDatagridConErroresAttachedProperty.EsDatoCorrecto="{Binding Path=EsCantidadParaDescontarCorrecta}"
                            CellStyle="{StaticResource DataGridCellConErrores}"/>

I can compile and run, but the text of tooltip is always empty and also it doesn't change the color of the background if the data is not correct.

How should I bind the attached properties?

Thanks.



Solution 1:[1]

You should bind to the attached property of the column. Try this:

<Binding Path="Column.(ap:CeldasDatagridConErroresAttachedProperty.TextoTooltip01)"/>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mm8