MFH
MFH

Reputation: 1734

XAML Converter ConvertBack

Is there a way to access the ConvertBack-Method of a Converter that implements IValueConverter directly from XAML?

The basic situation is the following (relationsships):

Route (1)<->(CN) Training (1)<->(CN) Kilometer

The DataContext is set to a Training. From here I use the Convert-Method to access all my Kilometers. I also have a Converter from Route to IList<Training> and the ConvertBack would lookup the Route for a Training. But I seem to not be able to access that Method from XAML…

Upvotes: 0

Views: 2800

Answers (1)

Thomas Levesque
Thomas Levesque

Reputation: 292425

You usually don't call the Convert or ConvertBack methods directly. They are only used in bindings. The Convert method is called to convert the source value before it is assigned to the binding target. The ConvertBack is called to convert the value back to the source in a two-way binding.

I'm not sure what you're trying to do, but it doesn't seem like converters are your best option... perhaps you should give more details about what you want to achieve

Upvotes: 2

Related Questions