我知道对于具有指定clr-namespace:和assembly=标记的控件,XamlReader 只是在指定程序集中查找该类型。
但是默认命名空间中的默认 WPF 控件xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"呢?
我正在尝试获取 XElement 树中每个元素的类型,但我不知道在未指定程序集时如何找到它?
例如,以下所有示例都返回 null:
Type.GetType("Grid")typeof(Control).Assembly.GetType("Grid")Assembly.GetAssembly(typeof(Control)).GetType("Grid")
帮助?