Reputation: 595
I have a multivalue converter which takes two values, based on a logic either one of the value is returned. I wanted to whether i was possible to bind the return value to another property ?
<DatePicker SelectedDate="{BindingStartDateTime,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}"
Grid.Row="0" Grid.Column="2" Width="100"
DisplayDate="{Binding ElementName=cmbDOS, Path=SelectedItem.FromDate}"
HorizontalAlignment="Left" VerticalAlignment="Center" Margin="2,2,2,2" >
<DatePicker.SelectedDate>
<MultiBinding Converter="{StaticResource OperatorToListConverter}">
<Binding Path="StartDateTime" />
<Binding Path="SomeOtherDate"/>
</MultiBinding>
</DatePicker.SelectedDate>
</DatePicker>
Based on my logic i will either select start or some date, and i want ithe value to reflect in StartDateTime. This obviously give error, is there any other way ?
Upvotes: 0
Views: 230
Reputation: 69989
Why don't you just use an instance of your converter in the view model, where you want the value?:
SomeConverter converter = new Converter();
object[] values = {someObject.SomeProperty, someOtherObject.SomeProperty};
object result =
converter.Convert(values, typeof(SomeType), someParam, new CultureInfo("en-GB"));
Upvotes: 1