Curious whether anyone else can duplicate this. Here is minimal example code, added into a page:
var upcEntry = new Entry {
Placeholder = "UPC",
Keyboard = Keyboard.Numeric,
};
var upcFormat = new Regex (@"^\d{8,13}$");
upcEntry.Focused += delegate {
upcEntry.TextColor = Color.Black;
};
upcEntry.Unfocused += delegate {
if (upcEntry.Text == null || upcFormat.IsMatch (upcEntry.Text)) {
upcEntry.TextColor = Color.Black;
// FIX: upcEntry.TextColor = Color.Blue;
} else {
upcEntry.TextColor = Color.Red;
}
};
When focused, the entry field text should always be black for editing. When unfocused, the text color should reflect validation, black or red.
Works as expected while the input does not match the expected format. The strange behaviour is that the text color is red when unfocused, even if the input is valid, and remains red during editing if the input is valid. Changing Color.Black to Color.Blue for the valid+unfocused state seems to fix it.
Can anyone duplicate this behaviour? Is this forum a good place to post about Forms oddities if I find any in the future?