public void Refresh() { itemsView.Children.Clear(); foreach (var plugin in _manager.GetPlugins()) { var itemView = new ItemView(); itemView.Icon = Icons.Icon.Layer; itemView.Content = plugin.Name; itemView.Margin = new Thickness(1); itemView.Tag = _manager .GetPluginsTypesInfos() .Where(x => x.Plugin.Equals(plugin)) .Select(x => x.Type) .ToArray(); itemsView.Children.Add(itemView); } if (itemsView.GetItems().Any()) { itemsView.GetItems().First().Selected = true; } else { btRemovePlugin.Visibility = Visibility.Collapsed; spPluginTypes.Children.Clear(); } }