About the PropertyGird.PropertyValueChanged event

G

Guest

I put a PropertyGrid in my windows application. I want to change a object's property in Runtime
I used PropertyValueChanged event to tell the application which property has been changed
But if the changed property is a collection type object, the event can not occur
I think it is because that the collection object's instance doesn't have any change, it hasn't been removed or anything
Only the item's contents have been changed
So, how could I know this change
This is my sample
public class Form1 : System.Windows.Forms.For

private System.Windows.Forms.ListBox listBox1
private System.Windows.Forms.PropertyGrid propertyGrid
public Form1(

InitializeComponent()

private void InitializeComponent(

this.propertyGrid = new System.Windows.Forms.PropertyGrid()
this.listBox1 = new System.Windows.Forms.ListBox()

this.propertyGrid.Location = new System.Drawing.Point(92, 4)
this.propertyGrid.Name = "propertyGrid"
this.propertyGrid.SelectedObject = this.listBox1
this.propertyGrid.Size = new System.Drawing.Size(156, 388)
this.propertyGrid.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.propertyGrid_PropertyValueChanged)

this.listBox1.Location = new System.Drawing.Point(4, 4)
this.listBox1.Name = "listBox1"
this.listBox1.Size = new System.Drawing.Size(88, 43)

this.Controls.Add(this.listBox1)
this.Controls.Add(this.propertyGrid)

private void propertyGrid_PropertyValueChanged(object s, System.Windows.Forms.PropertyValueChangedEventArgs e

MessageBox.Show(e.ChangedItem.Label)

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top