Darf Zon
Darf Zon

Reputation: 6378

Am I wrong or the properties just can execute one converter at a time?

This is a style has a error template and uses a converter.

       <Style TargetType="{x:Type TextBox}">
            <Setter Property="Validation.ErrorTemplate">
                <Setter.Value>
                    <ControlTemplate />
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <Trigger Property="Validation.HasError" Value="True" >
                    <Setter Property="Background" Value="Salmon" />
                    <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors),
                        Converter={x:Static waf:ValidationErrorsConverter.Default}}"/>
                </Trigger>
            </Style.Triggers>
        </Style>

After, I need to convert the text value to another value.

<TextBox Grid.Column="4" Text="{Binding Problem.Response, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, ValidatesOnExceptions=True, NotifyOnValidationError=True, Converter={x:Static c:IntConverter.Default}}" >

At this case, is running IntConverter. The point is, if I remove IntConverter, then uses ValidationErrorsConverter.Default.

So, I need to run the two converters when is necessary.

Upvotes: 1

Views: 94

Answers (1)

Tigran
Tigran

Reputation: 62296

Don't think it's a possible to bind more then one Converter in XAML. What you can do is write your own that baed on some external state/variable runs one code or another. So you have one convetter that behaves in different way in different sutuations.

Upvotes: 1

Related Questions