title: How can I customize category sorting on a PropertyGrid?
body: <p>How can I customize the sorting of categories in a <code>PropertyGrid</code>?</p>
  
  <p>If I set either of the following...</p>
  
  <pre><code>propertyGrid.PropertySort = PropertySort.Categorized;
  propertyGrid.PropertySort = PropertySort.CategorizedAlphabetical;
  </code></pre>
  
  <p>... then the categories will be alphabetized. ("Alphabetical" would seem to apply to the properties within each category.) If I use <code>PropertySort.NoSort</code>, I lose categorization. </p>
  
  <p>I'm populating my <code>PropertyGrid</code> with <code>SelectObject</code>, which is pretty easy: </p>
  
  <pre><code>this.propertyGrid1.SelectedObject = options;
  </code></pre>
  
  <p><code>options</code> is an instance of a class with suitably decorated properties:</p>
  
  <pre><code>    [CategoryAttribute("Category Title"),
      DisplayName("Property Name"),
      Browsable(true),
      ReadOnly(false),
      BindableAttribute(true),
      DesignOnly(false),
      DescriptionAttribute("...")]
      public bool PropertyName {
          get {
              // ...
          }
  
          set {
              // ...
              this.OnPropertyChanged("PropertyName");
          }
      }
  </code></pre>
  
  <p>I have a few dozen properties in half a dozen categories. </p>
  
  <p>Is there some way I can adjust the category sort order while preserving my ease of use with <code>SelectedObject</code>? </p>