How to set attributes for items in a PropertyGrid?

Hello all,

i´m trying to create a .NET PropertyGrid inside a WinForm with Python. The grid shows as expected but i am unable to set common attributes of the properties displayed as outlined in this tutorial.

Stripped down example:

import System
from System.Drawing import *
from System.ComponentModel import *
from System.Windows.Forms import *
    
class OptionsDialog(System.Windows.Forms.Form):
    def __init__(self):
        OptionsPropertyGrid = PropertyGrid()
        OptionsPropertyGrid.Size = Size(280, 260)
        self.Controls.Add(OptionsPropertyGrid)
        self.Text = "Options"
        appset = AppSettings()
        OptionsPropertyGrid.SelectedObject = appset
    
class AppSettings():
    def __init__(self):
        [CategoryAttribute("MySettings")]
        self.SaveOnClose = True
    
d = OptionsDialog()
d.ShowDialog() 
d.Dispose()

The property named SaveOnClose shows as expected but not in the Category i have set. It always is displayed in the “misc” Category. How is the CategoryAttribute properly assigned via Python ?

c.