0

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

仔细一看,我似乎没有实现 InotifyPropertyChanged。现在阅读它,但对于我的问题的具体答案将不胜感激。

这是我的 XAML:

<Expander Header="{Binding SubSection.SubSectionName}" Expanded="Expander_Expanded" Collapsed="Expander_Collapsed" IsExpanded="{Binding SubSection.Expanded}">

这是我背后的代码:

loopSubVM.SubSection.Expanded = false;

扩展定义:

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;
4

1 回答 1

1

确保该设置Expanded引发PropertyChanged事件。

于 2013-01-14T12:34:48.003 回答