Andrey Asked:2020-07-06 05:38:10 +0800 CST2020-07-06 05:38:10 +0800 CST 2020-07-06 05:38:10 +0800 CST 在哪里可以查看可在 XAML 中使用的所有可用 WIRED 命名空间? 772 我开始学习WPF,我有一个问题: 在哪里可以查看可在 XAML 中使用的所有可用 WIRED 命名空间? 我在哪里可以确切地看到哪些 .Net 命名空间映射到每个有线 XAML 命名空间? 谢谢! wpf 1 个回答 Voted Best Answer Андрей NOP 2020-07-06T21:34:08+08:002020-07-06T21:34:08+08:00 这个问题不太正确,但我会尽力回答。因此,XAML 中没有命名空间是“硬连线”的,您可以声明和使用任何命名空间,例如: xmlns:c="clr-namespace:WpfTest" 但是,为方便起见,您可以将一个别名分配给一组命名空间,并在 XAML 中声明此别名后,使用其中的所有内容,就像使用 BCL 中的常规命名空间一样,例如: xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 这是使用在程序集级别使用的属性完成的XmlnsDefinition(例如,在 Properties/AssemblyInfo.cs 中) 如果您想知道隐藏在标准别名下(在 same 下http://schemas.microsoft.com/winfx/2006/xaml/presentation)或某些库添加的别名下的内容,则需要查看源代码。 PresentationFramework 中的示例:https ://referencesource.microsoft.com/#PresentationFramework/src/Framework/OtherAssemblyAttrs.cs // Namespace information for Xaml [assembly:System.Windows.Markup.XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "System.Windows.Controls")] [assembly:System.Windows.Markup.XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "System.Windows.Documents")] [assembly:System.Windows.Markup.XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "System.Windows.Shapes")] [assembly:System.Windows.Markup.XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "System.Windows.Shell")] [assembly:System.Windows.Markup.XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "System.Windows.Navigation")] [assembly:System.Windows.Markup.XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "System.Windows.Data")] [assembly:System.Windows.Markup.XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "System.Windows")] [assembly:System.Windows.Markup.XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "System.Windows.Controls.Primitives")] [assembly:System.Windows.Markup.XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "System.Windows.Media.Animation")] [assembly:System.Windows.Markup.XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "System.Windows.Input")] [assembly: System.Windows.Markup.XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "System.Windows.Media")] 那些。在http://schemas.microsoft.com/winfx/2006/xaml/presentation隐藏命名空间下: System.Windows.Controls System.Windows.Documents System.Windows.Shapes System.Windows.Shell System.Windows.Navigation System.Windows.Data System.Windows System.Windows.Controls.Primitives System.Windows.Media.Animation System.Windows.Input System.Windows.Media
这个问题不太正确,但我会尽力回答。因此,XAML 中没有命名空间是“硬连线”的,您可以声明和使用任何命名空间,例如:
但是,为方便起见,您可以将一个别名分配给一组命名空间,并在 XAML 中声明此别名后,使用其中的所有内容,就像使用 BCL 中的常规命名空间一样,例如:
这是使用在程序集级别使用的属性完成的
XmlnsDefinition
(例如,在 Properties/AssemblyInfo.cs 中)如果您想知道隐藏在标准别名下(在 same 下
http://schemas.microsoft.com/winfx/2006/xaml/presentation
)或某些库添加的别名下的内容,则需要查看源代码。PresentationFramework 中的示例:https ://referencesource.microsoft.com/#PresentationFramework/src/Framework/OtherAssemblyAttrs.cs
那些。在
http://schemas.microsoft.com/winfx/2006/xaml/presentation
隐藏命名空间下: