Noob01
Noob01

Reputation: 57

Binding ItemSource for ComboBox inside of datagrid not updating

I'm having trouble with a WPF interface I'm trying to create. Basically I have this:

<DataTemplate>
    <ComboBox Name="ReleaseName" ItemsSource="{Binding releaseOptions,UpdateSourceTrigger=PropertyChanged}"
              SelectedItem="{Binding Path=SelectedRelease,Mode=TwoWay,UpdateSourceTrigger=LostFocus}"/>
</DataTemplate>

And for my class I have this:

private List<string> _releaseOptions = new List<string>();

public List<string> releaseOptions
{
    get { return _releaseOptions; }
    set {PropertyChanged(this, new PropertyChangedEventArgs("releaseOptions"));}
}

public void AddOption(string option)
{
    releaseOptions.Add(option);
    if (PropertyChanged != null)
        System.Console.WriteLine("Before Notify");
        PropertyChanged(this, new PropertyChangedEventArgs("releaseOptions"));
        System.Console.WriteLine("After Notify");
}

Basically, the PropertyChanged event is fired, but my WPF form never refreshes to show the new data in my itemsource binding.

Upvotes: 0

Views: 32

Answers (0)

Related Questions