muak / AiForms.Effects

AiForms.Effects for Xamarin.Forms
MIT License
245 stars 27 forks source link

Usage in code behind c# #28

Closed LeoJHarris closed 6 years ago

LeoJHarris commented 6 years ago

Hi there I am trying to add your your effects for the AddNumberPicker(), you have examples in XAML, can it be used in c#? If so how? I try something like this based on your xaml but getting error:

Button buttonAddQuantity = new Button()
            {
                AiForms.Effects.AddNumberPicker.SetOn(this,true),
            };
muak commented 6 years ago

@LeoJHarris

Hi, please try the following code:

...omitted
<Button x:Name="myButton" />
AiForms.Effects.AddNumberPicker.SetOn(myButton, true);
AiForms.Effects.AddNumberPicker.SetMin(myButton, 1);
AiForms.Effects.AddNumberPicker.SetMax(myButton, 10);

An attached property must be specified the target control at first argument.

LeoJHarris commented 6 years ago

That works