Exemplo n.º 1
0
 /// <summary>
 /// Updates the data we are displaying about the selection when it changes
 /// </summary>
 /// <param name="selection">The new selection</param>
 private void UpdateSelection(IEnumerable <IViewModel> selection)
 {
     // Clear the current selection and handle the null case
     SelectedItems.Clear();
     if (selection == null)
     {
         return;
     }
     foreach (var item in selection)
     {
         // Gather some information about each selected item
         var model     = item.Model as Element;
         var viewModel = item as NodeViewModel;
         if (model != null)
         {
             var info = new SelectionDisplayInfo()
             {
                 Name = model.Documentation.Name,
                 Type = model.SpecificKind
             };
             if (viewModel != null)
             {
                 var image = RenderData.NineGridToImage(viewModel.IconData, new Size(16, 16));
                 info.Image = image;
             }
             SelectedItems.Add(info);
         }
     }
 }