public virtual void ItemClose(object sender, ExecutedRoutedEventArgs e) { var tabs = Template.FindName(TabsTemplatePartName, this) as TabControl; PlatesCC platesToRemove = e.Parameter as PlatesCC; NotifyCollectionChangedEventArgs removeArgs = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, this.platesItems[platesToRemove]); platesToRemove.RemovePlate -= PlatesCC_RemovePlate; tabs.Items.Remove(platesToRemove); this.platesItems.Remove(platesToRemove); OnRemoveItems(removeArgs); platesToRemove.Free(); }
public void SetWaitOverdoor(bool on) { var tabs = Template.FindName(TabsTemplatePartName, this) as TabControl; if (tabs != null) { PlatesCC activePlates = tabs.SelectedItem as PlatesCC; if (activePlates != null) { activePlates.SetWaitOverdoor(on); } //else SetSelfWaitOverdoor(on); } }
private void CreateNewTab() { var tabs = Template.FindName(TabsTemplatePartName, this) as TabControl; if (tabs != null) { PlatesCC plates = new PlatesCC(); plates.RemovePlate += PlatesCC_RemovePlate; var list = new List <object>(); var items = new ObservableCollection <object>(list); plates.ItemsSource = items; tabs.Items.Add(plates); tabs.SelectedItem = plates; this.platesItems.Add(plates, items); } }
private void CreateNewTab() { var tabs = Template.FindName(TabsTemplatePartName, this) as TabControl; if (tabs != null) { PlatesCC plates = new PlatesCC(); plates.RemovePlate += PlatesCC_RemovePlate; var list = new List<object>(); var items = new ObservableCollection<object>(list); plates.ItemsSource = items; tabs.Items.Add(plates); tabs.SelectedItem = plates; this.platesItems.Add(plates, items); } }