public PagePerformance() { InitializeComponent(); StackPanel panelContent = new StackPanel(); panelContent.Margin = new Thickness(10, 0, 10, 0); panelContent.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; ContentControl txtHeader = new ContentControl(); txtHeader.ContentTemplate = this.Resources["PerformanceHeader"] as DataTemplate; txtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; panelContent.Children.Add(txtHeader); ListBox lbCounters = new ListBox(); lbCounters.ItemTemplate = this.Resources["PerformanceItem"] as DataTemplate; lbCounters.MaxHeight = GraphicsHelpers.GetContentHeight() - 50; lbCounters.ItemContainerStyleSelector = new ListBoxItemStyleSelector(); foreach (string pageCounter in PerformanceCounters.GetPages()) { lbCounters.Items.Add(pageCounter); } panelContent.Children.Add(lbCounters); base.setContent(panelContent); base.setHeaderContent("Performance Counters"); showPage(this); }