private static void BindToArray(Control c, object[] bindableObjects, Dictionary<string, List<IControlBinder>> controlBinders)
{
if (c == null || bindableObjects == null || bindableObjects.Length < 1)
return;
foreach (string key in controlBinders.Keys)
{
// First, check if the control itself needs to be bound
if (c.ID.StartsWith(key))
{
foreach (IControlBinder controlBinder in controlBinders[key])
{
controlBinder.Bind(c, bindableObjects);
}
}
// Next, check if there are children that need to be bound
string name = key + bindableObjects.GetType().Name.Replace("[]", "");
Control controlToBind = ControlHelper.Find(c, name);
if (controlToBind != null)
{
foreach (IControlBinder controlBinder in controlBinders[key])
{
controlBinder.Bind(controlToBind, bindableObjects);
}
}
}
}