在更新绑定WPF后没有更新扩展器
本文关键字:更新 扩展器 WPF 绑定 | 更新日期: 2023-09-27 17:52:46
我有一个带有绑定项的WPF展开器。我试图在代码后面的绑定项中设置一个bool标志,以便在设置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;
确保设置Expanded
引发PropertyChanged
事件