<Window x:Class="tests.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525" Background="Red" Foreground="Cyan">
<StackPanel VerticalAlignment="Center">
<Button>123</Button>
<TextBlock>123</TextBlock>
<TextBox>123</TextBox>
</StackPanel>
</Window>
在上面的代码中,只有TextBlock会“继承”前景色和背景色。 Button和TextBox不应该有那些颜色吗?他们为什么不拥有它? alt text http://img707.imageshack.us/img707/8014/5uslgmbzkbyurgwuwgqtzv2.png为什么只有一些子元素会有父母定义的属性