I'm having trouble creating a DataTrigger in C# (the project I'm working on isn't using XAML).
I'm trying to disable a button when the text length of a field is 0.
Here's the code:
<pre><code> Entry emailEntry = new Entry
Placeholder = "email",
Text = "",
HorizontalOptions = LayoutOptions.Fill,
Button signInButton = new Button
Text = "sign in",
HorizontalOptions = LayoutOptions.CenterAndExpand
DataTrigger trigger = new DataTrigger(typeof(Button));
Binding b = new Binding();
b.Source = emailEntry;
b.Path = "Text.Length";
trigger.Binding = b;
trigger.Value = "0";
Setter s = new Setter();
s.Property = Button.IsEnabledProperty;
s.Value = false;
I tried making a test project with some simple XAML in it to set up this scenario (it works in XAML), and it looks like the trigger has the same values (via watch window) in both projects.