GrapeCity MultiRow Windows Forms Documentation
DropDownList Property
Example 


Gets or sets a set of information about the drop-down list.
Syntax
<MergablePropertyAttribute(False)>
<DefaultValueAttribute()>
<SRCategoryAttribute("Behavior")>
<SRDescriptionAttribute("Indicates a set of information about the drop-down list including filter, sort, customized items, and so on.")>
<RefreshPropertiesAttribute(RefreshProperties.All)>
Public Property DropDownList As HeaderDropDownList
Dim instance As ColumnHeaderCell
Dim value As HeaderDropDownList
 
instance.DropDownList = value
 
value = instance.DropDownList
[MergableProperty(false)]
[DefaultValue()]
[SRCategory("Behavior")]
[SRDescription("Indicates a set of information about the drop-down list including filter, sort, customized items, and so on.")]
[RefreshProperties(RefreshProperties.All)]
public HeaderDropDownList DropDownList {get; set;}

Property Value

A HeaderDropDownList value that represents one set of information about the drop-down list. The default is a null reference (Nothing in Visual Basic).
Remarks

Through this property, you can provide sort and filter actions.

When creating the HeaderDropDownList, add some DropDownItems to HeaderDropDownList's HeaderDropDownList.Items collection, which determines what actions can be done by this DropDownList. After setting the created HeaderDropDownList to this property, the ColumnHeaderCell displays a drop-down button. When you click it, a drop-down list is displayed, and you can click one item in the list to perform an action. Also, you can set the HeaderDropDownList's properties to control the drop-down list's styles, such as HeaderDropDownList.DropDownWidth, HeaderDropDownList.Alignment, and so on.

Example
The following code example shows how to create a drop-down list for the column header cell to help the user sort or filter. The example implements a simple default drop-down list and implements some complex custom filter items.
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Collections.Generic;

namespace GrapeCity.Win.MultiRow.SampleCode
{
    public class HeaderDropDownListDemo : Form
    {
        private GcMultiRow gcMultiRow1 = new GcMultiRow();
        private FlowLayoutPanel panel = new FlowLayoutPanel();

        public HeaderDropDownListDemo()
        {
            this.Text = "HeaderDropDownList Demo";
            this.Size = new Size(630, 350);

            // Initial flow layout panel and add to form.
            this.panel.Dock = DockStyle.Left;
            this.panel.Size = new Size(250, 200);
            this.panel.FlowDirection = FlowDirection.TopDown;
            this.panel.WrapContents = false;
            this.panel.Padding = new Padding(5);
            this.Controls.Add(panel);

            // Add MultiRow to form
            this.gcMultiRow1.Dock = DockStyle.Left;
            this.gcMultiRow1.Width = 380;
            this.Controls.Add(this.gcMultiRow1);

            this.Load += new EventHandler(Form1_Load);

            InitButton();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            // Create a template with 4 text box cells.
            gcMultiRow1.Template = Template.CreateGridTemplate(4);

            gcMultiRow1.RowCount = 100;

            // Fill values.
            for (int rowIndex = 0; rowIndex < gcMultiRow1.RowCount - 1; rowIndex++)
            {
                for (int cellIndex = 0; cellIndex < 4; cellIndex++)
                {
                    gcMultiRow1[rowIndex, cellIndex].Value = rowIndex * 10 + cellIndex;
                }
            }
        }
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports GrapeCity.Win.MultiRow

Public Class HeaderDropDownListDemo
    Inherits Form
    Private gcMultiRow1 As New GcMultiRow()
    Private panel As New FlowLayoutPanel()

    Public Sub New()
        Me.Text = "HeaderDropDownList Demo"
        Me.Size = New Size(630, 350)

        ' Initial flow layout panel and add to form.
        Me.panel.Dock = DockStyle.Left
        Me.panel.Size = New Size(250, 200)
        Me.panel.FlowDirection = FlowDirection.TopDown
        Me.panel.WrapContents = False
        Me.panel.Padding = New Padding(5)
        Me.Controls.Add(panel)

        ' Add MultiRow to form
        Me.gcMultiRow1.Dock = DockStyle.Left
        Me.gcMultiRow1.Width = 380
        Me.Controls.Add(Me.gcMultiRow1)

        InitButton()
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        ' Create a template with 4 text box cell.
        gcMultiRow1.Template = Template.CreateGridTemplate(4)

        gcMultiRow1.RowCount = 100

        ' Fill values.

        For rowIndex As Integer = 0 To gcMultiRow1.RowCount - 2
            For cellIndex As Integer = 0 To 3
                gcMultiRow1(rowIndex, cellIndex).Value = rowIndex * 10 + cellIndex
            Next
        Next
    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

ColumnHeaderCell Class
ColumnHeaderCell Members
HeaderDropDownList Class
DropDownItem Class

 

 


Copyright © GrapeCity, inc. All rights reserved.