我刚刚阅读了WPF Unleashed,它提到按钮看起来会有所不同,具体取决于所使用的XMLNS.
所以我尝试了下面的内容并且它正确地敲响了.
在此代码中加载了光泽按钮.
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<StackPanel Height="40">
<Button Content="Button1"/>
</StackPanel>
</Page>
Run Code Online (Sandbox Code Playgroud)
在此代码中,加载了非光泽按钮.
<Page xmlns="http://schemas.microsoft.com/netfx/2009/xaml/presentation">
<StackPanel Height="40">
<Button Content="Button1"/>
</StackPanel>
</Page>
Run Code Online (Sandbox Code Playgroud)
我只想弄清楚究竟发生了什么?它只是硬编码,当PresentationHost.exe看到../ netfx/2009/...命名空间时加载4.0 CLR?
假设我有一个抽象基类:
public abstract class BaseClass
{
private MyObject myObject;
protected MyObject PropA
{
get
{
if(myObject == null) this.myObject = new MyObject();
return this.myObject;
}
}
}
Run Code Online (Sandbox Code Playgroud)
...在我的派生类之一中,我想将受保护的基类属性设为PropA public。在这种情况下使用new修饰符是否正确?
public class DerivedClass : BaseClass
{
public new MyObject PropA
{
get
{
return base.PropA;
}
}
}
Run Code Online (Sandbox Code Playgroud)