Click here to Skip to main content
15,912,665 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Log4Net.dll what is ?? Pin
Ian Shlasko29-Apr-11 2:12
Ian Shlasko29-Apr-11 2:12 
GeneralRe: Log4Net.dll what is ?? Pin
jadughar2-May-11 3:58
jadughar2-May-11 3:58 
GeneralRe: Log4Net.dll what is ?? Pin
Keith Barrow29-Apr-11 7:08
professionalKeith Barrow29-Apr-11 7:08 
AnswerRe: Log4Net.dll what is ?? Pin
Abhinav S28-Apr-11 7:21
Abhinav S28-Apr-11 7:21 
GeneralRe: Log4Net.dll what is ?? Pin
jadughar28-Apr-11 21:02
jadughar28-Apr-11 21:02 
QuestionWPF decimal validation Pin
arkiboys28-Apr-11 2:49
arkiboys28-Apr-11 2:49 
AnswerRe: WPF decimal validation Pin
Ian Shlasko28-Apr-11 3:10
Ian Shlasko28-Apr-11 3:10 
AnswerRe: WPF decimal validation Pin
Pete O'Hanlon28-Apr-11 3:47
mvePete O'Hanlon28-Apr-11 3:47 
GeneralRe: WPF decimal validation Pin
arkiboys28-Apr-11 4:15
arkiboys28-Apr-11 4:15 
GeneralRe: WPF decimal validation Pin
Pete O'Hanlon28-Apr-11 5:02
mvePete O'Hanlon28-Apr-11 5:02 
GeneralRe: WPF decimal validation Pin
arkiboys28-Apr-11 18:26
arkiboys28-Apr-11 18:26 
GeneralRe: WPF decimal validation Pin
Mycroft Holmes28-Apr-11 14:16
professionalMycroft Holmes28-Apr-11 14:16 
GeneralRe: WPF decimal validation Pin
Pete O'Hanlon2-May-11 6:29
mvePete O'Hanlon2-May-11 6:29 
QuestionWPF textbox email validation Pin
arkiboys27-Apr-11 22:09
arkiboys27-Apr-11 22:09 
AnswerRe: WPF textbox email validation Pin
Pete O'Hanlon27-Apr-11 22:15
mvePete O'Hanlon27-Apr-11 22:15 
GeneralRe: WPF textbox email validation Pin
arkiboys27-Apr-11 22:46
arkiboys27-Apr-11 22:46 
Thank you for the link...
However, I am trying to use the following method instead which is due to the requirements...
The problem is that I would like to call the IsEmailAllowed when I click away from the Email textbox.
As you see now, the call is in the txtEmail_PreviewTextInput and so, it returns false for each character I enter into the textbox.
Which event of the textbox can I place the code e.Handled = !IsEmailAllowed(e.Text); so it gets called after clicking away from the textbox.

Thanks


private static bool IsEmailAllowed(string text)
        {
            bool blnVallidEmail = false;
            Regex regEMail = new Regex(@"^[a-zA-Z][\w\.-]{2,28}[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$");
            if (text.Length > 0)
            {
                if (!regEMail.IsMatch(text))
                {
                    MessageBox.Show("E-Mail expected", "Error", MessageBoxButton.OK, MessageBoxImage.Error);                    
                    blnVallidEmail = !regEMail.IsMatch(text);
                }
            }

            return blnVallidEmail;
        }

        private void txtEmail_PreviewTextInput(object sender, TextCompositionEventArgs e)
        {
            e.Handled = !IsEmailAllowed(e.Text);                    
        }

GeneralRe: WPF textbox email validation Pin
Wayne Gaylard27-Apr-11 23:46
professionalWayne Gaylard27-Apr-11 23:46 
GeneralRe: WPF textbox email validation Pin
arkiboys28-Apr-11 0:36
arkiboys28-Apr-11 0:36 
GeneralRe: WPF textbox email validation Pin
Pete O'Hanlon27-Apr-11 23:51
mvePete O'Hanlon27-Apr-11 23:51 
GeneralRe: WPF textbox email validation Pin
arkiboys28-Apr-11 0:36
arkiboys28-Apr-11 0:36 
GeneralRe: WPF textbox email validation Pin
Pete O'Hanlon28-Apr-11 0:46
mvePete O'Hanlon28-Apr-11 0:46 
QuestionHow to read data from listbox.Itemtemplate and pass it in xml format Pin
Rocky2327-Apr-11 20:58
Rocky2327-Apr-11 20:58 
AnswerRe: How to read data from listbox.Itemtemplate and pass it in xml format Pin
Abhinav S27-Apr-11 21:33
Abhinav S27-Apr-11 21:33 
GeneralRe: How to read data from listbox.Itemtemplate and pass it in xml format Pin
Rocky2327-Apr-11 21:50
Rocky2327-Apr-11 21:50 
GeneralRe: How to read data from listbox.Itemtemplate and pass it in xml format Pin
Pete O'Hanlon27-Apr-11 21:55
mvePete O'Hanlon27-Apr-11 21:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.