예제 #1
0
파일: Plotter.cs 프로젝트: nwelsheimer/NBS
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            headerPanel = GetPart <NotifyingStackPanel>("PART_HeaderPanel");
            footerPanel = GetPart <NotifyingStackPanel>("PART_FooterPanel");

            leftPanel   = GetPart <NotifyingStackPanel>("PART_LeftPanel");
            bottomPanel = GetPart <NotifyingStackPanel>("PART_BottomPanel");
            rightPanel  = GetPart <NotifyingStackPanel>("PART_RightPanel");
            topPanel    = GetPart <NotifyingStackPanel>("PART_TopPanel");

            mainCanvas     = GetPart <NotifyingCanvas>("PART_MainCanvas");
            centralGrid    = GetPart <NotifyingGrid>("PART_CentralGrid");
            mainGrid       = GetPart <NotifyingGrid>("PART_MainGrid");
            parallelCanvas = GetPart <NotifyingCanvas>("PART_ParallelCanvas");

            contentsGrid = GetPart <NotifyingGrid>("PART_ContentsGrid");
            Content      = contentsGrid;
            AddLogicalChild(contentsGrid);

            foreach (var notifyingItem in GetAllPanels())
            {
                if (notifyingItem.NotifyingChildren == null)
                {
                    notifyingItem.ChildrenCreated += notifyingItem_ChildrenCreated;
                }
                else
                {
                    notifyingItem.NotifyingChildren.CollectionChanged += OnVisualCollectionChanged;
                }
            }
        }
        public override void OnApplyTemplate()
        {
            //<function summary>
            //Override OnApplyTemplate to configure the Header, Footer, Grid, and Viewport
            //</function summary>
            //Call base classes OnApplyTemplate function
            base.OnApplyTemplate();

            //Assign template parts to variables
            headerPanel = GetPart <NotifyingStackPanel>("PART_HeaderPanel");
            footerPanel = GetPart <NotifyingStackPanel>("PART_FooterPanel");

            leftPanel   = GetPart <NotifyingStackPanel>("PART_LeftPanel");
            bottomPanel = GetPart <NotifyingStackPanel>("PART_BottomPanel");
            rightPanel  = GetPart <NotifyingStackPanel>("PART_RightPanel");
            topPanel    = GetPart <NotifyingStackPanel>("PART_TopPanel");

            mainCanvas     = GetPart <NotifyingCanvas>("PART_MainCanvas");
            centralGrid    = GetPart <NotifyingGrid>("PART_CentralGrid");
            mainGrid       = GetPart <NotifyingGrid>("PART_MainGrid");
            parallelCanvas = GetPart <NotifyingCanvas>("PART_ParallelCanvas");

            contentsGrid = GetPart <NotifyingGrid>("PART_ContentsGrid");
            Content      = contentsGrid;

            //Add contentGrid to the ContentControl
            AddLogicalChild(contentsGrid);

            //Set each panel Item (template part) to trigger notifyingItem_ChildrenCreated handler
            //If NotifyingChildren already set, set the CollectionChanged handler to OnVisualCollectionChanged
            foreach (var notifyingItem in GetAllPanels())
            {
                if (notifyingItem.NotifyingChildren == null)
                {
                    notifyingItem.ChildrenCreated += notifyingItem_ChildrenCreated;
                }
                else
                {
                    notifyingItem.NotifyingChildren.CollectionChanged += OnVisualCollectionChanged;
                }
            }
        }