0
我有一个从TextBox
WPF的造型自定义控件
public class DecimalTextBox : TextBox
{
#region Float Color
public static readonly DependencyProperty FloatColorProperty = DependencyProperty.Register("FloatColor", typeof(Color), typeof(DecimalTextBox), new FrameworkPropertyMetadata(Colors.Red));
public Color FloatColor
{
get { return (Color)GetValue(FloatColorProperty); }
set { SetValue(FloatColorProperty, value); }
}
#endregion
. . . . .. OTHER STUFF
}
我想用这样的样式该控件继承的类:
<Style x:Key="DecimalTextBoxGridStyle" TargetType="DecimalTextBox">
<Setter Property="TextAlignment" Value="Right"/>
<Setter Property="FloatColor" Value="Black"/>
<Setter Property="BorderBrush" Value="Transparent"/>
</Style>
但它的风格跟我
DecimalT exbox类型不参与wpf项目
我该怎么做到这一点?
还有另外一种方法吗?
什么'{X:类型NS:DecimalTextBox}'其中'ns'是包含'DecimalTextBox'的命名空间? – Maxim
我要试一下 –