[Mono-bugs] [Bug 325982] New: When selecting rows in DataGridView, selected rows are not highlighted

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Sep 18 08:25:21 EDT 2007


           Summary: When selecting rows in DataGridView, selected rows are
                    not highlighted
           Product: Mono: Class Libraries
           Version: unspecified
          Platform: x86
        OS/Version: openSUSE 10.2
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs at ximian.com
        ReportedBy: mtraudt at quantifisolutions.com
         QAContact: mono-bugs at ximian.com
          Found By: ---

I have a DataGridView with ReadOnly=true and SelectionMode=FullRowSelect.  If I
select a row using Mono, there is no visual feedback to the user that the row
is selected.  With MS, the row is highlighted when selected.

I assume this is a bug, since the highlighting happens automatically with MS,
but  if the answer is I should be handling some event and doing the
highlighting in my code, then let me know and I can do that.

The following code sample can be used to reproduce:

using System;
using System.ComponentModel;
using System.Windows.Forms;
using System.Drawing;
using System.Data;

public class SampleProgram
  static void Main() 
    Application.Run( new TestForm() );

public class TestForm : Form
  private DataGridView grid;
  private IContainer components;
  private ToolStripMenuItem showSelectedMenuItem;
  private ContextMenuStrip contextMenuStrip;

  public TestForm()
    DataTable dt = new DataTable();
    dt.Columns.Add("Date", typeof(DateTime));
    dt.Columns.Add("Event", typeof(string));

    DataRow row;

    row = dt.NewRow();
    row["Date"] = DateTime.Now;
    row["Event"] = "one";

    row = dt.NewRow();
    row["Date"] = DateTime.Now;
    row["Event"] = "two";

    components = new Container();

    showSelectedMenuItem = new ToolStripMenuItem();
    showSelectedMenuItem.Enabled = true;
    showSelectedMenuItem.Name = "showSelectedMenuItem";
    showSelectedMenuItem.Size = new Size(162, 22);
    showSelectedMenuItem.Click += 
      new EventHandler(this.showSelectedMenuItem_Click);
    showSelectedMenuItem.Text = "&Edit";

    contextMenuStrip = new ContextMenuStrip(this.components);
      new ToolStripItem[] { this.showSelectedMenuItem } );
    contextMenuStrip.Name = "contextMenuStrip";
    contextMenuStrip.Size = new Size(163, 170);
    contextMenuStrip.ShowImageMargin = false;

    grid = new DataGridView();
    grid.MultiSelect = true;
    grid.RowHeadersVisible = false;
    grid.AllowUserToAddRows = false;
    grid.AllowUserToDeleteRows = false;
    grid.AllowUserToResizeRows = false;
    grid.ShowCellToolTips = false;
    grid.RowTemplate.Height = 18;
    grid.ReadOnly = true;
    grid.Location = new Point(0, 0);
    grid.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
    grid.ContextMenuStrip = this.contextMenuStrip;
    grid.DataSource = dt;


  private void showSelectedMenuItem_Click(object sender, EventArgs e)
    MessageBox.Show( String.Format(
      "{0} rows selected", grid.SelectedRows.Count));

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list