GrapeCity MultiRow Windows Forms Documentation
PopupValueMember Property (PopupCell)
Example 


Gets or sets a value that indicates which member value of the System.Windows.Forms.CommonDialog or System.Windows.Forms.Form is displayed in the pop-up cell.
Syntax
<DefaultValueAttribute()>
<GcSerializationInternalImplAttribute(UseShadowProperty=True, 
   ShadowPropertyName="PopupValueMemberSerialization", 
   GetMethodName="", 
   SetMethodName="", 
   DescriptorTypeName="GrapeCity.Framework.Xml.Serialization.ShadowSerializablePropertyDescritpor, GrapeCity.Win.MultiRow, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")>
<SRDescriptionAttribute("Indicates which member's value of the popup is displayed on the PopupCell.")>
<EditorAttribute(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="GrapeCity.Win.MultiRow.Design.PopupValueMemberEditor,GrapeCity.Win.MultiRow.Design, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")>
<SRCategoryAttribute("Behavior")>
<RefreshPropertiesAttribute(RefreshProperties.All)>
Public Property PopupValueMember As String
Dim instance As PopupCell
Dim value As String
 
instance.PopupValueMember = value
 
value = instance.PopupValueMember
[DefaultValue()]
[GcSerializationInternalImpl(UseShadowProperty=true, 
   ShadowPropertyName="PopupValueMemberSerialization", 
   GetMethodName="", 
   SetMethodName="", 
   DescriptorTypeName="GrapeCity.Framework.Xml.Serialization.ShadowSerializablePropertyDescritpor, GrapeCity.Win.MultiRow, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")]
[SRDescription("Indicates which member's value of the popup is displayed on the PopupCell.")]
[Editor(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="GrapeCity.Win.MultiRow.Design.PopupValueMemberEditor,GrapeCity.Win.MultiRow.Design, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")]
[SRCategory("Behavior")]
[RefreshProperties(RefreshProperties.All)]
public string PopupValueMember {get; set;}

Property Value

A System.String value that represents which member value of the System.Windows.Forms.CommonDialog or System.Windows.Forms.Form is displayed in the pop-up cell. The default is "Tag".
Exceptions
ExceptionDescription
System.ArgumentExceptionThe assigned value is not a valid member of the System.Windows.Forms.CommonDialog or System.Windows.Forms.Form that is specified by the Popup property.
System.ArgumentNullExceptionThe assigned value is a null reference (Nothing in Visual Basic).
Remarks

This property and the Popup property help you edit any type of value in the PopupCell cell. After the edited form or dialog closes, PopupCell gets the PopupValueMember that indicates the form property value. Then it sets the value in the cell. For example, if you want 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 specified form property. 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.

Set the Popup first; otherwise, PopupCell might not find the specific member.
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
Popup Property

 

 


Copyright © GrapeCity, inc. All rights reserved.