C# 更新绑定WPF后未更新扩展器

C# 更新绑定WPF后未更新扩展器,c#,wpf,binding,C#,Wpf,Binding,我有一个带数据绑定项的WPF扩展器。我试图在代码隐藏中的数据绑定项中设置bool标志,以便在设置bool时使扩展器折叠。我在databound对象中设置了bool,但扩展器没有反映更改和崩溃。如果您需要更多信息,请告诉我 仔细看,我似乎没有实现InotifyPropertyChanged。现在就开始阅读,但如能回答我的问题,我们将不胜感激 这是我的XAML: <Expander Header="{Binding SubSection.SubSectionName}" Expanded="E

我有一个带数据绑定项的WPF扩展器。我试图在代码隐藏中的数据绑定项中设置bool标志,以便在设置bool时使扩展器折叠。我在databound对象中设置了bool,但扩展器没有反映更改和崩溃。如果您需要更多信息,请告诉我

仔细看,我似乎没有实现InotifyPropertyChanged。现在就开始阅读,但如能回答我的问题,我们将不胜感激

这是我的XAML:

<Expander Header="{Binding SubSection.SubSectionName}" Expanded="Expander_Expanded" Collapsed="Expander_Collapsed" IsExpanded="{Binding SubSection.Expanded}">
扩展定义:

public class SubSectionViewModel
    {
        ObservableCollection<MaterialViewModel> _materials = new ObservableCollection<MaterialViewModel>();
        ObservableCollection<SubSectionViewModel> _subSections = new ObservableCollection<SubSectionViewModel>();
        SubSection _subSection;
        SectionViewModel _sectionVM;

public class SubSection
    {
        string _subSectionName;
        object _subSectionValue;
        List<GX3MaterialInterface.GX3MaterialInterface.MATERIAL_TYPE> _sectionTypes;
        int _currentTypePosition;
        List<List<object>> _paramterList;
        bool _expanded = false;
public类SubSectionViewModel
{
ObservableCollection_materials=新的ObservableCollection();
ObservableCollection_=新的ObservableCollection();
第(u)款;;
SectionViewModel_sectionVM;
公共类分部
{
字符串_subSectionName;
对象_子集值;
列出所有类型;
int_currentTypePosition;
列表_参数列表;
bool _expanded=false;

确保设置
Expanded
会引发事件。

请显示
Expanded
的实现。它是自动属性吗?谢谢你,丹尼尔。我没有在我的viewmodel中实现INotifyPropertyChanged
public class SubSectionViewModel
    {
        ObservableCollection<MaterialViewModel> _materials = new ObservableCollection<MaterialViewModel>();
        ObservableCollection<SubSectionViewModel> _subSections = new ObservableCollection<SubSectionViewModel>();
        SubSection _subSection;
        SectionViewModel _sectionVM;

public class SubSection
    {
        string _subSectionName;
        object _subSectionValue;
        List<GX3MaterialInterface.GX3MaterialInterface.MATERIAL_TYPE> _sectionTypes;
        int _currentTypePosition;
        List<List<object>> _paramterList;
        bool _expanded = false;