public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { List <PagePerformanceCounter> counters = PerformanceCounters.GetPerformanceCounters(value.ToString()); string type = parameter.ToString(); if (type == "A") { return(counters.Average(c => c.Counter)); } if (type == "H") { return(counters.Max(c => c.Counter)); } if (type == "L") { return(counters.Min(c => c.Counter)); } if (type == "C") { return(counters.Count); } return(0); }