c# - Binding on key withing a custom class -


is possible bind on key within custom class possible dictionary?

i can bind dictionary binding:

"binding mydictionary[mykey]"  

but don´t want use dictionary custom class this:

public class datagridfield :  inotifypropertychanged {     [required]     [key]     public string key { get; set; }      private object value;     public object value     {                 {             return this.value;         }         set         {             this.value = value;             this.onpropertychanged("value");         }     } } 

now want access objects of class within observablecollection same way dictionary. there way achieve this?

you can, have implement indexer property:

public class datagridfield {     public string this[string index]     {         { return this.key; }         set         {             this.key = index;         }      }  } 

edit:

but if interested in having dictionary inotifyproperty/collectionchange implementation, can use observabledictionary


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -