예제 #1
0
        private void AddListElement()
        {
            var newItem = new ListElementViewModel {
                Description = "List Element"
            };

            ListElements.Add(newItem);
            newItem.Selected = true;
        }
예제 #2
0
 public void Add(Elements anElement)
 {
     try
     {
         for (int i = 0; i < Number; i++)
         {
             if (ListElements[i] == anElement)
             {
                 throw new Exception($"Error: Element {anElement.Name} already exists in elements-list");
             }
         }
         ListElements.Add(anElement);
         Number++;
     }
     catch { }
 }