HighTechTalks DotNet Forums  

Overriding CurrencyManager Behavior in UserControl

Dotnet Framework (WinForms DataBinding) microsoft.public.dotnet.framework.windowsforms.databinding


Discuss Overriding CurrencyManager Behavior in UserControl in the Dotnet Framework (WinForms DataBinding) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default Overriding CurrencyManager Behavior in UserControl - 09-21-2004 , 04:30 AM






Hello,

I've a usercontrol which has no explicit databinding. After
attaching a datasource to a public property it appears that
the CurrentChanged event of the BindingContext will fired
every time the control lost focus, even if the content of
the property was not changed.

I thought that overriding the OnCurrentChanged method of the
CurrencyManager object, but I've no clue how to get this.

I've tried to use this code to get the manager from
DataBindings CollectionChanged event:

private void DataBindings_CollectionChanged(object sender,
CollectionChangeEventArgs e)
{
if (e.Action == CollectionChangeAction.Add)
{
cm = ((Binding) e.Element).BindingManagerBase as
CurrencyManager;
cm.CurrentChanged += new EventHandler(cm_CurrentChanged);
cm.ItemChanged += new ItemChangedEventHandler(cm_ItemChanged);
}
}

This handler is reached and the event handlers are attached,
but the events cm_CurrentChanged and cm_ItemChanged are
never fired. Instead, the CurrentChanged event is still activ
on each focus lost.

Please, can anybody give me pointer to UserControl databinding?
I've already read most of MSDN and NoiseEHC's very good articles,
but still no idea...

Thanks,

Joerg

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.