Adding DataBinding to custom control

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!
 
W

Wizfrog

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top