private void GraphDocumentView_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            var doc  = DataContext as XamlDocument;
            var menu = new Graphing.UI.WPF.GraphContextMenu();

            doc.AvalonDocument.TextChanged += AvalonXamlDocument_TextChanged;
            doc.PropertyChanged            += Doc_PropertyChanged;
        }
        private void CSDocumentView_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            var doc = DataContext as CSDocument;

            //graphControl.Graph = doc.Graph;
            graphControl.DataContext = doc.Graph;
            var menu = new Graphing.UI.WPF.GraphContextMenu();

            menu.DataContext       = new CSGraphContextMenuProvider(doc.Graph, menu, doc.Document);
            graphControl.PopupMenu = menu; // { StaysOpen = true };
        }