GrapeCity.Win.MultiRow Namespace > GcMultiRow Class : ViewMode Property |
<FeatureAttribute(Name="ViewMode", Version="v5.0")> <SRCategoryAttribute("Behavior")> <SRDescriptionAttribute("Indicates the mode that determines how the cell and row are selected.")> <DefaultValueAttribute()> Public Property ViewMode As ViewMode
Dim instance As GcMultiRow Dim value As ViewMode instance.ViewMode = value value = instance.ViewMode
[Feature(Name="ViewMode", Version="v5.0")] [SRCategory("Behavior")] [SRDescription("Indicates the mode that determines how the cell and row are selected.")] [DefaultValue()] public ViewMode ViewMode {get; set;}
Exception | Description |
---|---|
System.ComponentModel.InvalidEnumArgumentException | The specified value is not one of the ViewMode values. |
public class SelectionDemo : Form { private GcMultiRow gcMultiRow1 = new GcMultiRow(); private FlowLayoutPanel panel = new FlowLayoutPanel(); public SelectionDemo() { this.Text = "Selection Demo"; this.Size = new Size(600, 300); // Initial flow layout panel and add to form. this.panel.Dock = DockStyle.Left; this.panel.Size = new Size(280, 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 = 320; this.Controls.Add(this.gcMultiRow1); this.Load += new EventHandler(Form1_Load); InitControls(); } private void Form1_Load(object sender, EventArgs e) { gcMultiRow1.Template = Template.CreateGridTemplate(3); gcMultiRow1.RowCount = 10; gcMultiRow1.SelectionChanged += new EventHandler(gcMultiRow1_SelectionChanged); } void switchViewModeComboBox_SelectedIndexChanged(object sender, EventArgs e) { if (switchViewModeComboBox.Text == "Can select cell and row") { // In default mode, user can select rows and cells. this.gcMultiRow1.ViewMode = ViewMode.Default; } else if (switchViewModeComboBox.Text == "Only can select row") { // In row mode, user can only select rows. this.gcMultiRow1.ViewMode = ViewMode.Row; } else if (switchViewModeComboBox.Text == "List box like selection") { // In list box mode, user can only select rows. Selection policy is similar to a list box control. this.gcMultiRow1.ViewMode = ViewMode.ListBox; } else if (switchViewModeComboBox.Text == "Disable selection") { // Disable all selections. this.gcMultiRow1.ViewMode = ViewMode.Display; } // When view mode is ListBox, MultiSelect property and AllowUserReverseSelect property do not take effect. allowMultiSelectCheckBox.Enabled = (this.gcMultiRow1.ViewMode != ViewMode.ListBox); allowReverseSelectCheckBox.Enabled = (this.gcMultiRow1.ViewMode != ViewMode.ListBox); }
Public Class SelectionDemo Inherits Form Friend WithEvents gcMultiRow1 As New GcMultiRow() Private panel As New FlowLayoutPanel() Public Sub New() Me.Text = "Selection Demo" Me.Size = New Size(600, 300) ' Initial flow layout panel and add to form. Me.panel.Dock = DockStyle.Left Me.panel.Size = New Size(280, 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 = 320 Me.Controls.Add(Me.gcMultiRow1) InitControls() End Sub Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load gcMultiRow1.Template = Template.CreateGridTemplate(3) gcMultiRow1.RowCount = 10 End Sub Private Sub switchViewModeComboBox_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles switchViewModeComboBox.SelectedIndexChanged If switchViewModeComboBox.Text = "Can select cell and row" Then ' In default mode, user can select rows and cells. Me.gcMultiRow1.ViewMode = ViewMode.Default ElseIf switchViewModeComboBox.Text = "Only can select row" Then ' In row mode, user can only select rows. Me.gcMultiRow1.ViewMode = ViewMode.Row ElseIf switchViewModeComboBox.Text = "List box like selection" Then ' In list box mode, user can only select rows. Selection policy is similar to a list box control. Me.gcMultiRow1.ViewMode = ViewMode.ListBox ElseIf switchViewModeComboBox.Text = "Disable selection" Then ' Disable all selections. Me.gcMultiRow1.ViewMode = ViewMode.Display End If ' When view mode is ListBox, MultiSelect property and AllowUserReverseSelect property do not take effect. allowMultiSelectCheckBox.Enabled = (Me.gcMultiRow1.ViewMode <> ViewMode.ListBox) allowReverseSelectCheckBox.Enabled = (Me.gcMultiRow1.ViewMode <> ViewMode.ListBox) 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