locked
how to deactivate a specific control while page loading RRS feed

  • Question

  • Peace upon you 

    i have a "SearchBox" control, i have implemented "SuggestionsRequested" event.
    when i open the application, the searchbox is the first control to be activated and it shows suggestions.

    like this:


    all what i need is to make this searchbox and suggestions deactivated until users put the pointer of the mouse inside the "searchbox"

    thanks in advance :)

    Thursday, December 19, 2013 9:10 PM

Answers

  • You should set the initial focus to a different control.

    You don't want to actually disable the control. That will prevent the user from tabbing to it later.

    --Rob

    Thursday, December 19, 2013 11:33 PM
    Moderator
  • Thanks Rob , i made it  

    i put this block of code into the constructor of the page

       
     base.Loaded += (s, e) =>
                {
                    TextBox.SelectAll();
                    TextBox.Focus(FocusState.Programmatic);
                };

    TextBox: refers to another control 
    so my searchBox will not be on Focus state 


    Friday, December 20, 2013 12:03 PM

All replies

  • You should set the initial focus to a different control.

    You don't want to actually disable the control. That will prevent the user from tabbing to it later.

    --Rob

    Thursday, December 19, 2013 11:33 PM
    Moderator
  • Thanks Rob , i made it  

    i put this block of code into the constructor of the page

       
     base.Loaded += (s, e) =>
                {
                    TextBox.SelectAll();
                    TextBox.Focus(FocusState.Programmatic);
                };

    TextBox: refers to another control 
    so my searchBox will not be on Focus state 


    Friday, December 20, 2013 12:03 PM