src/GenFx.Wpf/Controls/PopulationSelector.xaml.cs
/// <summary>
/// Handles the event when the <see cref="Environment"/> property changes.
/// </summary>
/// <param name="obj">The <see cref="DependencyObject"/> that owns the property.</param>
/// <param name="e">The <see cref="DependencyPropertyChangedEventArgs"/> associated with the event.</param>
Handles the event when the  property changes.
Handles the event when the property changes .
private static void OnEnvironmentChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            PopulationSelector selector = (PopulationSelector)obj;
            if (e.OldValue != null)
            {
                GeneticEnvironment environment = (GeneticEnvironment)e.OldValue;
                environment.Populations.CollectionChanged -= selector.Populations_CollectionChanged;
                selector.isSelectedPopulationInitialized = false;
                selector.SelectedPopulationIndex = -1;
            }
            if (e.NewValue != null)
            {
                GeneticEnvironment environment = (GeneticEnvironment)e.NewValue;
                environment.Populations.CollectionChanged += selector.Populations_CollectionChanged;
                if (environment.Populations.Any())
                {
                    selector.TryInitializeSelectedPopulation();
                }
            }
        }
private static void OnEnvironmentChanged ( DependencyObject obj , DependencyPropertyChangedEventArgs e ) { PopulationSelector selector = ( PopulationSelector ) obj ; if ( e . OldValue != null ) { GeneticEnvironment environment = ( GeneticEnvironment ) e . OldValue ; environment . Populations . CollectionChanged -= selector . Populations_CollectionChanged ; selector . isSelectedPopulationInitialized = false ; selector . SelectedPopulationIndex = - 1 ; } if ( e . NewValue != null ) { GeneticEnvironment environment = ( GeneticEnvironment ) e . NewValue ; environment . Populations . CollectionChanged += selector . Populations_CollectionChanged ; if ( environment . Populations . Any ( ) ) { selector . TryInitializeSelectedPopulation ( ) ; } } }
Handles the event when the  property changes.
Handles the event when the property changes .
obj
DependencyObject
The  that owns the property.
The that owns the property .
e
DependencyPropertyChangedEventArgs
The  associated with the event.
The associated with the event .