public static bool IsGraphTemplateSuitable(GraphDocument graphTemplate, out string problemDescription)
        {
            // Make sure that the graph contains an XYPlotLayer

            if (0 == graphTemplate.RootLayer.Layers.Count)
            {
                problemDescription = "The graph does not contain any layers besides the root layer.";
                return(false);
            }

            var xyzlayer = (XYZPlotLayer)TreeNodeExtensions.AnyBetweenHereAndLeaves <HostLayer>(graphTemplate.RootLayer, x => x is XYZPlotLayer);

            if (null == xyzlayer)
            {
                problemDescription = "The graph does not contain any x-y-z plot layer.";
                return(false);
            }

            if (!(xyzlayer.CoordinateSystem is CS.G3DCartesicCoordinateSystem))
            {
                problemDescription = "The first x-y-z plot layer found does not contain a cartesic coordinate system.";
                return(false);
            }

            problemDescription = null;
            return(true);
        }
        private FitFunctionLeafNode SelectFitFunction(IFitFunction func)
        {
            var selNode = (FitFunctionLeafNode)TreeNodeExtensions.AnyBetweenHereAndLeaves(_fitFunctionsRoot, (node) => node is FitFunctionLeafNode dln && dln.FunctionType is DocumentFitFunctionInformation dffi && func.Equals(dffi.FitFunction));

            if (null != selNode)
            {
                selNode.IsExpanded = true;
                selNode.IsSelected = true;
            }

            return(selNode);
        }