GrapeCity MultiRow Windows Forms Documentation
Popup Property (PopupCell)
Example 


Gets or sets a System.Windows.Forms.CommonDialog or System.Windows.Forms.Form, or System.Type of both, that is displayed after the user clicks the pop-up button.
Syntax
<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
Dim instance As PopupCell
Dim value As Object
 
instance.Popup = value
 
value = instance.Popup
[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;}

Property Value

A System.Object value that represents a System.Windows.Forms.CommonDialog or System.Windows.Forms.Form, or System.Type of both, that is displayed after the user clicks the pop-up button. The default is the System.Type of the System.Windows.Forms.Form.
Exceptions
ExceptionDescription
System.ArgumentExceptionThe assigned value is not a System.Windows.Forms.CommonDialog or System.Windows.Forms.Form, or System.Type of both.
Remarks

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.

Example
The following code example shows how to customize a pop-up cell's behavior or appearance. This code example is part of a larger example provided for the PopupCell class.
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
Requirements

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

See Also

Reference

PopupCell Class
PopupCell Members
PopupValueMember Property

 

 


Copyright © GrapeCity, inc. All rights reserved.