BaconographyW8.Common.SettingsFlyout.OnApplyTemplate C# (CSharp) Method

OnApplyTemplate() protected method

protected OnApplyTemplate ( ) : void
return void
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            // make sure we listen at the right time to add/remove the back button event handlers
            if(_backButton != null)
            {
                _backButton.Tapped -= OnBackButtonTapped;
            }
            _backButton = GetTemplateChild(PART_BACK_BUTTON) as Button;
            if(_backButton != null)
            {
                _backButton.Tapped += OnBackButtonTapped;
            }

            // need to get these grids in order to set the offsets correctly in RTL situations
            if (_contentGrid == null)
            {
                _contentGrid = GetTemplateChild(PART_CONTENT_GRID) as Grid;
            }
            if (_contentGrid != null)
            {
                _contentGrid.Transitions = new TransitionCollection();
                _contentGrid.Transitions.Add(new EntranceThemeTransition()
                                                 {
                                                     FromHorizontalOffset = (SettingsPane.Edge == SettingsEdgeLocation.Right) ? CONTENT_HORIZONTAL_OFFSET : (CONTENT_HORIZONTAL_OFFSET * -1)
                                                 });
            }

            // need the root border for RTL scenarios
            _rootBorder = GetTemplateChild(PART_ROOT_BORDER) as Border;

            // need the content scrollviewer to set the fixed width to be the same size as flyout
            _contentScrollViewer = GetTemplateChild(PART_CONTENT_SCROLLVIEWER) as ScrollViewer;
            
        }
        #endregion Overrides