예제 #1
0
        public override void OnApplyTemplate()
        {
            _myGridContainer = base.Template.FindName("PART_GlobalContainer", this) as Grid;
            var itemsControl = base.Template.FindName("PART_TilesItemsControl", this) as ItemsControl;

            // TODO : pb with the search of elements in the custom control.
            _animateAction = new AnimateAction();
            _listActions   = new Dictionary <TileAnimationDirection, Action>()
            {
                {
                    TileAnimationDirection.TopDown, AnimateChildTopToDown
                },
                {
                    TileAnimationDirection.BottomUp, AnimateChildBottomTop
                },
                {
                    TileAnimationDirection.LeftRight, AnimateChildLeftRight
                },
                {
                    TileAnimationDirection.RightLeft, AnimateChildRightLeft
                }
            };

            base.OnApplyTemplate();

            // Apply the templates and retrieve the needed part.
            itemsControl.ApplyTemplate();
            var presenter = itemsControl.Template.FindName("PART_TilesPresenter", itemsControl) as ItemsPresenter;

            presenter.ApplyTemplate();
            _myStackPanelContainer = itemsControl.ItemsPanel.FindName("PART_TilesContainer", presenter) as StackPanel;

            _listActions[AnimationDirection]();
        }
예제 #2
0
        public override void OnApplyTemplate()
        {
            _myGridContainer = base.Template.FindName("PART_GlobalContainer", this) as Grid;
            var itemsControl = base.Template.FindName("PART_TilesItemsControl", this) as ItemsControl;

            // TODO : pb with the search of elements in the custom control. 
            _animateAction = new AnimateAction();
            _listActions = new Dictionary<TileAnimationDirection, Action>()
            {
                {
                    TileAnimationDirection.TopDown, AnimateChildTopToDown
                },
                {
                    TileAnimationDirection.BottomUp, AnimateChildBottomTop
                }, 
                {
                    TileAnimationDirection.LeftRight, AnimateChildLeftRight
                },
                {
                    TileAnimationDirection.RightLeft, AnimateChildRightLeft
                }
            };

            base.OnApplyTemplate();

            // Apply the templates and retrieve the needed part.
            itemsControl.ApplyTemplate();
            var presenter = itemsControl.Template.FindName("PART_TilesPresenter", itemsControl) as ItemsPresenter;
            presenter.ApplyTemplate();
            _myStackPanelContainer = itemsControl.ItemsPanel.FindName("PART_TilesContainer", presenter) as StackPanel;

            _listActions[AnimationDirection]();
        }