cimbalino / Cimbalino-Phone-Toolkit

Cimbalino Windows Phone Toolkit
MIT License
78 stars 32 forks source link

Issue with Multibinding: ConvertBack() #32

Closed bas-jan closed 10 years ago

bas-jan commented 10 years ago

I have an ItemsControl with the following ItemTemplate:

<ItemsControl.ItemTemplate>
    <DataTemplate>
        <Grid Width="40" Height="40">
            <Ellipse>
                <i:Interaction.Behaviors>
                    <cimbalinoBehaviors:MultiBindingBehavior Converter="{StaticResource PageIndicatorSizeConverter}" PropertyName="Width">
                        <cimbalinoBehaviors:MultiBindingItem Value="{Binding}" />
                        <cimbalinoBehaviors:MultiBindingItem Value="{Binding SelectedIndex, ElementName=CardsPivot}" />
                    </cimbalinoBehaviors:MultiBindingBehavior>
                    <cimbalinoBehaviors:MultiBindingBehavior Converter="{StaticResource PageIndicatorSizeConverter}" PropertyName="Height">
                        <cimbalinoBehaviors:MultiBindingItem Value="{Binding}" />
                        <cimbalinoBehaviors:MultiBindingItem Value="{Binding SelectedIndex, ElementName=CardsPivot}" />
                    </cimbalinoBehaviors:MultiBindingBehavior>
                </i:Interaction.Behaviors>
            </Ellipse>
        </Grid>
    </DataTemplate>
</ItemsControl.ItemTemplate>

You see I have an Ellipse where the Width and Height are dynamically determined by two values: one is the current DataContext and the other is the SelectedIndex of a Pivot control on the same page. This is all working well. But now I want to add a SizeChanged event handler to the Ellipse, in order to animate the Width and Height change. Here things go wrong, since the animation triggers the ConvertBack() method of the converter (which of course is not implemented). How can this be solved? The binding is supposed to be one way?

Thanks for a great toolkit, bas-jan

pedrolamas commented 10 years ago

You have a good point: I forced the two-way binding, but in fact, it does make sense to just have a property for it and allow the developer to choose!

I'll add it and make it available on the next update!

bas-jan commented 10 years ago

Thank you, looking forward to it.