public void AddAction(object sender, RoutedEventArgs e) { // Add action and arrow on Click ActionView action = new ActionView(); action.ParentSequence = this; action.SetValue(DockPanel.DockProperty, Dock.Right); Actions.Add(action); ArrowRight arr = new ArrowRight(); arr.SetValue(DockPanel.DockProperty, Dock.Right); sequencePanel.Children.Insert(sequencePanel.Children.Count - 1, action); sequencePanel.Children.Insert(sequencePanel.Children.Count - 1, arr); }
// replaces add action button with repeat if repeat is true public void SetRepeatSequence(bool repeat) { if (Repeat != repeat) { Repeat = repeat; btnAddAction.SetValue(IsVisibleProperty, !repeat); if (repeat) { // remove last arrow sequencePanel.Children.RemoveAt(sequencePanel.Children.Count - 2); } else { // add last arrow ArrowRight arr = new ArrowRight(); arr.SetValue(DockPanel.DockProperty, Dock.Right); sequencePanel.Children.Insert(sequencePanel.Children.Count - 1, arr); } } }