示例#1
0
        /// <summary>
        /// Loads the template.
        /// </summary>
        /// <param name="template">Optional template instance</param>
        protected virtual void loadTemplate(GraphicObject template = null)
        {
            if (this.child != null)            //template change, bindings has to be reset
            {
                this.ClearTemplateBinding();
            }

            if (template == null)
            {
                if (!IFace.DefaultTemplates.ContainsKey(this.GetType().FullName))
                {
                    throw new Exception(string.Format("No default template found for '{0}'", this.GetType().FullName));
                }
                this.SetChild(IFace.Load(IFace.DefaultTemplates[this.GetType().FullName]));
            }
            else
            {
                this.SetChild(template);
            }
        }