[Mono-bugs] [Bug 486645] New: DataGridView.ColumnStateChanged and DataGridView.RowStateChanged Events should allow access to OwningColumn and OwningRow

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Mar 18 19:27:34 EDT 2009


https://bugzilla.novell.com/show_bug.cgi?id=486645

User tom_hindle at sil.org added comment
https://bugzilla.novell.com/show_bug.cgi?id=486645#c486640

           Summary: DataGridView.ColumnStateChanged and
                    DataGridView.RowStateChanged Events should allow
                    access to OwningColumn and OwningRow
    Classification: Mono
           Product: Mono: Class Libraries
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: tom_hindle at sil.org
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.7)
Gecko/2009030422 Ubuntu/8.04 (hardy) Firefox/3.0.7

maybe related to Bug #486640 

In Some ColumnStateChanged and RowStateChanged events OwningColumn and
OwningRow events are null.


using System;
using System.Drawing;
using System.Windows.Forms;

public class MyDataGridViewColumn : DataGridViewColumn
{
    public MyDataGridViewColumn() : base(new MyDataGridViewCell())
    {

    }
}

public class MyDataGridViewCell : DataGridViewCell
{
    public MyDataGridViewCell() { }

    protected override void OnDataGridViewChanged()
    {        
        base.OnDataGridViewChanged();

        if (DataGridView != null)
        {            
            DataGridView.ColumnStateChanged += new
DataGridViewColumnStateChangedEventHandler(OnColumnStateChanged);
            DataGridView.RowStateChanged += new
DataGridViewRowStateChangedEventHandler(OnRowStateChanged);
        }        
    }

    protected override void OnEnter(int rowIndex, bool throughMouseClick)
    {        
        base.OnEnter(rowIndex, throughMouseClick);            
    }


    protected void OnColumnStateChanged(object sender,
DataGridViewColumnStateChangedEventArgs e)
    {        

        Console.WriteLine("OnColumnStateChanged OwningColumn = {0}",
OwningColumn);
        Console.WriteLine("OnColumnStateChanged OwningRow = {0}", OwningRow);

    }

    protected void OnRowStateChanged(object sender,
DataGridViewRowStateChangedEventArgs e)
    {
        Console.WriteLine("OnRowStateChanged OwningColumn = {0}", OwningColumn
!= null);
        Console.WriteLine("OnRowStateChanged OwningRow = {0}", OwningRow !=
null);
    }

}

public class DataGridViewEventsTest
{
    [STAThreadAttribute()]
    static void Main()
    {                
        DataGridView dgv = new DataGridView();
        dgv.AllowUserToAddRows = false;
        MyDataGridViewColumn column = new MyDataGridViewColumn();
        dgv.Columns.Add(column);        
        dgv.RowCount = 1;

        dgv.RowCount = 2;

        dgv.Rows[0].Visible = false;    
        dgv.Rows[0].Visible = true;                        
        dgv.Rows[1].Visible = false;        
        dgv.Rows[0].Height = 10;        
        dgv.Columns[0].Width = 10;        

        dgv.Rows[1].Visible = true;
        dgv.CurrentCell = dgv.Rows[1].Cells[0];

    }
}

Reproducible: Always

Steps to Reproduce:
1. Compile and Run Sample Code
2.
3.
Actual Results:  
OnRowStateChanged OwningColumn = False
OnRowStateChanged OwningRow = False
OnRowStateChanged OwningColumn = True
OnRowStateChanged OwningRow = True
OnRowStateChanged OwningColumn = False
OnRowStateChanged OwningRow = True
OnRowStateChanged OwningColumn = True
OnRowStateChanged OwningRow = True
OnRowStateChanged OwningColumn = False
OnRowStateChanged OwningRow = True
OnRowStateChanged OwningColumn = False
OnRowStateChanged OwningRow = False
OnRowStateChanged OwningColumn = True
OnRowStateChanged OwningRow = True
OnRowStateChanged OwningColumn = False
OnRowStateChanged OwningRow = True
OnRowStateChanged OwningColumn = True
OnRowStateChanged OwningRow = True
OnRowStateChanged OwningColumn = False
OnRowStateChanged OwningRow = True
OnRowStateChanged OwningColumn = False
OnRowStateChanged OwningRow = False
OnRowStateChanged OwningColumn = True
OnRowStateChanged OwningRow = True
OnRowStateChanged OwningColumn = False
OnRowStateChanged OwningRow = True
OnRowStateChanged OwningColumn = True
OnRowStateChanged OwningRow = True
OnRowStateChanged OwningColumn = False
OnRowStateChanged OwningRow = True
OnRowStateChanged OwningColumn = False
OnRowStateChanged OwningRow = False
OnRowStateChanged OwningColumn = True
OnRowStateChanged OwningRow = True
OnRowStateChanged OwningColumn = False
OnRowStateChanged OwningRow = True
OnRowStateChanged OwningColumn = True
OnRowStateChanged OwningRow = True
OnRowStateChanged OwningColumn = False
OnRowStateChanged OwningRow = True

Expected Results:  
OnRowStateChanged OwningColumn = True
OnRowStateChanged OwningRow = True
OnRowStateChanged OwningColumn = True
OnRowStateChanged OwningRow = True
OnRowStateChanged OwningColumn = True
OnRowStateChanged OwningRow = True
OnRowStateChanged OwningColumn = True
OnRowStateChanged OwningRow = True
OnRowStateChanged OwningColumn = True
OnRowStateChanged OwningRow = True
OnRowStateChanged OwningColumn = True
OnRowStateChanged OwningRow = True
OnRowStateChanged OwningColumn = True
OnRowStateChanged OwningRow = True
OnRowStateChanged OwningColumn = True
OnRowStateChanged OwningRow = True
OnRowStateChanged OwningColumn = True
OnRowStateChanged OwningRow = True
OnRowStateChanged OwningColumn = True
OnRowStateChanged OwningRow = True
OnRowStateChanged OwningColumn = True
OnRowStateChanged OwningRow = True
OnRowStateChanged OwningColumn = True
OnRowStateChanged OwningRow = True
OnRowStateChanged OwningColumn = True
OnRowStateChanged OwningRow = True
OnRowStateChanged OwningColumn = True
OnRowStateChanged OwningRow = True

-- 
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