Adding DataBinding to custom control

  • Thread starter Thread starter Wizfrog
  • Start date Start date
W

Wizfrog

Hello,

I'm using a custom List/Treview control from here:
http://www.codeproject.com/KB/list/extendedlistviews.aspx

and I am trying to bind user settings such as column width to the
columns in the control, so that users can save how the control looks
on their own desktop space.
However, the containerListViewColumnHeader control does not seem to
support a DataBinding.Add method.

I'm not an expert at C# so if someone could explain in simple terms
how/if it is possible to add this kind of capability, that would be
great!

Thanks!
 
I tried adding this to the code:


#region IBindableComponent Members

private BindingContext bindingContext;
private ControlBindingsCollection dataBindings;

public BindingContext BindingContext
{
get
{
if (bindingContext == null)
{
bindingContext = new BindingContext();
}
return bindingContext;
}
set
{
bindingContext = value;
}
}

public ControlBindingsCollection DataBindings
{
get
{
if (dataBindings == null)
{
dataBindings = new ControlBindingsCollection
(this);
}
return dataBindings;
}
}

#endregion


and do the binding during form load myself, but the settings still
don't seem to be updated.

Do I need to do anything with the OnPropertyChanged Event maybe?
 
Back
Top