PropertyPresenter to display only Model properties

Mar 31, 2014 at 2:35 PM

I wanted to know if there was a way to display only a PropertyGrid for the model object of a Shape (and not for the Shape's properties).

I tried to assign only the SecondaryPropertyGrid property of the PropertyPresenter but when I move a shape on the display, the "propertyController_RefreshObjects()" method of the presenter is called with a page index of 0 (which correspond to the non-existing PropertyGrid).
Can you help me?

Mar 31, 2014 at 3:08 PM
  1. Create a PropertyController component (let's call it "propertyController")
  2. Create a PropertyPresenter component (let's call it "propertyPresenter")
  3. Create a Property Grid (let's call it "modelPropertyGrid")
  4. Assign modelPropertyController to the display's PropertyController property
  5. Assign the NShape Project component to the modelPropertyController's Project property
  6. Assign modelPropertyController to modelPropertyPresenter's PropertyController property
  7. Assign modelPropertyGrid to modelPropertyPresenter's SecondaryPropertyGrid property
When you select a shape with model object now, the property grid should display the model object's properties.
Don't mind about events being raised for pageIndex == 0: The property controller does not know the property presenter (or if there is one at all) so it fires events for all page indexes.
Mar 31, 2014 at 3:23 PM
Well, that's exactly what I did and I got an ArgumentOutOfRangeException when trying to move a Shape on the display. The stacktrace says it is coming from the "PropertyPresenter.propertyController_RefreshObjects(Object sender, PropertyControllerEventArgs e)" method, and the message says "Property page 0 does not exist.".
Apr 1, 2014 at 7:25 AM
You are right, I did not move the shape, I only created it (which works fine).
A mail containing the code change is on the way. The fix will also be available with the next release.
Marked as answer by roux1max on 4/1/2014 at 12:29 AM