protected override void OnApplyTemplate() { m_applyTemplateCalled = true; var closeButton = GetTemplateChild <Button>(c_closeButtonName); if (closeButton != null) { closeButton.Click += OnCloseButtonClick; // Do localization for the close button if (string.IsNullOrEmpty(AutomationProperties.GetName(closeButton))) { var closeButtonName = ResourceAccessor.GetLocalizedStringResource(ResourceAccessor.SR_InfoBarCloseButtonName); AutomationProperties.SetName(closeButton, closeButtonName); } // Setup the tooltip for the close button var tooltip = new ToolTip(); var closeButtonTooltipText = ResourceAccessor.GetLocalizedStringResource(ResourceAccessor.SR_InfoBarCloseButtonTooltip); tooltip.Content = closeButtonTooltipText; ToolTipService.SetToolTip(closeButton, tooltip); } var iconTextblock = GetTemplateChild <FrameworkElement>(c_iconTextBlockName); if (iconTextblock != null) { m_standardIconTextBlock = iconTextblock; AutomationProperties.SetName(iconTextblock, ResourceAccessor.GetLocalizedStringResource(GetIconSeverityLevelResourceName(Severity))); } var contentRootGrid = GetTemplateChild <Button>(c_contentRootName); if (contentRootGrid != null) { AutomationProperties.SetLocalizedLandmarkType(contentRootGrid, ResourceAccessor.GetLocalizedStringResource(ResourceAccessor.SR_InfoBarCustomLandmarkName)); } UpdateVisibility(m_notifyOpen, true); m_notifyOpen = false; UpdateSeverity(); UpdateIcon(); UpdateIconVisibility(); UpdateCloseButton(); UpdateForeground(); }