AutocompleteBox的Setter不会触发

时间:2016-05-16 20:24:24

标签: c# wpf telerik

我需要更新类中的属性以更新选定项。但是当我为setter设置断点时,它实际上从未被解雇过。我可以问一下如何解决这个问题?

<telerik:RadAutoCompleteBox ....
                            SelectedItems"{Binding Occurence.Appointment.SelectedAttendees, Mode=TwoWay}"
                            .../>

CustomAppointment.cs

public BindableCollection<AttendeeSearchDTO> SelectedAttendees
{
    get
    {
        return selectedAttendees;
    }
    set
    {            
        if (selectedAttendees != value)
        {
            selectedAttendees = value;
            this.OnPropertyChanged(() => this.SelectedAttendees);
        }
    }
}

我可以为其他组件设置一个断点,例如下面的,它会完全发射。

<TextBox  Text="{Binding Occurrence.Appointment.Body, Mode=TwoWay}" />

1 个答案:

答案 0 :(得分:0)

尝试使用ObservableCollection而不是BindableCollection

public ObservableCollection <AttendeeSearchDTO> SelectedAttendees
{
    get
    {
        return selectedAttendees;
    }
    set
    {            
        if (selectedAttendees != value)
        {
            selectedAttendees = value;
            this.OnPropertyChanged(() => this.SelectedAttendees);
        }
    }
}