Exemple #1
0
        public string Format(IModelingDesignerComponent component)
        {
            var block = component as BlockControl;
            var title = block.TypeName;

            //在设计器中检测,如果有命名冲突,则显示全类型名。
            var designer = ModelingDesigner.GetDesigner(component as DependencyObject);

            if (designer != null)
            {
                if (designer.Blocks.Any(a => a != block && a.TypeName == title))
                {
                    title = block.TypeFullName;
                }
            }

            //如果有 label,则附加显示 Label。
            var label = block.Label;

            if (!string.IsNullOrWhiteSpace(label))
            {
                title += "(" + label + ")";
            }

            return(title);
        }
Exemple #2
0
 public static void SetComponent(Control element, IModelingDesignerComponent value)
 {
     element.SetValue(ComponentPropertyKey, value);
 }
Exemple #3
0
 public static void SetComponent(Control element, IModelingDesignerComponent value)
 {
     element.SetValue(ComponentPropertyKey, value);
 }