private void AssignVar_Click(object sender, RoutedEventArgs e)
        {
            if (Node == null || string.IsNullOrEmpty(Parameter))
            {
                return;
            }

            FuncMenuItem  fmenu  = sender as FuncMenuItem;
            FunctionGraph g      = fmenu.Graph;
            Graph         parent = g.ParentNode != null ? g.ParentNode.ParentGraph : g.ParentGraph;

            parent.RemoveParameterValueNoDispose(fmenu.Key);
            g.Name = Node.Name + " - " + Parameter.Replace("$Custom.", "") + " Function";

            CreateFunctionParameter(g);
        }
        public PropertyLabel(string title, Node n = null, string param = null)
        {
            InitializeComponent();
            Title = title;

            Node      = n;
            Parameter = param;

            if (Node != null && !string.IsNullOrEmpty(Parameter))
            {
                if (!Parameter.StartsWith("$Custom."))
                {
                    var prop = Node.GetType().GetProperty(Parameter);
                    if (prop != null && prop.GetCustomAttribute <PromoteAttribute>() == null)
                    {
                        EditVar.Visibility = Visibility.Collapsed;
                        return;
                    }
                }

                EditVar.Visibility = Visibility.Visible;

                var p = Node.ParentGraph;

                p = p.ParentNode != null ? p.ParentNode.ParentGraph : p;

                if (p != null)
                {
                    if (p.HasParameterValue(Node.Id, Parameter.Replace("$Custom.", "")))
                    {
                        if (p.IsParameterValueFunction(Node.Id, Parameter.Replace("$Custom.", "")))
                        {
                            FIcon.Opacity = 1;
                        }
                        else
                        {
                            FIcon.Opacity = 0.25;
                        }

                        ConstantVar.IsEnabled = false;
                        FunctionVar.IsEnabled = false;
                        AssignVar.IsEnabled   = false;
                        DefaultVar.IsEnabled  = true;
                    }
                    else
                    {
                        FIcon.Opacity         = 0.25;
                        DefaultVar.IsEnabled  = false;
                        AssignVar.IsEnabled   = true;
                        ConstantVar.IsEnabled = true;
                        FunctionVar.IsEnabled = true;
                    }
                }

                var functionsAvailable = Node.ParentGraph.ParameterFunctions;

                AssignVar.Items.Clear();

                foreach (string k in functionsAvailable.Keys)
                {
                    FunctionGraph f     = functionsAvailable[k];
                    MenuItem      mitem = new FuncMenuItem(f, k);
                    mitem.Click += AssignVar_Click;
                    AssignVar.Items.Add(mitem);
                }
            }
            else
            {
                EditVar.Visibility = Visibility.Collapsed;
            }
        }