コード例 #1
0
    /**
     * Returns the root widget defined in the widget doc, assuming it is a container widget.
     * If the root widget is NOT a container, this method will throw an exception.
     * The caller takes ownership of the widget.
     * This function can only be called once per widget doc instance!
     */
    public WidgetContainer GetRootContainer()
    {
        Trace.Assert(_rootWidget != null);
        if (!_rootWidget.IsContainer())
        {
            throw new Exception($"Expected root widget in '{_path}' to be a container.");
        }

        return((WidgetContainer)_rootWidget);
    }