public BkgTemplateSelectionComboBox(BackgroundPropertiesForm form, Point location, Size size, int tabIndex) { this.m_Form = form; this.SuspendLayout(); this.Location = location; this.Size = size; this.TabIndex = tabIndex; this.FlatStyle = FlatStyle.System; this.DropDownStyle = ComboBoxStyle.DropDownList; this.Items.Clear(); int initialSelect=-1; //Add the templates from xml file into the list using (BackgroundTemplateXmlService service = new BackgroundTemplateXmlService(this.m_Form.m_Model.ViewerState)) { ArrayList templates=new ArrayList (); service.GetTemplates(templates); for (int i = 0; i < templates.Count; i++) { this.Items.Add(templates[i]); if (this.m_Form.m_Template != null && this.m_Form.m_Template.Name != null && this.m_Form.m_Template.Name.Equals(((BackgroundTemplate)templates[i]).Name)) initialSelect = i; } } //if the current deck/slide template is not in the xml file, if (this.m_Form.m_Template != null && initialSelect == -1) { this.Items.Add(m_Form.m_Template.Clone()); initialSelect = this.Items.Count - 1; } //Add no background template selection this.Items.Add(Strings.NoBackgroundTemplate); if (this.m_Form.m_Template == null) initialSelect = this.Items.Count - 1; this.SelectedIndex = initialSelect; this.ResumeLayout(); }