私にはUserControl
いくつかの子がUserControl
あり、それらUserControl
には子UserControlがあります。
このことを考慮:
MainUserControl
TabControl
TabItem
UserControl
UserControl
UserControl : ISomeInterface
TabItem
UserControl
UserControl
UserControl : ISomeInterface
TabItem
UserControl
UserControl
UserControl : ISomeInterface
TabItem
UserControl
UserControl
UserControl : ISomeInterface
これは私がこれまでに持っているものですが、見つかりませんISomeInterface
:
PropertyInfo[] properties = MainUserControl.GetType().GetProperties();
foreach (PropertyInfo property in properties)
{
if (typeof(ISomeInterface).IsAssignableFrom(property.PropertyType))
{
property.GetType().InvokeMember("SomeMethod", BindingFlags.InvokeMethod, null, null, null);
}
}
その実装UserControl
からのすべての子をリフレクションを介して見つけ、そのインターフェースでmethod( ) を呼び出すことは可能ですか?MainUserControl
ISomeInterface
void SomeMethod()