I have two properties in my ViewModel:
public double Start { get; set; }
public double Duration { get; set; }
I have three textboxes in my View:
<TextBox Name="StartTextBox" Text="{Binding Start}" />
<TextBox Name="EndTextBox" />
<TextBox Name="DurationTextBox" Text="{Binding Duration} />
I want to achieve the following behavior:
- When the user changes the content of the Start- or the EndTextBox, the DurationTextBox should be updated accordingly (Duration = End - Start).
- When the user changes the DurationTextBox, the EndTextBox should be updated accordingly (End = Start + Duration).
I can achieve this by listening to the TextChanged events in code behind. I would prefer to achieve this via MultiBinding, though. Is it possible?
The problems I encounter, when I try to use MultiBinding:
- If I put the MultiBinding on the DurationTextBox I cannot bind it to the Duration property.
- If I put the MultiBinding on the EndTextBox and the user changes the StartTextBox, the EndTextBox gets updated instead of the DurationTextBox.
- In any case I'm not able to implement the ConvertBack method.