[Mono-bugs] [Bug 457059] New: Mono DataGridView not is disabling user ordering columns

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Dec 6 14:26:48 EST 2008


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


           Summary: Mono DataGridView not is disabling user ordering columns
           Product: Mono: Class Libraries
           Version: 2.0.x
          Platform: PC
        OS/Version: openSUSE 11.0
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: rodrigosilvabrito at hotmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: DeveloperNet


Created an attachment (id=258449)
 --> (https://bugzilla.novell.com/attachment.cgi?id=258449)
Sample Source Code

Description of Problem:

In MS's runtime this code work fine!

Steps to reproduce the problem:

1. Generate and compile the code!

-- Program.cs

using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace DataGridViewOrderColumns
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new frmMain());
        }
    }
}

-- frmMain.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace DataGridViewOrderColumns
{
    public partial class frmMain : Form
    {
        BindingList<Cash> list;

        public frmMain()
        {
            InitializeComponent();

            this.dgvList.AllowUserToOrderColumns = false; //In the mono does
not work

            list = new BindingList<Cash>();

            for (int i = 0; i <= 100; i++)
            {
                Cash cash = new Cash();
                cash.Date = DateTime.Now;
                cash.Memo = "Memo " + i.ToString();
                cash.Increase = i;
                cash.Reduce = 0;

                list.Add(cash);
            }

            dgvList.DataSource = list;
        } 
    }

    public class Cash
    {
        private Nullable<DateTime> date = DateTime.Today;
        private string memo = string.Empty;
        private decimal increase = 0;
        private decimal reduce = 0;

        public Nullable<DateTime> Date
        {
            get { return date; }
            set { date = value; }
        }

        public string Memo
        {
            get { return memo; }
            set { memo = value; }
        }

        public decimal Increase
        {
            get { return increase; }
            set { increase = value; }
        }

        public decimal Reduce
        {
            get { return reduce; }
            set { reduce = value; }
        }
    }
}

-- frmMain.Designer.cs

namespace DataGridViewOrderColumns
{
    partial class frmMain
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be
disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 =
new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 =
new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 =
new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 =
new System.Windows.Forms.DataGridViewCellStyle();
            this.dgvList = new System.Windows.Forms.DataGridView();
           
((System.ComponentModel.ISupportInitialize)(this.dgvList)).BeginInit();
            this.SuspendLayout();
            // 
            // dgvList
            // 
            this.dgvList.AllowUserToAddRows = false;
            this.dgvList.AllowUserToDeleteRows = false;
            this.dgvList.AllowUserToOrderColumns = true;
            this.dgvList.AllowUserToResizeRows = false;
            dataGridViewCellStyle1.BackColor =
System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(238)))),
((int)(((byte)(238)))));
            this.dgvList.AlternatingRowsDefaultCellStyle =
dataGridViewCellStyle1;
            this.dgvList.BackgroundColor = System.Drawing.Color.GhostWhite;
            this.dgvList.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.dgvList.ColumnHeadersBorderStyle =
System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
            dataGridViewCellStyle2.BackColor =
System.Drawing.Color.LightSteelBlue;
            dataGridViewCellStyle2.Font = new System.Drawing.Font("Tahoma",
8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point,
((byte)(0)));
            dataGridViewCellStyle2.ForeColor =
System.Drawing.SystemColors.ControlDarkDark;
            dataGridViewCellStyle2.SelectionBackColor =
System.Drawing.SystemColors.Highlight;
            dataGridViewCellStyle2.SelectionForeColor =
System.Drawing.SystemColors.HighlightText;
            dataGridViewCellStyle2.WrapMode =
System.Windows.Forms.DataGridViewTriState.True;
            this.dgvList.ColumnHeadersDefaultCellStyle =
dataGridViewCellStyle2;
            this.dgvList.ColumnHeadersHeight = 20;
            this.dgvList.ColumnHeadersHeightSizeMode =
System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
            this.dgvList.Dock = System.Windows.Forms.DockStyle.Fill;
            this.dgvList.Location = new System.Drawing.Point(0, 0);
            this.dgvList.MultiSelect = false;
            this.dgvList.Name = "dgvList";
            this.dgvList.RowHeadersBorderStyle =
System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
            dataGridViewCellStyle3.BackColor =
System.Drawing.SystemColors.ButtonFace;
            dataGridViewCellStyle3.Font = new System.Drawing.Font("Tahoma",
8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point,
((byte)(0)));
            dataGridViewCellStyle3.ForeColor =
System.Drawing.SystemColors.WindowText;
            dataGridViewCellStyle3.SelectionBackColor =
System.Drawing.SystemColors.Highlight;
            dataGridViewCellStyle3.SelectionForeColor =
System.Drawing.SystemColors.HighlightText;
            dataGridViewCellStyle3.WrapMode =
System.Windows.Forms.DataGridViewTriState.True;
            this.dgvList.RowHeadersDefaultCellStyle = dataGridViewCellStyle3;
            this.dgvList.RowHeadersVisible = false;
            this.dgvList.RowHeadersWidth = 4;
            dataGridViewCellStyle4.SelectionBackColor =
System.Drawing.Color.FromArgb(((int)(((byte)(37)))), ((int)(((byte)(73)))),
((int)(((byte)(84)))));
            dataGridViewCellStyle4.SelectionForeColor =
System.Drawing.Color.White;
            this.dgvList.RowsDefaultCellStyle = dataGridViewCellStyle4;
            this.dgvList.RowTemplate.DefaultCellStyle.Font = new
System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.dgvList.RowTemplate.Height = 18;
            this.dgvList.SelectionMode =
System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
            this.dgvList.Size = new System.Drawing.Size(594, 369);
            this.dgvList.TabIndex = 2;
            // 
            // frmMain
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(594, 369);
            this.Controls.Add(this.dgvList);
            this.Name = "frmMain";
            this.Text = "Mono DataGridView no disable user order columns";
           
((System.ComponentModel.ISupportInitialize)(this.dgvList)).EndInit();
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.DataGridView dgvList;
    }
}

2. Execute the program in mono, when click in Column Header, data grid view
order columns. 

Actual Results:
    this.dgvList.AllowUserToOrderColumns = false; //In the mono does not work

Expected Results:
    Is expected -->  this.dgvList.AllowUserToOrderColumns = false; //In the
mono work, disabling user order columns!

How often does this happen? 
Ever, All!


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