Is there an event that I can latch onto to be notified when the datasource has been applied to its bound controls?
Or is there another event, in which I am guarantee
I think you are looking for the control's
"BindingContextChanged" event.
Are you trying to force add some hook to the binding when it occurs?.
Since you are looking AFTER the entire form is prepared and bindings are established, you can probably hook to the "LOAD" event. The form prepares everything first, then will call the "Load" event. If anything is subscribed (listening) to it, they will be notified. Once that is invoked, you can run and cycle through all controls on the form and look for whatever part / component / tag / control type, etc.
public Form1()
{
InitializeComponent();
this.VisibleChanged += Form1_VisibleChanged;
}
void Form1_VisibleChanged(object sender, EventArgs e)
{
if (!this.Visible)
return;
// Disable the event hook, we only need it once.
this.VisibleChanged -= Form1_VisibleChanged;
StringBuilder sb = new StringBuilder();
foreach (Control c in this.Controls)
sb.AppendLine(c.Name);
}
Edit per comment. I changed from the LOAD event to the VISIBILITY event. At this point, the form is now being shown so all your stuff SHOULD be completed and available. So, the initial check is to make sure it IS becoming visible. If so, immediately remove itself from the event handler, you only need it done once and not every possible time it gets shown / hidden / shown ...