void BtnAddRect_Click(object sender, RoutedEventArgs e) { var newRect = new NamedRectangle(); NamedRects.Add(newRect); CurrentlySelectedNamedRect = newRect; FixDuplicateNames(); RefreshCanvasRectangle(); }
void BtnRemoveRect_Click(object sender, RoutedEventArgs e) { if (NamedRects.Contains(CurrentlySelectedNamedRect)) { var index = NamedRects.IndexOf(CurrentlySelectedNamedRect); CurrentlySelectedNamedRect = null; NamedRects.RemoveAt(index); RefreshCanvasRectangle(); } }
void lstRects_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (CurrentlySelectedNamedRect != null) { CurrentlySelectedNamedRect = lstRects.SelectedItem as NamedRectangle; txtName.Text = CurrentlySelectedNamedRect.Name; RefreshCanvasRectangle(); } canVas.Focus(); }
public Window1() { NamedRects = new BindingList <NamedRectangle>(); NamedRects.ListChanged += HandleListChangedEventHandler;; CurrentlySelectedNamedRect = NamedRects.AddNew(); NamedRects.AddNew(); NamedRects.AddNew(); FixDuplicateNames(); var TestString = "She sells seashells on the seashore"; InitializeComponent(); lstRects.ItemsSource = NamedRects; }
void BtnAddRect_Click(object sender, RoutedEventArgs e) { var newRect= new NamedRectangle(); NamedRects.Add(newRect); CurrentlySelectedNamedRect=newRect; FixDuplicateNames(); RefreshCanvasRectangle(); }