Startup graph with no elements

Jul 1, 2011 at 3:48 PM

At the beginning of a program I have a GraphLayout which does not contain any elements.  I'm assuming it is trying to do a layout and throws a InvalidOperationException "Sequence contains no elements."  Is there a way to disable layout until items are added from markup or a property.  I don't want to go messing with the GraphSharp source if I don't have to.

Jul 1, 2011 at 3:53 PM

Nevermind just found the answer to my own question.  In my own derived GraphLayout class (JobGraphLayout) I overrode the CanLayout property as such.

 

        protected override bool CanLayout
        {
            get
            {
                return this._vertexControls.Count != 0;
            }
        }

Any other suggestions are welcome or if anyone knows a danger with not using base.CanLayout.