J
Jonathan Yong
I found a strange behavior when using the
System.ComponentModel.RefreshPropertiesAttribute (.NET 1.1)
in my Visual Studio.NET
I have a component that has a property that is specified like this :
[RefreshProperties(RefreshProperties.Default)]
public bool AllowColumnReorder
{
get { return m_AllowColumnReorder; }
set { m_AllowColumnReorder = value; }
}
The .Default is given by the intellisense in VS.NET. However when I
compile the code, I got this error
c:\program\JDataGrid.cs(38): No overload for method
'RefreshPropertiesAttribute' takes '0' arguments
c:\program\JDataGrid.cs(38): 'System.ComponentModel.RefreshProperties'
does not contain a definition for 'Default'
The proper value that should be specified is .None
[RefreshProperties(RefreshProperties.None)]
But this is not given by the intellisense.
Is this a bug in .NET Framework or VS.NET ?
---------------------------------------------------------------------------
The second strange behavior that I observe is :
In the documentation it say that RefreshProperties.Repaint will only
refresh the view
and RefreshProperties.All will requeried all the properties and refresh
the view.
However, When I specify RefreshProperties.Repaint, all the properties is
requeried and refreshed.
When I specify RefreshProperties.All, all the properties is requeried
twice and refreshed.
---------------------------------------------------------------------------
I attach a sample code from my component to illustrate the problem I
mentioned.
using System;
using System.Windows.Forms;
using System.Drawing;
using System.Collections;
using System.Diagnostics;
using System.ComponentModel;
namespace JDFT.DataGrids
{
/// <summary>
/// Summary description for Class1.
/// </summary>
public class JDataGrid : DataGrid
{
private bool m_AllowColumnReorder;
private int m_cnt = 0;
public JDataGrid()
{
m_AllowColumnReorder = true;
}
#region Properties
[Description("Specify whether column can be reorder.")]
[DefaultValue(true)]
[RefreshProperties(RefreshProperties.All)]
public bool AllowColumnReorder
{
get { return m_AllowColumnReorder; }
set { m_AllowColumnReorder = value; }
}
public int ACount
{
get { m_cnt++; return m_cnt; }
}
public bool AllowColumnReorderNOT
{
get { return !m_AllowColumnReorder; }
}
#endregion
}
}
System.ComponentModel.RefreshPropertiesAttribute (.NET 1.1)
in my Visual Studio.NET
I have a component that has a property that is specified like this :
[RefreshProperties(RefreshProperties.Default)]
public bool AllowColumnReorder
{
get { return m_AllowColumnReorder; }
set { m_AllowColumnReorder = value; }
}
The .Default is given by the intellisense in VS.NET. However when I
compile the code, I got this error
c:\program\JDataGrid.cs(38): No overload for method
'RefreshPropertiesAttribute' takes '0' arguments
c:\program\JDataGrid.cs(38): 'System.ComponentModel.RefreshProperties'
does not contain a definition for 'Default'
The proper value that should be specified is .None
[RefreshProperties(RefreshProperties.None)]
But this is not given by the intellisense.
Is this a bug in .NET Framework or VS.NET ?
---------------------------------------------------------------------------
The second strange behavior that I observe is :
In the documentation it say that RefreshProperties.Repaint will only
refresh the view
and RefreshProperties.All will requeried all the properties and refresh
the view.
However, When I specify RefreshProperties.Repaint, all the properties is
requeried and refreshed.
When I specify RefreshProperties.All, all the properties is requeried
twice and refreshed.
---------------------------------------------------------------------------
I attach a sample code from my component to illustrate the problem I
mentioned.
using System;
using System.Windows.Forms;
using System.Drawing;
using System.Collections;
using System.Diagnostics;
using System.ComponentModel;
namespace JDFT.DataGrids
{
/// <summary>
/// Summary description for Class1.
/// </summary>
public class JDataGrid : DataGrid
{
private bool m_AllowColumnReorder;
private int m_cnt = 0;
public JDataGrid()
{
m_AllowColumnReorder = true;
}
#region Properties
[Description("Specify whether column can be reorder.")]
[DefaultValue(true)]
[RefreshProperties(RefreshProperties.All)]
public bool AllowColumnReorder
{
get { return m_AllowColumnReorder; }
set { m_AllowColumnReorder = value; }
}
public int ACount
{
get { m_cnt++; return m_cnt; }
}
public bool AllowColumnReorderNOT
{
get { return !m_AllowColumnReorder; }
}
#endregion
}
}