Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Collection Editor

Collection Editor

Scheduled Pinned Locked Moved C#
designtutorial
8 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tomas Petricek
    wrote on last edited by
    #1

    Hi, I want to create my control witch have collection (containing only MyControlItem objects) as a property. (Something like ImageList with property called Images) And I want to use Collection Editor (in design mode click on "..."). But I don't know, how to change type of objects that are added (in Collection Editor) to the collection from object to MyControlItem. Thank you (and i'm sorry about my english) Tomáš Petříček

    L 1 Reply Last reply
    0
    • T Tomas Petricek

      Hi, I want to create my control witch have collection (containing only MyControlItem objects) as a property. (Something like ImageList with property called Images) And I want to use Collection Editor (in design mode click on "..."). But I don't know, how to change type of objects that are added (in Collection Editor) to the collection from object to MyControlItem. Thank you (and i'm sorry about my english) Tomáš Petříček

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      http://www.codeproject.com/script/comments/forums.asp?msg=291230&forumid=1649#xx291230xx[^] Wow, 36 hours before you even thought about it :laugh: Cheers Give them a chance! Do it for the kittens, dear God, the kittens!

      T 2 Replies Last reply
      0
      • L leppie

        http://www.codeproject.com/script/comments/forums.asp?msg=291230&forumid=1649#xx291230xx[^] Wow, 36 hours before you even thought about it :laugh: Cheers Give them a chance! Do it for the kittens, dear God, the kittens!

        T Offline
        T Offline
        Tomas Petricek
        wrote on last edited by
        #3

        :-O Thank you

        1 Reply Last reply
        0
        • L leppie

          http://www.codeproject.com/script/comments/forums.asp?msg=291230&forumid=1649#xx291230xx[^] Wow, 36 hours before you even thought about it :laugh: Cheers Give them a chance! Do it for the kittens, dear God, the kittens!

          T Offline
          T Offline
          Tomas Petricek
          wrote on last edited by
          #4

          :confused: I don't know how to do this What's wrong with this: public class DropDownItem { private string szName=""; public DropDownItem() { szName="DropDownItem1"; } public string Name { get { return szName; } set { szName=value; } } } public class DropDownCollection : CollectionBase { public DropDownCollection() { } public virtual void Add(DropDownItem val) { this.List.Add(val); } } Have you got some sample source or link ? Thank you

          L 1 Reply Last reply
          0
          • T Tomas Petricek

            :confused: I don't know how to do this What's wrong with this: public class DropDownItem { private string szName=""; public DropDownItem() { szName="DropDownItem1"; } public string Name { get { return szName; } set { szName=value; } } } public class DropDownCollection : CollectionBase { public DropDownCollection() { } public virtual void Add(DropDownItem val) { this.List.Add(val); } } Have you got some sample source or link ? Thank you

            L Offline
            L Offline
            leppie
            wrote on last edited by
            #5

            Hi Everything seems fine :) But (isnt there allways a butt?) you may need to add some extra methods to implement. Also, implement the collection in your class as follows:

            public class MyClass
            {
            DropDownCollection ddcol;

            public MyClass()
            {
            ddcol = new DropDownCollection();
            }

            public DropDownCollection DropDownItems
            { get { return ddcol;} } //note, NO set property
            }

            Nave a look at this as well, very handy for creating Strongly typed collections :) http://www.gotdotnet.com/userfiles/kristopher_johnson/TypedCollectionGenerator_1_3_0.zip[^] Hope it works this time :) Give them a chance! Do it for the kittens, dear God, the kittens!

            T 1 Reply Last reply
            0
            • L leppie

              Hi Everything seems fine :) But (isnt there allways a butt?) you may need to add some extra methods to implement. Also, implement the collection in your class as follows:

              public class MyClass
              {
              DropDownCollection ddcol;

              public MyClass()
              {
              ddcol = new DropDownCollection();
              }

              public DropDownCollection DropDownItems
              { get { return ddcol;} } //note, NO set property
              }

              Nave a look at this as well, very handy for creating Strongly typed collections :) http://www.gotdotnet.com/userfiles/kristopher_johnson/TypedCollectionGenerator_1_3_0.zip[^] Hope it works this time :) Give them a chance! Do it for the kittens, dear God, the kittens!

              T Offline
              T Offline
              Tomas Petricek
              wrote on last edited by
              #6

              Huh, it works now :) but I don't know why it doesn't works as I wrote but i have downloaded TypedCollectionGenerator and with this collection it works ;P (This link is better) http://kristopherjohnson.net/TypedCollectionGenerator/1.3.0/TypedCollectionGenerator_1_3_0.zip[^] Thank for your help Tomas

              L 1 Reply Last reply
              0
              • T Tomas Petricek

                Huh, it works now :) but I don't know why it doesn't works as I wrote but i have downloaded TypedCollectionGenerator and with this collection it works ;P (This link is better) http://kristopherjohnson.net/TypedCollectionGenerator/1.3.0/TypedCollectionGenerator_1_3_0.zip[^] Thank for your help Tomas

                L Offline
                L Offline
                leppie
                wrote on last edited by
                #7

                Tomas Petricek wrote: but I don't know why I was thinking about this. Perhaps it needs the indexer or the GetValueAt() functions implemented. OK I looked at the CollectionEditor's docs: Notes to Inheritors: This editor can edit collections that have an Item property. The editor can determine the type of the collection from the Item property, if it exists. If the collection does not have this property, or if you want to provide collections of more than one type, you can override certain protected members of this class to customize the editor to support other types of collections. Cheers :) Give them a chance! Do it for the kittens, dear God, the kittens!

                T 1 Reply Last reply
                0
                • L leppie

                  Tomas Petricek wrote: but I don't know why I was thinking about this. Perhaps it needs the indexer or the GetValueAt() functions implemented. OK I looked at the CollectionEditor's docs: Notes to Inheritors: This editor can edit collections that have an Item property. The editor can determine the type of the collection from the Item property, if it exists. If the collection does not have this property, or if you want to provide collections of more than one type, you can override certain protected members of this class to customize the editor to support other types of collections. Cheers :) Give them a chance! Do it for the kittens, dear God, the kittens!

                  T Offline
                  T Offline
                  Tomas Petricek
                  wrote on last edited by
                  #8

                  That's it :rolleyes:

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups