Subclassing DiagramPanel

I’m sure this is something simple, but I am trying to subclass DiagramPanel in order to implement ComputeBounds, and am running into this error: “The property ‘Diagram.Panel’ cannot be set because it does not have an accessible set accessor”.


<go:Diagram x:Name="myDiagram>
            ...
            <go:Diagram.Panel>
                <local:MyDiagramPanel />
            </go:Diagram.Panel>
            ...
</go:Diagram>

How do I set the panel to the one I’ve implemented?

You have to replace the Diagram’s ControlTemplate.

Copy the default ControlTemplate for Diagram that is defined in the Generic XAML file that is in the “docs” subdirectory. Replace the go:DiagramPanel with your class. Set the Diagram.Template to the ControlTemplate.