get iextenderprovider instance
- From: "Lance Johnson" <ljohnson@xxxxxxxx>
- Date: Wed, 29 Jun 2005 10:04:52 -0500
I have a component that implements the iextenderprovider. And it provides a
property SomeValue, which is of type Enum. Now, this component can be
derived from. The constructor on the base item takes as a parameter the
Type. Listed below is a sample of what I will be referring to so it makes
some sense.
[ProviderProperty("SomeValue",typeof(Control))]
public abstract class ExendibleBaseClass : Component, IExtenderProvider
{
protected ExtendibleBaseClass(Type enumAvailableTypes)
{...}
.
.
public Type AvailableValues
{
get{ return _Type; }
}
}
public class MyDerivedClass
{
public MyDerivedClass() : base( typeof( SomeEnum ) )
{}
.
.
.
}
And so when an instance of MyDerivedClass or any other derived class is
added to a form and the supplied property is edited on one of the controls
on the form, I would like to get a reference to the instance that supplied
this property. So let's say that for some odd reason I have 2 different
derived instances for my form. How can I tell which one supplied the
property. I am using an editor for this. And when I get to the EditValue
function, I can't seem to get the instance that supplied this because as far
as it's concerned it doesn't know about the IExtenderProvider control. Only
the control that has this property added to it.
So now that you have all of these details, the summary is, how to get the
instance of the component that provided this property when editing using a
derived UITypeEditor and the EditValue function is called. I get the
ITypeDescriptorContext and IServiceProvider, but I can't figure out a darn
thing from that really.
Lance Johnson
.
- Prev by Date: GdipCreateHBITMAPFromBitmap + PixelFormat32bppARGB
- Next by Date: Problem restoring Form size on launch.
- Previous by thread: GdipCreateHBITMAPFromBitmap + PixelFormat32bppARGB
- Next by thread: Problem restoring Form size on launch.
- Index(es):