2014-11-20 100 views
2

我已經創建文本框XAML和Silverlight:應用樣式子失敗

public class MyAwesomeTextBox : TextBox { ... } 

的子類,設置的所有文本框的顏色是紅色

<UserControl> 
    <UserControl.Resources> 
     <Style TargetType="TextBox"> 
      <Setter Property="Background" Value="Red" /> 
     </Style> 
    </UserControl.Resources> 
    <TextBox ... /> 
    <xyz:MyAwesomeTextBox ... /> 
</UserControl> 

它適用於所有的文本框,但不適用於MyAwesomeTextBoxes。

請告訴我什麼是錯的。

+1

'