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. PropertyGrid fails to group a property marked as being in Category Behavior.

PropertyGrid fails to group a property marked as being in Category Behavior.

Scheduled Pinned Locked Moved C#
algorithmsquestion
12 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.
  • P Offline
    P Offline
    Paw Jershauge
    wrote on last edited by
    #1

    Hmm this is funny, I've made some classes with some properties, and I wanted them to be grouped into categories in the propertygrid. so ofcause I added the Category Attribute and set the value to Behavior, and wouldn't you know it, the PropertyGrid Groups it as Type ??? anyone ever seen this ?? Heres an sample class

    public class Demo
    {
    [Category("Behavior")]
    public int Total
    {
    get;
    set;
    }
    }

    Try display this in the PropertyGrid. perhaps its only my computer that makes this fault. :wtf: :wtf: :wtf:

    With great code, comes great complexity, so keep it simple stupid...:-\ :-\

    L 1 Reply Last reply
    0
    • P Paw Jershauge

      Hmm this is funny, I've made some classes with some properties, and I wanted them to be grouped into categories in the propertygrid. so ofcause I added the Category Attribute and set the value to Behavior, and wouldn't you know it, the PropertyGrid Groups it as Type ??? anyone ever seen this ?? Heres an sample class

      public class Demo
      {
      [Category("Behavior")]
      public int Total
      {
      get;
      set;
      }
      }

      Try display this in the PropertyGrid. perhaps its only my computer that makes this fault. :wtf: :wtf: :wtf:

      With great code, comes great complexity, so keep it simple stupid...:-\ :-\

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Paw Jershauge wrote:

      Try display this in the PropertyGrid.

      I've tried using your code, and it seems to work;

      public partial class MainForm : Form
      {
      PropertyGrid grid = new PropertyGrid();
      Demo myDemo = new Demo();

      public MainForm()
      {
          InitializeComponent();
      	
          grid.Dock = DockStyle.Fill;
          grid.SelectedObject = myDemo;
          Controls.Add(grid);			
      }
      

      }
      public class Demo
      {
      [Category("Behavior")]
      public int Total
      {
      get;
      set;
      }
      }

      Are you inheriting from Object, as the snippet suggests?

      I are Troll :suss:

      P 1 Reply Last reply
      0
      • L Lost User

        Paw Jershauge wrote:

        Try display this in the PropertyGrid.

        I've tried using your code, and it seems to work;

        public partial class MainForm : Form
        {
        PropertyGrid grid = new PropertyGrid();
        Demo myDemo = new Demo();

        public MainForm()
        {
            InitializeComponent();
        	
            grid.Dock = DockStyle.Fill;
            grid.SelectedObject = myDemo;
            Controls.Add(grid);			
        }
        

        }
        public class Demo
        {
        [Category("Behavior")]
        public int Total
        {
        get;
        set;
        }
        }

        Are you inheriting from Object, as the snippet suggests?

        I are Troll :suss:

        P Offline
        P Offline
        Paw Jershauge
        wrote on last edited by
        #3

        What kind of OS er you using ??? also Windows 7 64bit ??? I have made a screendump. take a look here ScreenDump

        With great code, comes great complexity, so keep it simple stupid...:-\ :-\

        L 1 Reply Last reply
        0
        • P Paw Jershauge

          What kind of OS er you using ??? also Windows 7 64bit ??? I have made a screendump. take a look here ScreenDump

          With great code, comes great complexity, so keep it simple stupid...:-\ :-\

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Paw Jershauge wrote:

          What kind of OS er you using ??? also Windows 7 64bit ???

          Windows XP, 32 bit. I'm getting a category-heading as expected, both with .NET 3.5 as with 4.0. Is it only reproducable on 64-bit Weven?

          I are Troll :suss:

          P 1 Reply Last reply
          0
          • L Lost User

            Paw Jershauge wrote:

            What kind of OS er you using ??? also Windows 7 64bit ???

            Windows XP, 32 bit. I'm getting a category-heading as expected, both with .NET 3.5 as with 4.0. Is it only reproducable on 64-bit Weven?

            I are Troll :suss:

            P Offline
            P Offline
            Paw Jershauge
            wrote on last edited by
            #5

            Dont know, will look into it tomorrow on work... but its kind of funny dont you think ? ;) I think i will try different kinds of OS's and 32 & 64 bit versions to see if i can get the fault. But still i dont know why... i have asked microsoft, but still no answer...

            With great code, comes great complexity, so keep it simple stupid...:-\ :-\

            L 1 Reply Last reply
            0
            • P Paw Jershauge

              Dont know, will look into it tomorrow on work... but its kind of funny dont you think ? ;) I think i will try different kinds of OS's and 32 & 64 bit versions to see if i can get the fault. But still i dont know why... i have asked microsoft, but still no answer...

              With great code, comes great complexity, so keep it simple stupid...:-\ :-\

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Paw Jershauge wrote:

              Dont know, will look into it tomorrow on work... but its kind of funny dont you think ?

              That it is - I'm curious what caused it.

              Paw Jershauge wrote:

              i have asked microsoft, but still no answer...

              Over Microsoft Connect?

              P 2 Replies Last reply
              0
              • L Lost User

                Paw Jershauge wrote:

                Dont know, will look into it tomorrow on work... but its kind of funny dont you think ?

                That it is - I'm curious what caused it.

                Paw Jershauge wrote:

                i have asked microsoft, but still no answer...

                Over Microsoft Connect?

                P Offline
                P Offline
                Paw Jershauge
                wrote on last edited by
                #7

                Yes over Connect... the reason I posted it here, was to see if others had the same experience. When i get the answer i will post it here.

                With great code, comes great complexity, so keep it simple stupid...:-\ :-\

                1 Reply Last reply
                0
                • L Lost User

                  Paw Jershauge wrote:

                  Dont know, will look into it tomorrow on work... but its kind of funny dont you think ?

                  That it is - I'm curious what caused it.

                  Paw Jershauge wrote:

                  i have asked microsoft, but still no answer...

                  Over Microsoft Connect?

                  P Offline
                  P Offline
                  Paw Jershauge
                  wrote on last edited by
                  #8

                  Just a short follow up: The same happens on a Vista 64 bit. So the error/bug is now confirmed on the following OS: - Windows 7 (64 bit) - Vista (64 bit) Its running correctly on (No bug): - Windows 7 (32 bit) - Vista (32 bit) - Xp (32 bit)

                  With great code, comes great complexity, so keep it simple stupid...:-\ :-\

                  L 1 Reply Last reply
                  0
                  • P Paw Jershauge

                    Just a short follow up: The same happens on a Vista 64 bit. So the error/bug is now confirmed on the following OS: - Windows 7 (64 bit) - Vista (64 bit) Its running correctly on (No bug): - Windows 7 (32 bit) - Vista (32 bit) - Xp (32 bit)

                    With great code, comes great complexity, so keep it simple stupid...:-\ :-\

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #9

                    Thanks, good to have a future reference :)

                    I are Troll :suss:

                    P 1 Reply Last reply
                    0
                    • L Lost User

                      Thanks, good to have a future reference :)

                      I are Troll :suss:

                      P Offline
                      P Offline
                      Paw Jershauge
                      wrote on last edited by
                      #10

                      Ok so heres the real bug, although its not really a bug, its more a culture thing. When running the propertygrid in the danish language, the following CategoryAttribute will be translated: Category("Appearance") = Udseende Category("Behavior") = Type (the correct word for this would be "adfærd" or "opførsel" and NOT Type) Category("Data") = Data Category("Font") = Skrifttype Category("List") = Oversigt (the correct word for this would be "List" or "Liste" and NOT Oversigt) Category("Misc") = Diverse Category("Position") = Placering Category("Scale") = Skalering Category("Text") = Tekst I didnt consider the culture thing because translating Behavior to danish is not Type I've posted the information on my blog here: C# and I[^]

                      With great code, comes great complexity, so keep it simple stupid...:-\ :-\

                      L 1 Reply Last reply
                      0
                      • P Paw Jershauge

                        Ok so heres the real bug, although its not really a bug, its more a culture thing. When running the propertygrid in the danish language, the following CategoryAttribute will be translated: Category("Appearance") = Udseende Category("Behavior") = Type (the correct word for this would be "adfærd" or "opførsel" and NOT Type) Category("Data") = Data Category("Font") = Skrifttype Category("List") = Oversigt (the correct word for this would be "List" or "Liste" and NOT Oversigt) Category("Misc") = Diverse Category("Position") = Placering Category("Scale") = Skalering Category("Text") = Tekst I didnt consider the culture thing because translating Behavior to danish is not Type I've posted the information on my blog here: C# and I[^]

                        With great code, comes great complexity, so keep it simple stupid...:-\ :-\

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #11

                        Cool, good to have it logged. Let's hope it'll be rectified in the next update :)

                        I are Troll :suss:

                        P 1 Reply Last reply
                        0
                        • L Lost User

                          Cool, good to have it logged. Let's hope it'll be rectified in the next update :)

                          I are Troll :suss:

                          P Offline
                          P Offline
                          Paw Jershauge
                          wrote on last edited by
                          #12

                          Well I found since I just downloaded the VS 2010 RTM, that its corrected in the framework 4.0, but having thats said, I dont know if danish version will be corrected... hehe lets see when that come out.

                          With great code, comes great complexity, so keep it simple stupid...:-\ :-\

                          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