IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Windows Forms Discussion :

Probleme avec binding d'une propriete


Sujet :

Windows Forms

  1. #1
    Membre averti Avatar de Seth77
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Octobre 2005
    Messages
    1 448
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France, Bas Rhin (Alsace)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Octobre 2005
    Messages : 1 448
    Points : 410
    Points
    410
    Par défaut Probleme avec binding d'une propriete
    Salut

    je vient de tomber sur un probleme ; si quelqu un peut confirmer ma conclusion.

    Je fais un binding d'une propriete d'une classe :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    _siteBindingSource = new BindingSource(this.components);
    this.textEditName.DataBindings.Add(new System.Windows.Forms.Binding("Text", _siteBindingSource, "Name", true, DataSourceUpdateMode.OnPropertyChanged));
    J ai remarque que le binding genere une exception lorsque la propriete en question est decore avec l'attribut :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
     
            [Browsable(false)]
            public virtual string Name
    		{
    			get { return _name; }
    			set
    			{
    				if (_name != value)
    				{
    					_name = value;
    					OnPropertyChanged("Name");
    					DoValidation();
    				}
    			}
    		}
    Sinon cela marche bien !

    Normal ou pas ?

    Merci d avance !

  2. #2
    Membre éclairé
    Avatar de shwin
    Profil pro
    Inscrit en
    Novembre 2003
    Messages
    568
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Novembre 2003
    Messages : 568
    Points : 777
    Points
    777
    Par défaut
    Oui, c'est tout a fait normal. Le databinding se sert du PropertyDescriptorCollection.

    Et le browsable sert à controller cette collection
    The next example shows how to check the value of the BrowsableAttribute for MyProperty. First, the code gets a PropertyDescriptorCollection with all the properties for the object. Next, the code indexes into the PropertyDescriptorCollection to get MyProperty. Then it returns the attributes for this property and saves them in the attributes variable.
    Remoting Context Matters
    Everything in this chapter is 100 percent undocumented. Reliance on these techniques is not supported by either Microsoft, the publisher, or the author of this book. Use at you own risk! If your computer won't work afterwards, your toaster blows up or your car doesn't start, I assume no liability whatsoever: You're now about to enter the uncharted territories of .NET and you do so on your own risk. I can only provide some guidance

Discussions similaires

  1. Réponses: 2
    Dernier message: 02/06/2006, 11h20
  2. [MFC]Probleme avec attributs d'une LOGFONT
    Par Fildz dans le forum MFC
    Réponses: 3
    Dernier message: 08/01/2006, 17h59
  3. Probleme avec replace() et une "Cote"
    Par Yannis06 dans le forum Oracle
    Réponses: 3
    Dernier message: 11/10/2005, 11h48
  4. Problème avec bind
    Par jaabouc dans le forum Réseau
    Réponses: 5
    Dernier message: 12/06/2005, 14h32
  5. Réponses: 3
    Dernier message: 26/01/2004, 17h59

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo