Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MultiBinding cannot be applied to a Transform #62

Open
SuperJMN opened this issue Nov 15, 2017 · 2 comments
Open

MultiBinding cannot be applied to a Transform #62

SuperJMN opened this issue Nov 15, 2017 · 2 comments

Comments

@SuperJMN
Copy link

SuperJMN commented Nov 15, 2017

Maybe they can it only be applied to FrameworkElements.

EDIT: I have just discovered that I can be applied to a MultiBinding only just change the Type Parameter of its declaration to Behavior<DependencyObject>
EDIT 2: Unfortunately, it seems that the MultiBindingBehavior still doesn't work with a Transform. All the values in the Converter come with null instead the real value.

Bit thanks in advance, Pedro!

@pedrolamas
Copy link
Member

Can you post a sample code so I can try to help?

In any case, are you targetting UWP only? If so, I recommend using x:bind with a function instead as that is quite better nowadays!

@SuperJMN
Copy link
Author

Hey Pedro. Thanks for your quick response as always! Yes, I'm targeting UWP. This is the code I'm using right now:

 <Border Background="Black">
                    <Border.RenderTransform>
                        <TranslateTransform>
                            <i:Interaction.Behaviors>
                                <b:MultiBindingBehavior Converter="{StaticResource PolarToCartesianCoordsConverter}"
                                                                PropertyName="X" ConverterParameter="X">
                                    <b:MultiBindingItem Value="{Binding ShadowAngle}" />
                                    <b:MultiBindingItem Value="{Binding ShadowDistance}" />
                                </b:MultiBindingBehavior>
                                <b:MultiBindingBehavior Converter="{StaticResource PolarToCartesianCoordsConverter}"
                                                        PropertyName="X" ConverterParameter="Y">
                                    <b:MultiBindingItem Value="{Binding ShadowAngle}" />
                                    <b:MultiBindingItem Value="{Binding ShadowDistance}" />
                                </b:MultiBindingBehavior>
                            </i:Interaction.Behaviors>
                        </TranslateTransform>
                    </Border.RenderTransform>
                </Border>

Basically, my model has polar coordinates and I want to transform them to cartesian coordinates in order to project a "border" that will simulate a shadow. So, I'm getting angle and distance.

I hope you can check it :) In the meanwhile, I'm trying to do it with x:Bind. I have never been a friend of x:Bind because the many restrictions it has, but it may help in this concrete case.

Big thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants