GMS.Web.OrgChart/Controls/BranchNode.cs

(开头部分) 6KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using GMS.Web.OrgChart.Models;
using System.Windows.Controls.Primitives;
using System.Windows.Media;

namespace GMS.Web.OrgChart.Controls
{
    public class BranchNode : ContentControl
    {
        public Branch Branch
        {
            get { return (Branch)GetValue(BranchProperty); }
            set { SetValue(BranchProperty, value); }
        }

        // Using a DependencyProperty as the backing store for Branch.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty BranchProperty =
            DependencyProperty.Register("Branch", typeof(Branch), typeof(BranchNode), new PropertyMetadata(null));
    
        #region Ctor
        public BranchNode()
            : base()
        {
            this.DefaultStyleKey = typeof(BranchNode);
        }

        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            var edit = this.GetTemplateChild("edit") as ButtonBase;
            if (edit != null)
            {
                edit.Click += (s, e) =>
                    {
                        var branchEdit = new BranchEdit();
                        branchEdit.DataContext = this.Branch;
                        branchEdit.Show();
                    };
            }

            this.titlePanel = this.GetTemplateChild("titlePanel") as Border;

            if (this.Branch.ParentBranch != null)
                this.BindDragEvent();
        }

        private void BindDragEvent()
        {
            bool isDragging = false;
            Point lastPosition = new Point(0, 0);

            Popup rootPopup = new Popup();
            BranchNode ghostContainer = null;

            Branch parentBranch = null;
            Border lastTitlePanel = null;
后面还有 119 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。