/// <summary> /// Binds a template with the data of the currently selected template. /// </summary> /// <param name="template"></param> public void Bind(FluidTemplate template, int index) { object item = GetItem(index); template.BeginInit(); template.ItemIndex = index; template.Item = item; template.Container = this; template.Scale(ScaleFactor); template.Bounds = GetItemBounds(index); template.EndInit(); }
/// <summary> /// Occurs when to get and/or bind a template. /// The event is used for two reasons: /// a) To apply a custom template to the event other than the default template. /// b) assign the properties of all child controls of the template to the data specified as Item and/or ItemIndex. /// </summary> /// <example> /// for instance, if there is a Label control in the template you could assign the Text like followed: /// label.Text = (e.Item as MyValue).FirstName; /// </example> protected virtual FluidTemplate OnBindTemplate(int index, object item, FluidTemplate template) { if (item is IGroupHeader) return null; if (BindTemplate != null) { TemplateEventArgs e = templateEventArgs; e.ItemIndex = index; e.Item = item; e.Template = template; template.BeginInit(); BindTemplate(this, e); template.EndInit(); template = e.Template; } return template; }