protected override void LoadComponent() { IListDesigner listDesigner = (IListDesigner)GetBaseDesigner(); if (_isBaseControlList) { List list = (List)GetBaseControl(); _itemCountTextBox.Text = list.ItemCount.ToString(CultureInfo.InvariantCulture); _itemsPerPageTextBox.Text = list.ItemsPerPage.ToString(CultureInfo.InvariantCulture); switch (list.Decoration) { case ListDecoration.None: _decorationCombo.SelectedIndex = IDX_DECORATION_NONE; break; case ListDecoration.Bulleted: _decorationCombo.SelectedIndex = IDX_DECORATION_BULLETED; break; case ListDecoration.Numbered: _decorationCombo.SelectedIndex = IDX_DECORATION_NUMBERED; break; } } else { SelectionList selectionList = (SelectionList)GetBaseControl(); switch (selectionList.SelectType) { case ListSelectType.DropDown: _selectTypeCombo.SelectedIndex = IDX_SELECTTYPE_DROPDOWN; break; case ListSelectType.ListBox: _selectTypeCombo.SelectedIndex = IDX_SELECTTYPE_LISTBOX; break; case ListSelectType.Radio: _selectTypeCombo.SelectedIndex = IDX_SELECTTYPE_RADIO; break; case ListSelectType.MultiSelectListBox: _selectTypeCombo.SelectedIndex = IDX_SELECTTYPE_MULTISELECTLISTBOX; break; case ListSelectType.CheckBox: _selectTypeCombo.SelectedIndex = IDX_SELECTTYPE_CHECKBOX; break; } _rowsTextBox.Text = selectionList.Rows.ToString(CultureInfo.InvariantCulture); } }
protected override void InitForm() { this._isBaseControlList = base.GetBaseControl() is List; this._listDesigner = (IListDesigner) base.GetBaseDesigner(); base.Y = this._isBaseControlList ? 0x34 : 0x18; base.InitForm(); this.Text = MobileResource.GetString("ListItemsPage_Title"); base.CommitOnDeactivate = true; base.Icon = new Icon(Type.GetType("System.Web.UI.Design.MobileControls.MobileControlDesigner," + Constants.MobileAssemblyFullName), "Items.ico"); base.Size = new Size(0x17e, 220); if (this._isBaseControlList) { this._itemsAsLinksCheckBox = new CheckBox(); this._itemsAsLinksCheckBox.SetBounds(4, 4, 370, 0x10); this._itemsAsLinksCheckBox.Text = MobileResource.GetString("ListItemsPage_ItemsAsLinksCaption"); this._itemsAsLinksCheckBox.FlatStyle = FlatStyle.System; this._itemsAsLinksCheckBox.CheckedChanged += new EventHandler(this.OnSetPageDirty); this._itemsAsLinksCheckBox.TabIndex = 0; } GroupLabel label = new GroupLabel(); label.SetBounds(4, this._isBaseControlList ? 0x20 : 4, 0x174, ListComponentEditorPage.LabelHeight); label.Text = MobileResource.GetString("ListItemsPage_ItemListGroupLabel"); label.TabIndex = 1; label.TabStop = false; base.TreeList.TabIndex = 2; Label label2 = new Label(); label2.SetBounds(ListComponentEditorPage.X, base.Y, 0x86, ListComponentEditorPage.LabelHeight); label2.Text = MobileResource.GetString("ListItemsPage_ItemValueCaption"); label2.TabStop = false; label2.TabIndex = ListComponentEditorPage.Index; base.Y += ListComponentEditorPage.LabelHeight; this._txtValue = new TextBox(); this._txtValue.SetBounds(ListComponentEditorPage.X, base.Y, 0x86, ListComponentEditorPage.CmbHeight); this._txtValue.TextChanged += new EventHandler(this.OnPropertyChanged); this._txtValue.TabIndex = ListComponentEditorPage.Index + 1; base.Controls.AddRange(new Control[] { label, label2, this._txtValue }); if (this._isBaseControlList) { base.Controls.Add(this._itemsAsLinksCheckBox); } else { base.Y += ListComponentEditorPage.CellSpace; this._ckbSelected = new CheckBox(); this._ckbSelected.SetBounds(ListComponentEditorPage.X, base.Y, 0x86, ListComponentEditorPage.LabelHeight); this._ckbSelected.FlatStyle = FlatStyle.System; this._ckbSelected.Text = MobileResource.GetString("ListItemsPage_ItemSelectedCaption"); this._ckbSelected.CheckedChanged += new EventHandler(this.OnPropertyChanged); this._ckbSelected.TabIndex = ListComponentEditorPage.Index + 2; base.Controls.Add(this._ckbSelected); } }
protected override void InitForm() { Debug.Assert(GetBaseControl() != null); _isBaseControlList = (GetBaseControl() is List); this._listDesigner = (IListDesigner)GetBaseDesigner(); Y = (_isBaseControlList ? 52 : 24); base.InitForm(); this.Text = SR.GetString(SR.ListItemsPage_Title); this.CommitOnDeactivate = true; this.Icon = new Icon( typeof(System.Web.UI.Design.MobileControls.MobileControlDesigner), "Items.ico" ); this.Size = new Size(382, 220); if (_isBaseControlList) { _itemsAsLinksCheckBox = new CheckBox(); _itemsAsLinksCheckBox.SetBounds(4, 4, 370, 16); _itemsAsLinksCheckBox.Text = SR.GetString(SR.ListItemsPage_ItemsAsLinksCaption); _itemsAsLinksCheckBox.FlatStyle = FlatStyle.System; _itemsAsLinksCheckBox.CheckedChanged += new EventHandler(this.OnSetPageDirty); _itemsAsLinksCheckBox.TabIndex = 0; } GroupLabel grplblItemList = new GroupLabel(); grplblItemList.SetBounds(4, _isBaseControlList ? 32 : 4, 372, LabelHeight); grplblItemList.Text = SR.GetString(SR.ListItemsPage_ItemListGroupLabel); grplblItemList.TabIndex = 1; grplblItemList.TabStop = false; TreeList.TabIndex = 2; Label lblValue = new Label(); lblValue.SetBounds(X, Y, 134, LabelHeight); lblValue.Text = SR.GetString(SR.ListItemsPage_ItemValueCaption); lblValue.TabStop = false; lblValue.TabIndex = Index; Y += LabelHeight; _txtValue = new TextBox(); _txtValue.SetBounds(X, Y, 134, CmbHeight); _txtValue.TextChanged += new EventHandler(this.OnPropertyChanged); _txtValue.TabIndex = Index + 1; this.Controls.AddRange(new Control[] { grplblItemList, lblValue, _txtValue }); if (_isBaseControlList) { this.Controls.Add(_itemsAsLinksCheckBox); } else { Y += CellSpace; _ckbSelected = new CheckBox(); _ckbSelected.SetBounds(X, Y, 134, LabelHeight); _ckbSelected.FlatStyle = System.Windows.Forms.FlatStyle.System; _ckbSelected.Text = SR.GetString(SR.ListItemsPage_ItemSelectedCaption); _ckbSelected.CheckedChanged += new EventHandler(this.OnPropertyChanged); _ckbSelected.TabIndex = Index + 2; this.Controls.Add(_ckbSelected); } }
/// <summary> /// Saves the component loaded into the page. /// </summary> /// <seealso cref="System.Windows.Forms.Design.ComponentEditorPage"/> protected override void SaveComponent() { IListDesigner listDesigner = (IListDesigner)GetBaseDesigner(); if (_isBaseControlList) { List list = (List)GetBaseControl(); switch (_decorationCombo.SelectedIndex) { case IDX_DECORATION_NONE: list.Decoration = ListDecoration.None; break; case IDX_DECORATION_BULLETED: list.Decoration = ListDecoration.Bulleted; break; case IDX_DECORATION_NUMBERED: list.Decoration = ListDecoration.Numbered; break; } try { int itemCount = 0; if (_itemCountTextBox.Text.Length != 0) { itemCount = Int32.Parse(_itemCountTextBox.Text, CultureInfo.InvariantCulture); } list.ItemCount = itemCount; } catch (Exception) { _itemCountTextBox.Text = list.ItemCount.ToString(CultureInfo.InvariantCulture); } try { int itemsPerPage = 0; if (_itemsPerPageTextBox.Text.Length != 0) { itemsPerPage = Int32.Parse(_itemsPerPageTextBox.Text, CultureInfo.InvariantCulture); } list.ItemsPerPage = itemsPerPage; } catch (Exception) { _itemsPerPageTextBox.Text = list.ItemsPerPage.ToString(CultureInfo.InvariantCulture); } TypeDescriptor.Refresh(list); } else { // SelectionList selectionList = (SelectionList)GetBaseControl(); switch (_selectTypeCombo.SelectedIndex) { case IDX_SELECTTYPE_DROPDOWN: selectionList.SelectType = ListSelectType.DropDown; break; case IDX_SELECTTYPE_LISTBOX: selectionList.SelectType = ListSelectType.ListBox; break; case IDX_SELECTTYPE_RADIO: selectionList.SelectType = ListSelectType.Radio; break; case IDX_SELECTTYPE_MULTISELECTLISTBOX: selectionList.SelectType = ListSelectType.MultiSelectListBox; break; case IDX_SELECTTYPE_CHECKBOX: selectionList.SelectType = ListSelectType.CheckBox; break; } try { int rows = 4; if (_rowsTextBox.Text.Length != 0) { rows = Int32.Parse(_rowsTextBox.Text, CultureInfo.InvariantCulture); } selectionList.Rows = rows; } catch (Exception) { _rowsTextBox.Text = selectionList.Rows.ToString(CultureInfo.InvariantCulture); } TypeDescriptor.Refresh(selectionList); } }
protected override void InitForm() { Debug.Assert(GetBaseControl() != null); _isBaseControlList = (GetBaseControl() is List); this._listDesigner = (IListDesigner)GetBaseDesigner(); Y = (_isBaseControlList ? 52 : 24); base.InitForm(); this.Text = SR.GetString(SR.ListItemsPage_Title); this.CommitOnDeactivate = true; this.Icon = new Icon( typeof(System.Web.UI.Design.MobileControls.MobileControlDesigner), "Items.ico" ); this.Size = new Size(382, 220); if (_isBaseControlList) { _itemsAsLinksCheckBox = new CheckBox(); _itemsAsLinksCheckBox.SetBounds(4, 4, 370, 16); _itemsAsLinksCheckBox.Text = SR.GetString(SR.ListItemsPage_ItemsAsLinksCaption); _itemsAsLinksCheckBox.FlatStyle = FlatStyle.System; _itemsAsLinksCheckBox.CheckedChanged += new EventHandler(this.OnSetPageDirty); _itemsAsLinksCheckBox.TabIndex = 0; } GroupLabel grplblItemList = new GroupLabel(); grplblItemList.SetBounds(4, _isBaseControlList ? 32 : 4, 372, LabelHeight); grplblItemList.Text = SR.GetString(SR.ListItemsPage_ItemListGroupLabel); grplblItemList.TabIndex = 1; grplblItemList.TabStop = false; TreeList.TabIndex = 2; Label lblValue = new Label(); lblValue.SetBounds(X, Y, 134, LabelHeight); lblValue.Text = SR.GetString(SR.ListItemsPage_ItemValueCaption); lblValue.TabStop = false; lblValue.TabIndex = Index; Y += LabelHeight; _txtValue = new TextBox(); _txtValue.SetBounds(X, Y, 134, CmbHeight); _txtValue.TextChanged += new EventHandler(this.OnPropertyChanged); _txtValue.TabIndex = Index + 1; this.Controls.AddRange(new Control[] { grplblItemList, lblValue, _txtValue }); if (_isBaseControlList) { this.Controls.Add(_itemsAsLinksCheckBox); } else { Y += CellSpace; _ckbSelected = new CheckBox(); _ckbSelected.SetBounds(X, Y, 134, LabelHeight); _ckbSelected.FlatStyle = System.Windows.Forms.FlatStyle.System; _ckbSelected.Text = SR.GetString(SR.ListItemsPage_ItemSelectedCaption); _ckbSelected.CheckedChanged += new EventHandler(this.OnPropertyChanged); _ckbSelected.TabIndex = Index + 2; this.Controls.Add(_ckbSelected); } }
/// <summary> /// Saves the component loaded into the page. /// </summary> /// <seealso cref="System.Windows.Forms.Design.ComponentEditorPage"/> protected override void SaveComponent() { String dataTextField = String.Empty; String dataValueField = String.Empty; IListDesigner listDesigner = (IListDesigner)GetBaseDesigner(); if (_dataTextFieldCombo.IsSet()) { dataTextField = (String)_dataTextFieldCombo.SelectedItem; } if (_dataValueFieldCombo.IsSet()) { dataValueField = (String)_dataValueFieldCombo.SelectedItem; } listDesigner.DataTextField = dataTextField; listDesigner.DataValueField = dataValueField; if (_dataSourceDirty) { // save the datasource as a binding on the control DataBindingCollection dataBindings = ((HtmlControlDesigner)listDesigner).DataBindings; if (_currentDataSource == null) { listDesigner.DataSource = String.Empty; listDesigner.DataMember = String.Empty; } else { listDesigner.DataSource = _currentDataSource.ToString(); if (_dataMemberCombo.IsSet()) { listDesigner.DataMember = (String)_dataMemberCombo.SelectedItem; } else { listDesigner.DataMember = String.Empty; } } listDesigner.OnDataSourceChanged(); } if (_isBaseControlList) { List list = (List)GetBaseControl(); switch (_decorationCombo.SelectedIndex) { case IDX_DECORATION_NONE: list.Decoration = ListDecoration.None; break; case IDX_DECORATION_BULLETED: list.Decoration = ListDecoration.Bulleted; break; case IDX_DECORATION_NUMBERED: list.Decoration = ListDecoration.Numbered; break; } try { int itemCount = 0; if (_itemCountTextBox.Text.Length != 0) { itemCount = Int32.Parse(_itemCountTextBox.Text, CultureInfo.InvariantCulture); } list.ItemCount = itemCount; } catch (Exception) { _itemCountTextBox.Text = list.ItemCount.ToString(); } try { int itemsPerPage = 0; if (_itemsPerPageTextBox.Text.Length != 0) { itemsPerPage = Int32.Parse(_itemsPerPageTextBox.Text, CultureInfo.InvariantCulture); } list.ItemsPerPage = itemsPerPage; } catch (Exception) { _itemsPerPageTextBox.Text = list.ItemsPerPage.ToString(); } TypeDescriptor.Refresh(list); } else { // BUGBUG: handle case where entry is "000" if we decide to disallow this. SelectionList selectionList = (SelectionList)GetBaseControl(); switch (_selectTypeCombo.SelectedIndex) { case IDX_SELECTTYPE_DROPDOWN: selectionList.SelectType = ListSelectType.DropDown; break; case IDX_SELECTTYPE_LISTBOX: selectionList.SelectType = ListSelectType.ListBox; break; case IDX_SELECTTYPE_RADIO: selectionList.SelectType = ListSelectType.Radio; break; case IDX_SELECTTYPE_MULTISELECTLISTBOX: selectionList.SelectType = ListSelectType.MultiSelectListBox; break; case IDX_SELECTTYPE_CHECKBOX: selectionList.SelectType = ListSelectType.CheckBox; break; } try { int rows = 4; if (_rowsTextBox.Text.Length != 0) { rows = Int32.Parse(_rowsTextBox.Text, CultureInfo.InvariantCulture); } selectionList.Rows = rows; } catch (Exception) { _rowsTextBox.Text = selectionList.Rows.ToString(); } TypeDescriptor.Refresh(selectionList); } }
protected override void LoadComponent() { InitPage(); LoadDataSourceItems(); IListDesigner listDesigner = (IListDesigner)GetBaseDesigner(); if (_dataSourceCombo.Items.Count > 0) { String dataSourceValue = listDesigner.DataSource; if (dataSourceValue != null) { int dataSourcesAvailable = _dataSourceCombo.Items.Count; // starting at index 1 because first entry is (unbound). for (int j = 1; j < dataSourcesAvailable; j++) { DataSourceItem dataSourceItem = (DataSourceItem)_dataSourceCombo.Items[j]; if (String.Compare(dataSourceItem.Name, dataSourceValue, true, CultureInfo.InvariantCulture) == 0) { _dataSourceCombo.SelectedIndex = j; _currentDataSource = dataSourceItem; LoadDataMembers(); if (_currentDataSource is ListSourceDataSourceItem) { String dataMember = listDesigner.DataMember; _dataMemberCombo.SelectedIndex = _dataMemberCombo.FindStringExact(dataMember); if (_dataMemberCombo.IsSet()) { ((ListSourceDataSourceItem)_currentDataSource).CurrentDataMember = dataMember; } } LoadDataSourceFields(); break; } } } } String dataTextField = listDesigner.DataTextField; String dataValueField = listDesigner.DataValueField; if (dataTextField.Length != 0) { int textFieldIndex = _dataTextFieldCombo.FindStringExact(dataTextField); _dataTextFieldCombo.SelectedIndex = textFieldIndex; } if (dataValueField.Length != 0) { int textValueIndex = _dataValueFieldCombo.FindStringExact(dataValueField); _dataValueFieldCombo.SelectedIndex = textValueIndex; } if (_isBaseControlList) { List list = (List)GetBaseControl(); _itemCountTextBox.Text = list.ItemCount.ToString(); _itemsPerPageTextBox.Text = list.ItemsPerPage.ToString(); switch (list.Decoration) { case ListDecoration.None: _decorationCombo.SelectedIndex = IDX_DECORATION_NONE; break; case ListDecoration.Bulleted: _decorationCombo.SelectedIndex = IDX_DECORATION_BULLETED; break; case ListDecoration.Numbered: _decorationCombo.SelectedIndex = IDX_DECORATION_NUMBERED; break; } } else { SelectionList selectionList = (SelectionList)GetBaseControl(); switch (selectionList.SelectType) { case ListSelectType.DropDown: _selectTypeCombo.SelectedIndex = IDX_SELECTTYPE_DROPDOWN; break; case ListSelectType.ListBox: _selectTypeCombo.SelectedIndex = IDX_SELECTTYPE_LISTBOX; break; case ListSelectType.Radio: _selectTypeCombo.SelectedIndex = IDX_SELECTTYPE_RADIO; break; case ListSelectType.MultiSelectListBox: _selectTypeCombo.SelectedIndex = IDX_SELECTTYPE_MULTISELECTLISTBOX; break; case ListSelectType.CheckBox: _selectTypeCombo.SelectedIndex = IDX_SELECTTYPE_CHECKBOX; break; } _rowsTextBox.Text = selectionList.Rows.ToString(); } UpdateEnabledVisibleState(); }