I'm probably doing something silly, but here it goes.
I'm trying to get the FieldInfo from a public event via reflection.
Check this function:
public void PlotAllFields(Type type) {
BindingFlags all = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public;
FieldInfo[] fields = type.GetFields(all);
Console.WriteLine(type + "-------------------------");
foreach (var fieldInfo in fields) {
Console.WriteLine(fieldInfo.Name);
}
}
public class Bar : Foo {}
public class Foo {
public string Test;
public event EventHandler Event;
public event RoutedEventHandler RoutedEvent;
}
The call PlotAllFields(typeof(Foo)); returns:
- Test
- Event
- RoutedEvent
The call PlotAllFields(typeof(Bar)); returns:
- Test
I understand that the delegates behind the events are private fields so I can't access them on the subclass. So far so good.
Then I tried: PlotAllFields(typeof(FrameworkElement)); //from WPF
- _themeStyleCache
- _styleCache
- _templatedParent
- _templateChild
- _flags
- _flags2
- _parent
- _inheritableProperties
- MeasureRequest
- ArrangeRequest
- sizeChangedInfo
- _parentIndex
- _parent
- _proxy
- _contextStorage
Well... Where are the 14 events of FrameworkElement class???