PropertyValueChanged event

D

David W. Simmonds

I have a custom object that I use in a PropertyGrid as seen below. It
presents an elipsis button that when clicked brings up a custom modal
dialog. When I make a change in the property, the PropertyValueChanged event
never gets fired. I have other properties in the PropertyGrid that do fire
the event. Is there anything special that I need to do to have the event
fired?

[System::ComponentModel::EditorAttribute(__typeof(CPictureEditor),
__typeof(System::Drawing::Design::UITypeEditor))]
[System::ComponentModel::TypeConverterAttribute(__typeof(CPictureConverter))
]
[Serializable]
public __gc class PictureObj : public
System::Runtime::Serialization::ISerializable
{
private:
CPicture* m_pPicture;
public:
PictureObj()
{
m_pPicture = new CPicture;
}
~PictureObj()
{
delete m_pPicture;
}
PictureObj(System::Runtime::Serialization::SerializationInfo *si,
System::Runtime::Serialization::StreamingContext sc)
{
m_pPicture = new CPicture;
SetObjectData(si, sc);
}
void SetPicture(CPicture* pic) { *m_pPicture = *pic; }
CPicture* GetPicture() { return m_pPicture; }
void GetObjectData(System::Runtime::Serialization::SerializationInfo
*si,

System::Runtime::Serialization::StreamingContext sc);
void SetObjectData(System::Runtime::Serialization::SerializationInfo
*si,

System::Runtime::Serialization::StreamingContext sc);

__property IPicture* get_Picture() { return m_pPicture->m_pImage; }
__property void set_Picture(IPicture* value) { m_pPicture->m_pImage =
value; }
__property System::String* get_ImageExt() { return new
System::String(m_pPicture->m_strImageExt); }
__property void set_ImageExt(System::String* value) {
m_pPicture->m_strImageExt = value; }
};
 
E

Earl Beaman[MS]

Hi David,

Is this the complete code? I don't see the event handler nor the event
hookup. If you have those, please post them as well.
If you don't have them, you need to get the event hooked up.

Thanks,
Earl Beaman
Microsoft, ASP.NET

This posting is provided "AS IS", with no warranties, and confers no
rights.
 
N

Natty Gur

Hi,

You need to create your own class that derived from UITypeEditor and
override the EditValue method. In that method open the form and when you
finish return the value to the Value parameter. You should also override
the GetEditStyle to set the modal mode.

This, at least, works for me.

Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114

Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377

Know the overall picture
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top