So,
I've used databinding for all of my .Net life, and suddenly in 4.5.1 I am seeing these glitches and problems that are scaring me to a level of thinking that databinding has been fundamentally broken.
public partial class MainForm : Form, IReportProgress
{
public MainForm()
{
InitializeComponent();
this.Progress += MainForm_Progress;
}
private SProcRepository _sprocs;
protected SProcRepository SProcs
{
get
{
if (_sprocs == null) _sprocs = new SProcRepository();
return _sprocs;
}
}
protected override void OnLoad(EventArgs e)
{
_spNameComboBox.DataSource = this.SProcs;
_spNameComboBox.DisplayMember = "Name";
try
{
Binding b = new Binding("Checked", this.SProcs, "UseGroups", true, DataSourceUpdateMode.OnPropertyChanged);
_useCategoryCheckBox.DataBindings.Add(b);
}
catch (Exception ex)
{//error: Cannot bind to the property or column UseGroups on the DataSource.//Parameter name: dataMember
}
base.OnLoad(e);
}
}
public class SProcRepository : BindingList<SProcItem>
{
public SProcRepository()
{
this.AddOnMissing = AddMissingBehavior.Always;
}
private bool _useGroups;
public bool UseGroups
{
get { return _useGroups; }
set
{
if (_useGroups != value)
{
_useGroups = value;
this.UpdateFiles();
}
}
}
}Now this is something I've done for more than a decade, and suddenly, the DataBinding is throwing an error on binding a property. The Source is just an object, and using reflection UseGroups is avalid property and yet DataBinding is claiming it isn't.
What's going on here? I am sure it is probably some setting or tweak that is new to 4.5.1 (granted I have been using 3.51 for 5+ years, so the change to 4.5.1 will have nuances I haven't expected yet, but this was unexpected).
EDIT:
I have further investigated and it appears that because SProcRepository class the CurrencyManager is ignore properties that exist upon that instance, and focus solely upon the BindingList<T> T item. and true UseGroups is not a property on SProcItem, but is a property on SProcRepository.
So, I guess the question is, what changed or what do I need to do to get the DataBinding system to look at the "Object" I'm referencing not the "Objects Elements"?
Thanks
Jaeden "Sifo Dyas" al'Raec Ruiner
"Never Trust a computer. Your brain is smarter than any micro-chip."
PS - Don't mark answers on other people's questions. There are such things as Vacations and Holidays which may reduce timely activity, and until the person asking the question can test your answer, it is not correct just because you think it is. Marking it
correct for them often stops other people from even reading the question and possibly providing the real "correct" answer.