private void tabControl1_PreviewMouseRightButtonUp(object sender, MouseButtonEventArgs e)
        {
            
            Mouse.OverrideCursor = null;

            // If "Add link" mode enabled and line drawing started (line placed to canvas)
            if (isAddNewLink && isLinkStarted)
            {
                // declare the linking state
                bool linked = false;
                // We released the button on MyThumb object
                if (e.Source.GetType() == typeof(MyThumb))
                {
                    MyThumb targetThumb = e.Source as MyThumb;
                    // define the final endpoint of line
                    link.EndPoint = e.GetPosition(canvas1);
                    // if any line was drawn (avoid just clicking on the thumb)
                    if (link.EndPoint != link.StartPoint && linkedThumb != targetThumb && linkedThumb!=null)
                    {
                        // establish connection
                        linkedThumb.LinkTo(targetThumb, link);
                        // set linked state to true
                        linked = true;

                        DinamicComponentPresenter prop = new DinamicComponentPresenter();

                        Component cc = LoadedComponents[linkedThumb.Title];

                        prop.Name = cc.Name;
                        foreach (var item in cc.Items)
                        {
                            prop.val.Add(item.name, "");
                        }

                        entityfile.Components.Add(prop);
                        
                        ComponentProperty cp = new ComponentProperty(prop);
                        cp.Name = linkedThumb.Title;

                        AddComponent(cp);
                    }
                }
                // if we didn't manage to approve the linking state
                // button is not released on MyThumb object or double-clicking was performed
                if (!linked)
                {
                    // remove line from the canvas
                    connectors.Children.Remove(link);
                    // clear the link variable
                    link = null;
                }

                // exit link drawing mode
                isLinkStarted = isAddNewLink = false;
                // configure GUI
                //btnNewAction.IsEnabled = btnNewLink.IsEnabled = true;
                Mouse.OverrideCursor = null;
                e.Handled = true;
            }
            
        }
 public ComponentProperty(DinamicComponentPresenter pres)
 {
     this.presenter = pres;
 
 }