Accesing constructor's base class properties
-
21-12-2019 - |
Question
In order to use a C1DropDownControl inside a C1InputPanel I need to define a class that inherits from the InputControlHost class and then invoke the desired control's constructor, like this:
public class InputC1DropDownControl : InputControlHost
{
public InputC1DropDownControl()
: base(new C1DropDownControl())
{
}
}
By doing that I can see the C1DropDownControl inside the C1InputPanel (it's some kind of a special ComboBox) but I can't access all of it's properties. So, my question is: how can I access the C1DropDownControl properties from an InputC1DropDownControl object (which obviously inherits from a different class)?
Solution
You can just use the Control
property and then cast:
var control = (C1DropDownControl) controlHost.Control;
// Use the various properties
OTHER TIPS
The InputControlHost
has a property called Control
. You should be able to do something like
C1DropDownControl hostedControl = Control as C1DropDownControl;
hostedControl.Whatever...
in your InputC1DropDownControl class.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow