PDA

View Full Version : PropertyGrid needs at least one item hard coded in the markup otherwise won't add new items on DirectEvent



paul-2011
Jun 06, 2012, 2:37 PM
Hi, if I create a simple PropertyGrid and try to add items using DirecEvent it won't work if at least one item exists in the markup, could you please check my code? Btw, I found some working solutions in the forum but when I use them the editor does not work.


<ext:PropertyGrid ID="PropertyGrid1" Border="false" runat="server" AutoWidth="true" AutoHeight="true" Shim="True" StripeRows="True">
<Source>
<ext:PropertyGridParameter Name="" Value="" Mode="Value" />
</Source>
<View>
<ext:GridView ID="GridView2" ForceFit="true" runat="server" />
</View>
</ext:PropertyGrid>


for (int i = 0; i < 15; i++) {
PropertyGridParameter param = new PropertyGridParameter();
param.Name = i.ToString();
param.DisplayName = "Param " + (i + 1).ToString();
param.Value = Guid.NewGuid().ToString();


TriggerField trig = new TriggerField();
trig.Editable = false;
FieldTrigger fltrig = new FieldTrigger();
fltrig.Icon = TriggerIcon.SimpleEllipsis;
trig.Triggers.Add(fltrig);
trig.Listeners.TriggerClick.Handler = "alert('clicked me');";


param.Editor.Add(trig);
PropertyGrid1.AddProperty(param);
//this.PropertyGrid1.Source.Add(param);
//this.PropertyGrid1.SetSource(this.PropertyGrid1.So urce);
}