c# - Find Control in collection - event ControlAvailable Disabled -
in lightswitch app need add small image control every row, when clicking on , should send detail screen. made silverlight control , added lightswitch app.
partial void vidcontentitemressources_loaded(bool succeeded) { int index = 0; foreach (vidcontentitemressourcesitem cust in this.vidcontentitemressources) { this.findcontrolincollection("imagelinkicon", this.vidcontentitemressources.elementat(index)) .controlavailable += (s, e) => { mylinkimage = (e.control linkimage); mylinkimage.mouseleftbuttondown += mylinkimage_mouseleftbuttondown; }; index++; } }
but if error event control available can't used on controls in collection ..
so tried this
linkimage neco = this.findcontrolincollection("imagelinkicon", this.vidcontentitemressources.elementat(index)) linkimage; neco.mouseleftbuttondown += mylinkimage_mouseleftbuttondown;
but neco allways null because trying load control before it's available... solution pls ?
these types of initialisations should go in screen's created method, way you're guaranteed of controls on screen have been created. if of screen's methods (like initializedataworkspace, created, saving etc) aren't in code file, can create them using write code dropdown box in screen editor.
Comments
Post a Comment