Propagate properties to parent control C#
Posted
by
Martin Ch
on Stack Overflow
See other posts from Stack Overflow
or by Martin Ch
Published on 2012-03-24T10:58:44Z
Indexed on
2012/03/24
11:29 UTC
Read the original article
Hit count: 184
Is there any way how to propagate properties from child control into parent - so I can access property like - Parent.Property1
instead of Parent.Child.Property1
? I cant use inheritance - my parent cant be extended child type - its inherited from different class.
Also I dont wanna add code for each property from child to parent like:
public object Property1
{
get{ return Child.Property1; }
set{ ChildProperty1 = value; }
}
Maybe using reflection - something like this?
public PropertyInfo[] Properties { get{ return Child.GetType().GetProperties(); } set{ Child.GetType().GetProperties().SetValue() = value.GetValue()} }
Thanks
© Stack Overflow or respective owner