[英]Expander not being updated after updating binding WPF
I have a WPF expander with a databound item. 我有一个带有数据绑定项的WPF扩展器。 Im trying to set a bool flag in the databound item in code behind to have teh expander collapse when the bool is set.
我试图在后面的代码中的数据绑定项中设置布尔标志,以使设置布尔时扩展器折叠。 I set the bool in the databound object but the expander is not reflecting the change and collapsing.
我在数据绑定对象中设置了布尔值,但扩展器未反映出更改和崩溃。 Please let me know if you need anymore information.
如果您需要更多信息,请告诉我。
Had a closer look and it appears im not implementing InotifyPropertyChanged. 经过仔细查看,似乎没有实现InotifyPropertyChanged。 Reading up on it now but answers specific to my problem would be appreciated.
现在阅读它,但特定于我的问题的答案将不胜感激。
Here is my XAML: 这是我的XAML:
<Expander Header="{Binding SubSection.SubSectionName}" Expanded="Expander_Expanded" Collapsed="Expander_Collapsed" IsExpanded="{Binding SubSection.Expanded}">
Here is my code behind: 这是我的代码背后:
loopSubVM.SubSection.Expanded = false;
Expanded definition: 扩展定义:
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
事件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.