
hi,
i have question in my project.
first view my source.
// class
public class TestObject
{
private string testString;
[Browsable(true)]
[SortOrder(1)]
[TypeConverter(typeof(MyConverter))]
public string TEST
{
get
{
string S = "";
if (testString != null)
{
S = testString;
}
return S;
}
set { testString = value; }
}
}
internal class Gloabal
{
internal static string[] data;
}
public class MyConverter : StringConverter
{
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
{
return true;
}
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
{
return true;
}
public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
return new StandardValuesCollection(Gloabal.data);
}
}
// main
public partial class MainControl : Window
{
public MainControl()
{
InitializeComponent();
this.PropertyGrid1.SelectedObject = new TestObject();
UpdateListofRules(10);
}
private void UpdateListofRules(int total)
{
Gloabal.data = new string[total];
for (int i = 0; i <= total - 1; i++)
{
Gloabal.data[i] = "A" + i;
}
}
private void button1_Click(object sender, RoutedEventArgs e)
{
UpdateListofRules(20);
}
}
when first load string array has 10 field and display as combobox has "A1", "A2" ... "A10".
when btn1 pressed, i hope display 20 field in combobox. but still combobox display 10 field.
if using propertygrid1.refresh, then display 20 field. but i want to update specific area.
how to update combobox, not using refresh?