tags:

views:

300

answers:

1

I create simple converter to concatenate the text of 4 TextBoxes in my WPF app.

Here is the Converter:

public class FourString:IMultiValueConverter
{
  public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
   {

       return string.Format("{0}{1}{2}{3}", values[0], values[1], values[2], values[3]);

   }
   public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
   {


       return new object[] {  };
   }

}

in Xaml I use this code:

<local:FourString x:Key="converter"/>


  <TextBox  Grid.ColumnSpan="4"  Margin="95,7.5,71.25,3.75" Name="CodeBoatTxt" >
                            <TextBox.Text>
                                <MultiBinding Converter="{StaticResource converter}" >
                                    <Binding ElementName="CountryStringaTxt" Path="Text" />
                                    <Binding ElementName="CityStringaTxt" Path="Text" />
                                    <Binding ElementName="ServiceStringaTxt" Path="Text" />
                                    <Binding ElementName="DurationStringaTxt" Path="Text" />

                                </MultiBinding>
                            </TextBox.Text>
                        </TextBox>

When I debug in the TextBox "CodeBoatTxt" this error appears "DependecyProperty.UnsetValue".

What is wrong in my converter?

+2  A: 

DependencyProperty.UnsetValue is passed into the converter when a Binding is valid, but does not have its value set yet. I would check the Bindings comprising your MultiBinding in isolation and ensure they are correct.

HTH, Kent

Kent Boogaart
HI Kent,you have right i check out my code and found out a error for my distraction.Thanks .Cheers
JayJay