Can I access ItemsHost of ItemsControl using reflection?
问题 I'm creating custom ItemsControl that is derived from DataGrid . I need to access ItemsHost that is the Panel that actually holds rows of DataGrid . I have seen som ugly tricks to do that but I consider them worse then using reflection. So can I access ItemsHost using reflection ? And how ? 回答1: Yes I can. It is simple - I've just created property in class inheriting from DataGrid : protected Panel ItemsHost { get { return (Panel) typeof (MultiSelector).InvokeMember("ItemsHost", BindingFlags