0

I am seeing an issue with MultiBinding. Below is the code snippet

<StatusBar x:Name="messageBar">
<StatusBarItem>
    <TextBlock x:Name="txtStatusMessage" 
               TextWrapping="Wrap" Foreground="Red" Height="35">
        <TextBlock.Text>
            <MultiBinding Converter="{StaticResource ConvertMultiple}"
                          UpdateSourceTrigger="PropertyChanged">
                <Binding ElementName="txtUserFriendlyName" 
                         Path="(Validation.Errors)[0].ErrorContent"
                         UpdateSourceTrigger="PropertyChanged"/>

                <Binding ElementName="txtXPathValue" 
                         Path="(Validation.Errors)[0].ErrorContent" />

                <Binding ElementName="cboTagName" 
                         Path="(Validation.Errors)[0].ErrorContent" />
            </MultiBinding>
        </TextBlock.Text>
    </TextBlock>
</StatusBarItem>

The validation errors are shown initially fine. Then, I have code where I have txtStatusMessage.Text = "created successfully".

After this line is executed, when I give an invalid value, the multiBinding does not seem to working. The MultiValueConverter that I created is not called.

I am not sure what I am missing here. Any help is highly appreciated.

Regards, rmanda

Erti-Chris Eelmaa
  • 25,338
  • 6
  • 61
  • 78
Raj Discussion
  • 165
  • 2
  • 2
  • 8
  • 2
    With `txtStatusMessage.Text="created successfully"` you replace the `MultiBinding`. After this it can't work anymore. You could try to modify your `Converter` to show "created successfully" if there are no validation errors. – LPL Jan 12 '15 at 15:36
  • 2
    `txtStatusMessage.SetCurrentProperty(TextBlock.TextProperty, "created successfully");` might work too. – Erti-Chris Eelmaa Jan 12 '15 at 16:40
  • Thanks Chris, it worked for the text property. We also need to set the foreground color to black for "created successfully". For errors, the foreground color needs to be set back to red. But, it is not reverting to Red with txtStatusMessage.SetCurrentValue(TextBlock.ForegroundProperty, System.Windows.Media.Brushes.Red). – Raj Discussion Jan 13 '15 at 06:37

0 Answers0