public override void OnApplyTemplate() { base.OnApplyTemplate(); //------------------ _headerPanel = GetTemplateChild(HeaderPanelPartName) as Panel; if (_headerPanel != null) { _headerPanel.MouseLeftButtonDown += ContainerGridOnMouseDown; _headerPanel.MouseEnter += ContainerGridOnMouseEnter; _headerPanel.MouseLeave += ContainerGridOnMouseLeave; } //------------------ _childrenIndicatorBorder = GetTemplateChild(ChildrenIndicatorBorderPartName) as Border; if (_childrenIndicatorBorder != null) { _childrenIndicatorBorder.Visibility = _hasChildren ? Visibility.Visible : Visibility.Hidden; } //------------------ _percentsColorIndicatorBorder = GetTemplateChild(PercentsColorIndicatorBorderPartName) as Border; if (_percentsColorIndicatorBorder != null) { _percentsColorIndicatorBorder.Background = new SolidColorBrush(PercentsToColorConverter.Convert(_event.Percent)); } //------------------ _percentTextBlock = GetTemplateChild(PercentTextBlockPartName) as TextBlock; if (_percentTextBlock != null) { _percentTextBlock.Text = string.Format("{0}%", _event.Percent); } //------------------ _timeTextBlock = GetTemplateChild(TimeTextBlockPartName) as TextBlock; if (_timeTextBlock != null) { _timeTextBlock.Text = string.Format("{0}ms", _event.Time); } //------------------ _hitsTextBlock = GetTemplateChild(HitsTextBlockPartName) as TextBlock; if (_hitsTextBlock != null) { _hitsTextBlock.Text = string.Format("{0}hits", _event.Hits); } //------------------ _nameTextBlock = GetTemplateChild(NameTextBlockPartName) as TextBlock; if (_nameTextBlock != null) { _nameTextBlock.Text = _eventFormatter.FormatName(_event); } //------------------ _childrenItemsControl = GetTemplateChild(ChildrenItemsControlPartName) as ItemsControl; if (_childrenItemsControl != null) { _childrenItemsControl.Visibility = Visibility.Collapsed; } }
public override void OnApplyTemplate() { base.OnApplyTemplate(); //------------------ _headerPanel = GetTemplateChild(HeaderPanelPartName) as Panel; _contentPanel = GetTemplateChild(ContentPanelPartName) as Panel; _footerPanel = GetTemplateChild(FooterPanelPartName) as Panel; double eventPercent = NativeEventHelper.GetEventPercent(_event); //------------------ Border childrenIndicatorBorder = GetTemplateChild(ChildrenIndicatorBorderPartName) as Border; if (childrenIndicatorBorder != null) { childrenIndicatorBorder.Visibility = _event.HasChildren ? Visibility.Visible : Visibility.Hidden; } //------------------ Border percentsColorIndicatorBorder = GetTemplateChild(PercentsColorIndicatorBorderPartName) as Border; if (percentsColorIndicatorBorder != null) { percentsColorIndicatorBorder.Visibility = IsRootItem ? Visibility.Collapsed : Visibility.Visible; percentsColorIndicatorBorder.Background = new SolidColorBrush(PercentsToColorConverter.Convert(eventPercent)); } //------------------ TextBlock percentTextBlock = GetTemplateChild(PercentTextBlockPartName) as TextBlock; if (percentTextBlock != null) { percentTextBlock.Text = string.Format("{0}%", eventPercent); } //------------------ TextBlock timeTextBlock = GetTemplateChild(TimeTextBlockPartName) as TextBlock; if (timeTextBlock != null) { timeTextBlock.Text = string.Format("{0}ms", _event.Time); } //------------------ TextBlock hitsTextBlock = GetTemplateChild(HitsTextBlockPartName) as TextBlock; if (hitsTextBlock != null) { hitsTextBlock.Text = string.Format("{0}hits", _event.Hits); } //------------------ TextBlock nameTextBlock = GetTemplateChild(NameTextBlockPartName) as TextBlock; if (nameTextBlock != null) { nameTextBlock.Text = _eventMessageBuilder.BuildMessage(_event); } SynchronizeLevelOffset(LevelOffset); }