Ejemplo n.º 1
0
        /// <summary>
        /// Handles the SelectionChanged event of the tabControl control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="SelectionChangedEventArgs"/> instance containing the event data.</param>
        private void tabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Count > 0)
            {
                IViewModel addedItems = e.AddedItems[0] as IViewModel;

                if (addedItems != null)
                {
                    addedItems.ActivateTab(sender, e);
                }
            }

            if (e.RemovedItems.Count > 0)
            {
                IViewModel removedItems = e.RemovedItems[0] as IViewModel;

                if (removedItems != null)
                {
                    removedItems.DeactivateTab(sender, e);
                }
            }
        }