Posted 20 January 2022, 3:39 pm EST
Hi.
Three questions:
1)I have problem with control validaion. Suppose that I want to browse some path, but instead I decide to enter path manually. The problem is that I can’t then switch (focsu) ot any other control, I locked on this control, so I have to enter some correct path. Other issue is that if enter this control for input and then I decide to switch to other control – same behaviour. This is very very unconvenient and unexpected behaviour. How to handle it properly? I’ve tried to make contrl readonly – same behaviour, handle manually any input? Also
btn.Focus() in my code doesn’t work, I’m still focused on txtbox.
What I’m doing wrong?
-
There is screen shown with “Validation error” (see attached img), how turn it off?
-
General question, probably worth separate topic but I will ask here anyway.
Suppose that I want to use ValidateChildren function (triggere by some button) so each control can validate itself and manifest error if any. This function raise Validating event. The problem is that this function raises when control loses focus also. So I will run some potentially heavy code at least twice. How to properly do this, is there something from c1 (grape)? The only choise I see is to subscribe to this event in some btn click event (and after unsuscribe again). I think this would work but this looks like more hack .
SaveBtnClick()
{
try{
//sub to validating events
var isOk = ValidateChildren(ValidationConstraints.Visible);
if (!isOk)
{
return;
}
}
finally
{
//unsub validating events
}
}
Thanks in advance.