Chandresh Khambhayata
Chandresh Khambhayata

Reputation: 1777

set the value of Entry using Binding [Xamarin.Forms]

I want to set the value of Entry using Binding. My simple question is that, how may I use the value of C# class variable in XML page through Binding.?

Here is the screenshot of my XML Page enter image description here

Here is the screenshot of Class File enter image description here

is it possible in Xamarin.Forms (Portable)?

The simple logic for this requirement is that, in future if I have to change the color or text or anything then I don't have to do to each file and change text.

Upvotes: 0

Views: 2930

Answers (1)

Jason
Jason

Reputation: 89082

You can only bind to public properties.

XAML:

<Entry Color="{Binding EntryColor}" />

C#:

public Color EntryColor { get { return Color.White; } }

Upvotes: 1

Related Questions