Hi,
I am basically a VC++ developer but now working on C#.
I am having a assembly in that i have added a UserControl and on that UserControl I am having a tree-view control and Property Grid control. As and when user selects the different nodes I am populating the corresponding properties in that grid. For the normal properties its working perfectly. But when I have to choose the property from the drop-down list. Its creating the problem. Whenever I click on the drop-down arrow nothing happens.
So I created a test application. Took a windows form application added property grid, added a class deriving it from StringConverter . Everything works fine in test application. But I don't know why its failing in my production code.
I debugged both codes. In test application whenever I click on the drop-down arrow call is coming inside <i>GetStandardV alues</i> function. But this is not happening in my main code, its not hitting the break-point at all.
Can anybody tell me why this is happening, Where I am going wrong?
the test application code is below. The exact code is present in my main code
namespace PropertyPage
{
class MyProperties:St ringConverter
{
private double str1;
private string str2;
private string str3;
public override bool GetStandardValu esSupported(ITy peDescriptorCon text context)
{
//return base.GetStandar dValuesSupporte d(context);
return true;
}
public override bool GetStandardValu esExclusive(ITy peDescriptorCon text context)
{
//return base.GetStandar dValuesExclusiv e(context);
return true;
}
public override StandardValuesC ollection GetStandardValu es(ITypeDescrip torContext context)
{
return new StandardValuesC ollection(new string[] { "Entry1", "Entry2", "Entry3" });
}
[CategoryAttribu te("Task "), DescriptionAttr ibute("test"), TypeConverter(t ypeof(MyPropert ies))]
public string Str3
{
get { return str3; }
set { str3 = value; }
}
[CategoryAttribu te("Task "), DescriptionAttr ibute("test"), ReadOnly(true)]
public double Str1
{
get { return str1; }
set { str1 = value; }
}
[Editor(typeof(S ystem.Windows.F orms.Design.Fol derNameEditor), typeof(System.D rawing.Design.U ITypeEditor))]
public string Str2
{
get { return str2; }
set { str2 = value; }
}
}
}
I am initializing the grid as
private void Form1_Load(obje ct sender, EventArgs e)
{
MyProperties my = new MyProperties();
my.Str1 = 12;
propertyGrid1.S electedObject = my;
}
I have observed similar behavior with Str2 Property. Its not allowing me to set the path in my main code but in test application its doing its job.
I am basically a VC++ developer but now working on C#.
I am having a assembly in that i have added a UserControl and on that UserControl I am having a tree-view control and Property Grid control. As and when user selects the different nodes I am populating the corresponding properties in that grid. For the normal properties its working perfectly. But when I have to choose the property from the drop-down list. Its creating the problem. Whenever I click on the drop-down arrow nothing happens.
So I created a test application. Took a windows form application added property grid, added a class deriving it from StringConverter . Everything works fine in test application. But I don't know why its failing in my production code.
I debugged both codes. In test application whenever I click on the drop-down arrow call is coming inside <i>GetStandardV alues</i> function. But this is not happening in my main code, its not hitting the break-point at all.
Can anybody tell me why this is happening, Where I am going wrong?
the test application code is below. The exact code is present in my main code
namespace PropertyPage
{
class MyProperties:St ringConverter
{
private double str1;
private string str2;
private string str3;
public override bool GetStandardValu esSupported(ITy peDescriptorCon text context)
{
//return base.GetStandar dValuesSupporte d(context);
return true;
}
public override bool GetStandardValu esExclusive(ITy peDescriptorCon text context)
{
//return base.GetStandar dValuesExclusiv e(context);
return true;
}
public override StandardValuesC ollection GetStandardValu es(ITypeDescrip torContext context)
{
return new StandardValuesC ollection(new string[] { "Entry1", "Entry2", "Entry3" });
}
[CategoryAttribu te("Task "), DescriptionAttr ibute("test"), TypeConverter(t ypeof(MyPropert ies))]
public string Str3
{
get { return str3; }
set { str3 = value; }
}
[CategoryAttribu te("Task "), DescriptionAttr ibute("test"), ReadOnly(true)]
public double Str1
{
get { return str1; }
set { str1 = value; }
}
[Editor(typeof(S ystem.Windows.F orms.Design.Fol derNameEditor), typeof(System.D rawing.Design.U ITypeEditor))]
public string Str2
{
get { return str2; }
set { str2 = value; }
}
}
}
I am initializing the grid as
private void Form1_Load(obje ct sender, EventArgs e)
{
MyProperties my = new MyProperties();
my.Str1 = 12;
propertyGrid1.S electedObject = my;
}
I have observed similar behavior with Str2 Property. Its not allowing me to set the path in my main code but in test application its doing its job.