c# - Passing an object to a collection editor -
i'm trying build check list toolstripmenuitem
automatically handles checking , unchecking of item , provide event programmer allowing them handle happens next. if exists, love know is. i've created collection editor custom toolstripmenuitem
, can add check lists collection of checklists. problem create collection editor this:
[designerserializationvisibility(designerserializationvisibility.content), editor(typeof(toolstripitemextcollectioneditor), typeof(uitypeeditor))]
i need able pass toolstripmenuitem
's dropdownitems
collection editor when add new checklist , click on items property of checklist can add/remove 1 of known toolstripmenuitems to/from checklist. passing reference won't work since of happening inside attribute , wouldn't know begin if answer reflection.
this answer applies vb.net. plan on turning c# dll, it's in vb.net because that's started idea , language project in.
here's have far:
toolstripmenuitemext
purpose: custom toolstripmenuitem
.
toolstripmenuitemext
has checklistsheet
contains reference toolstripmenuitemext
's dropdownitems (i passed in dropdownitems byref , not byval). has 1 property returns checklists
object in checklistsheet
.
checklistsheet
purpose: maintains reference collection i'm observing through observable collection type , object of collection return in toolstripmenuitemext
.
checklistsheet
has checklists
object. dropdownitems pass in byref stored in observabletoolstripitemcollection
when testing allows me update collection of checklists easier since inherits observablecollection(of toolstripitemcollection)
. class has shared function returns observable collection has scope identifier of private shared.
checklists
purpose: collectionbase
type stores checklist
objects.
checklist
purpose: stores toolstripitemcollection
objects act single item checked checklist (only 1 item checked @ time).
this has properties designer , collection check list. i'll add in logic check , automatically uncheck , raise event it.
menuitemchecklistcollectioneditor
purpose: allows collection of known , instantiated toolstripitem
objects displayed , added checklist
.
right demands give type or array of types can establish type of collectioneditor
is. haven't able show drop down of types or drop down of toolstripitem
objects. class having toolstrip in name inherits toolstripitem why use type of object.
if anyone has advice on current answer or can forecast foreseeable pitfalls please share. don't care if talk in c# or vb.net. maybe need stop , turn c# code. maybe impossible. making progress though. extremely helpful figuring out how menustrip's collection editor able populate dropdown of toolstripitems
[update]
a collection editor requires provide type display. type has inherit collectionbase
means @ design time there's no way reference dropdownitems. :sigh:
Comments
Post a Comment