Popup getPopup(Color color, string title, Dictionary <string, int> requests, PopupLevelType type) { Popup popup = new Popup(); popup.Placement = PlacementMode.Mouse; DockPanel popupPanel = new DockPanel(); TextBlock popupTitle = new TextBlock(); popupTitle.Text = title; popup.Width = 400; popupTitle.TextWrapping = TextWrapping.Wrap; popupTitle.TextAlignment = TextAlignment.Center; popupTitle.FontSize = 16; popupTitle.Foreground = new SolidColorBrush(Colors.White); popupTitle.SetValue(DockPanel.DockProperty, Dock.Top); TextBlock popupNotation = new TextBlock(); popupNotation.Text = "Топ Запросов:"; popupNotation.TextAlignment = TextAlignment.Left; popupNotation.FontSize = 16; popupNotation.Foreground = new SolidColorBrush(Colors.White); popupNotation.SetValue(DockPanel.DockProperty, Dock.Top); DataGrid dataGrid = new DataGrid(); var displayRequests = (from r in requests select new { Request = r.Key, Value = type == PopupLevelType.Request ? r.Value.ToString("N", numFormat) : r.Value.ToString() }).ToList(); dataGrid.ItemsSource = displayRequests; dataGrid.ColumnWidth = new DataGridLength(50, DataGridLengthUnitType.Star); popupPanel.Children.Add(popupTitle); popupPanel.Children.Add(popupNotation); popupPanel.Children.Add(dataGrid); popupPanel.Background = new SolidColorBrush(color); Border borderPopup = new Border(); borderPopup.BorderThickness = new Thickness(1); borderPopup.BorderBrush = new SolidColorBrush(Colors.Coral); borderPopup.Child = popupPanel; popup.Child = borderPopup; return(popup); }
public NodeLevelInfo(LevelType levelType, PopupLevelType popupType, int value) { this.LevelType = levelType; this.PopupType = popupType; this.Value = value; }