I have a WPF expander with a databound item. 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. Reading up on it now but answers specific to my problem would be appreciated.
Here is my 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;
Make sure that setting
Expandedraises thePropertyChangedevent.