[英]Loose XAML is version of .NET/CLR loaded dependent on referenced namespace?
I have just been reading WPF Unleashed and it mentioned that the button will look different depending on the XMLNS used. 我刚刚阅读了WPF Unleashed,它提到按钮看起来会有所不同,具体取决于所使用的XMLNS。
So I tried the following and it and it bang on right. 所以我尝试了下面的内容并且它正确地敲响了。
In this code the glossy button is loaded. 在此代码中加载了光泽按钮。
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<StackPanel Height="40">
<Button Content="Button1"/>
</StackPanel>
</Page>
In this code the non-glossy button is loaded. 在此代码中,加载了非光泽按钮。
<Page xmlns="http://schemas.microsoft.com/netfx/2009/xaml/presentation">
<StackPanel Height="40">
<Button Content="Button1"/>
</StackPanel>
</Page>
I am just trying to figure out what actually is happening? 我只想弄清楚究竟发生了什么? Is it just hardcoded that the PresentationHost.exe loads the 4.0 CLR when it sees the ../netfx/2009/... namespace? 它只是硬编码,当PresentationHost.exe看到../ netfx / 2009 / ...命名空间时加载4.0 CLR ?
Inside PresentationFramework.dll
there is a mapping using the XmlnsDefinitionAttribute
. 在PresentationFramework.dll
内部,有一个使用XmlnsDefinitionAttribute
。
When the compiler hits the namespace, it looks for the specified dlls matching the target XAML namespace: 当编译器命中命名空间时,它会查找与目标XAML命名空间匹配的指定dll:
[System.Windows.Markup.XmlnsDefinitionAttribute("http://schemas.microsoft.com/xps/2005/06", "System.Windows.Media.Animation"),
System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)
If it hits winfx/2006
it will look for the XAML 2006 corresponding dlls. 如果它达到winfx/2006
,它将寻找XAML 2006相应的dll。 If it hits netfx/2009
it will look for the XAML 2009 dlls. 如果它达到netfx/2009
,它将寻找XAML 2009 dll。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.