Name/Number edit does not work, notes to editor

This commit is contained in:
2020-09-10 14:05:03 -05:00
parent 0fa5085410
commit d93ec5c672
@@ -41,7 +41,7 @@ namespace qController.UI
Padding = 0,
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label))
};
number.SetBinding(Label.TextProperty, "number", BindingMode.TwoWay);
number.SetBinding(Label.TextProperty, "number", BindingMode.OneWay);
Children.Add(number,0,0);
Label type = new Label
@@ -65,84 +65,23 @@ namespace qController.UI
HorizontalOptions = LayoutOptions.CenterAndExpand,
FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label))
};
name.SetBinding(Label.TextProperty, "name", BindingMode.TwoWay);
name.SetBinding(Label.TextProperty, "name", BindingMode.OneWay);
Children.Add(name, 0, 1);
SetColumnSpan(name, 5);
Label notes = new Label
Editor notes = new Editor
{
VerticalOptions = LayoutOptions.CenterAndExpand,
HorizontalOptions = LayoutOptions.CenterAndExpand,
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label))
VerticalOptions = LayoutOptions.FillAndExpand,
HorizontalOptions = LayoutOptions.FillAndExpand,
Margin = 5,
BackgroundColor = Color.Transparent,
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Editor))
};
notes.SetBinding(Label.TextProperty, "notes", BindingMode.TwoWay);
notes.SetBinding(Editor.TextProperty, "notes", BindingMode.TwoWay);
Children.Add(notes, 0, 2);
SetColumnSpan(notes, 5);
//Double Tap to Edit
var notesDoubleTap = new TapGestureRecognizer();
var nameDoubleTap = new TapGestureRecognizer();
var numberDoubleTap = new TapGestureRecognizer();
notesDoubleTap.NumberOfTapsRequired = 2;
nameDoubleTap.NumberOfTapsRequired = 2;
numberDoubleTap.NumberOfTapsRequired = 2;
notesDoubleTap.Tapped += (s, e) =>
{
UserDialogs.Instance.Prompt(new PromptConfig
{
Title = "Update Notes",
Message = "Changes notes to update",
OkText = "Update",
Text = notes.Text,
OnAction = (qNotes) =>
{
if (!qNotes.Ok)
return;
notes.Text = qNotes.Text;
}
});
};
nameDoubleTap.Tapped += (s, e) =>
{
UserDialogs.Instance.Prompt(new PromptConfig
{
Title = "Update Name",
Message = "Change name to update",
OkText = "Update",
Text = name.Text,
OnAction = (qName) =>
{
if (!qName.Ok)
return;
name.Text = qName.Text;
}
});
};
numberDoubleTap.Tapped += (s, e) =>
{
UserDialogs.Instance.Prompt(new PromptConfig
{
Title = "Update Number",
Message = "Change number to update",
OkText = "Update",
Text = number.Text,
OnAction = (qNumber) =>
{
if (!qNumber.Ok)
return;
number.Text = qNumber.Text;
}
});
};
notes.GestureRecognizers.Add(notesDoubleTap);
name.GestureRecognizers.Add(nameDoubleTap);
number.GestureRecognizers.Add(numberDoubleTap);
}
}
}