private void AddSoundEffectControl(SoundEffect soundEffect) { SoundEffectControl soundEffectControl = new SoundEffectControl(soundEffect); SoundEffectsStackPanel.Children.Add(soundEffectControl); soundEffectControl.Removed += new EventHandler(soundEffectControl_Removed); }
void soundEffectControl_Removed(object sender, EventArgs e) { if (Scene.SoundEffects.Count > 1) { SoundEffectControl soundEffectControl = sender as SoundEffectControl; Scene.SoundEffects.Remove(soundEffectControl.SoundEffect); SoundEffectsStackPanel.Children.Remove(soundEffectControl); } }