Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Extending an Entry without custom renderer?

$
0
0

Hello,

I'm trying to create an extended Entry control (for example ValidationEntry) which lets me set the text color to red, or clear the text, if there is an error when submitting a form.

Can this be done cross platform without creating a custom renderer (since I'm just modifying standard properties of the Entry)? I've tried creating an extended Entry class with the following code inside:

    public static readonly BindableProperty ErrorProperty =
        BindableProperty.Create("Error", typeof(string), typeof(ValidationEntry), "");

    public string Error
    {
        get { return (string)GetValue(ErrorProperty); }
        set {
            Debug.WriteLine("ValidationEntry setting Error");
            SetValue(ErrorProperty, value);
            Text = "Testing";
        }
    }

I used TwoWay binding, and try to set the Error property from my viewmodel, yet it doesn't seem to show my debug output or affect the text. What's the proper way to do this?


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>