GrapeCity.Win.MultiRow Namespace > PopupCell Class : Popup Property |
<EditorAttribute(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="GrapeCity.Win.MultiRow.Design.PopupEditor,GrapeCity.Win.MultiRow.Design, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")> <RefreshPropertiesAttribute(RefreshProperties.All)> <SRCategoryAttribute("Behavior")> <SRDescriptionAttribute("Indicates a CommonDialog or Form, that is shown after clicking the pop up button.")> <DefaultValueAttribute()> <TypeConverterAttribute("GrapeCity.Win.MultiRow.Design.PopupConverter,GrapeCity.Win.MultiRow.Design, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")> Public Property Popup As Object
[Editor(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="GrapeCity.Win.MultiRow.Design.PopupEditor,GrapeCity.Win.MultiRow.Design, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")] [RefreshProperties(RefreshProperties.All)] [SRCategory("Behavior")] [SRDescription("Indicates a CommonDialog or Form, that is shown after clicking the pop up button.")] [DefaultValue()] [TypeConverter("GrapeCity.Win.MultiRow.Design.PopupConverter,GrapeCity.Win.MultiRow.Design, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")] public object Popup {get; set;}
Exception | Description |
---|---|
System.ArgumentException | The assigned value is not a System.Windows.Forms.CommonDialog or System.Windows.Forms.Form, or System.Type of both. |
Use this property and the PopupValueMember property of PopupCell to edit any type of value. After the editing form or dialog is closed, the PopupCell gets the PopupValueMember that indicates the form property value. Then it puts the value in the cell. For example, to edit a Color type, set the Popup property to a System.Windows.Forms.ColorDialog and set PopupValueMember to "Color". After selecting a red color in the ColorDialog and closing it, the cell value changes to Color.Red.
When you change the PopupValueMember property value, the FormattedValueType property value changes to the property type of the specific property of the form. At that time, if the cell value does not fit the FormattedValueType, a DataError event may fire. Ensure the value is correct before changing this property's value.
PopupCell CreateColorPopupCell() { PopupCell popupCell1 = new PopupCell(); // Pop up ColorDialog when clicking button. popupCell1.Popup = new ColorDialog(); // Use ColorDialog's Color property's value as cell's value. popupCell1.PopupValueMember = "Color"; popupCell1.Name = "Color"; popupCell1.Size = new Size(80, 21); return popupCell1; } void gcMultiRow1_CellFormatting(object sender, CellFormattingEventArgs e) { if (e.CellName == "Color") { if (e.Value != null) { e.CellStyle.BackColor = (Color)e.Value; } } }
Private Function CreateColorPopupCell() As PopupCell Dim popupCell1 As New PopupCell() ' Pop up ColorDialog when clicking button. popupCell1.Popup = New ColorDialog() ' Use ColorDialog's Color property's value as cell's value. popupCell1.PopupValueMember = "Color" popupCell1.Name = "Color" popupCell1.Size = New Size(80, 21) Return popupCell1 End Function Private Sub gcMultiRow1_CellFormatting(ByVal sender As Object, ByVal e As CellFormattingEventArgs) Handles gcMultiRow1.CellFormatting If e.CellName = "Color" Then If e.Value <> Nothing Then e.CellStyle.BackColor = DirectCast(e.Value, Color) End If End If End Sub
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2