GMS.Web.OrgChart/Controls/StaffNode.cs

(开头部分) 5KB

这里只显示每个文件的开头 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 StaffNode : ContentControl
    {
        public Staff Staff
        {
            get { return (Staff)GetValue(StaffProperty); }
            set { SetValue(StaffProperty, value); }
        }

        // Using a DependencyProperty as the backing store for Staff.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty StaffProperty =
            DependencyProperty.Register("Staff", typeof(Staff), typeof(StaffNode), new PropertyMetadata(null));

        
        
        #region Ctor
        public StaffNode()
            : base()
        {
            this.DefaultStyleKey = typeof(StaffNode);
        }

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

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

            this.BindDragEvent();
            
        }

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

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

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

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

AI 解读

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

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