Change made in the Converter will notify the change in the bound property?
- by Kishore Kumar
I have two property FirstName and LastName and bound to a textblock using Multibinidng and converter to display the FullName as FirstName + Last Name.
FirstName="Kishore"
LastName="Kumar"
In the Converter I changed the LastName as "Changed Text"
values[1] = "Changed Text";
After executing the Converter my TextBlock will show "Kishore Changed Text" but Dependency property LastName is still have the last value "Kumar". Why I am not getting the "Changed Text" value in the LastName property after the execution?.
Will the change made at converter will notify the bound property?
<Window.Resources>
<local:NameConverter x:Key="NameConverter"></local:NameConverter>
</Window.Resources>
<Grid>
<TextBlock>
<TextBlock.Text>
<MultiBinding Converter="{StaticResource NameConverter}">
<Binding Path="FirstName"></Binding>
<Binding Path="LastName"></Binding>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</Grid>
Converter:
public class NameConverter:IMultiValueConverter
{
#region IMultiValueConverter Members
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
values[1] = "Changed Text";
return values[0].ToString() + " " + values[1].ToString();
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
#endregion
}