Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Hiding control in gotfocus
Message
De
02/01/2013 12:34:59
 
 
À
02/01/2013 11:55:11
Information générale
Forum:
ASP.NET
Catégorie:
Windows Presentation Foundation (WPF)
Versions des environnements
Environment:
C# 4.0
Divers
Thread ID:
01561070
Message ID:
01561071
Vues:
38
>Hi,
>
>I have a textbox which binds to some underlying data. I also have an autocomplete combobox which I want to use to allow better searching than a plain combo will. However, it cannot bind to the underlying data (or at least I haven't been able to make it). So what I am trying to do is only show the autocomplete combo when the user actually clicks or moves to the textbox. Initially I make the combo invisible, then in the gotfocus of the textbox I want to hide the textbox and show the combo. I've tried this code:
>
>
        private void txtCus_Number_GotFocus(object sender, RoutedEventArgs e)
>        {
>            this.txtCus_Number.Visibility = Visibility.Hidden;
>            this.autoCustomers.Visibility = Visibility.Visible;
>            this.autoCustomers.Focus();
>
>        }
>
>        private void autoCustomers_LostFocus(object sender, RoutedEventArgs e)
>        {
>            this.autoCustomers.Visibility = Visibility.Hidden;
>            this.txtCus_Number.Visibility = Visibility.Visible;
>
>        }
>
>
>but the textbox never gets hidden. In VFP I might put a NODEFAULT in the gotfocus code. Is there something similar in C# or should I do this a different way?

Try Visibility.Collapsed instead. But you should be able to bind the autocomplete version. What have you tried ?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform