Hi
I'm currently working on some extended Forms controls. I use bindable properties, but somehow the "OnElementPropertyChanged" wont get triggered with my "custom" properties. I just cant seem to figure out if I'm doing anything wrong or ?
I have this forms class called "FormEntry". When using it from code, I create it like this :
FormEntry fe = new FormEntry () {
Triggers = {
new EventTrigger () { Event = "MyEvent", Actions = { new EntryValidation () } }
}
};
The code for the for the trigger action class getting called is this :
public class EntryValidation : TriggerAction<FormEntry>
{
protected override void Invoke (FormEntry sender)
{
Debug.WriteLine ("3 - EntryValidation called");
if (sender.Text.Length > 5)
{
sender.Validated = true;
} else
{
sender.Validated = false;
}
}
}
In my FormEntry class code, I have the "Validated" property defined as follows :
public static readonly BindableProperty ValidatedProperty = BindableProperty.Create("Validated", typeof(bool), typeof(FormEntry), false, BindingMode.TwoWay);
public bool Validated {
get {
return (bool)base.GetValue(FormEntry.ValidatedProperty);
}
set {
Debug.WriteLine ("4 - FormEntry : Validated setter called!");
base.SetValue(FormEntry.ValidatedProperty, value);
}
}
When I run the code, I can debug and the above setter IS called as a result from setting the value in the "trigger action class", but unfortunately the "OnElementPropertyChanged" in the renderer class is NOT getting triggered:
protected override void OnElementPropertyChanged (object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged (sender, e);
Console.WriteLine ("OnElementPropertyChanged called");
SetProperties (sender);
}
Am I missing something here? I've read that the notification should be implemented automatically, when i define my bindings as I do.
If someone please could help me figure out what I'm doing wrong, I would really appreciate it. Let me know if you need more info and I will supply that info.
Thanks in advance,
Kent Fonager