public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { IEvent @event = (IEvent)values[0]; IEventMessageBuilder formatter = (IEventMessageBuilder)values[1]; return(formatter.BuildMessage(@event)); }
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); }