从这里中可以为WpfToolkit IntegerUpDown控件创建自定义隐式样式。
<Style TargetType="xctk:IntegerUpDown"
BasedOn="{StaticResource {x:Type xctk:IntegerUpDown}}">不过,我似乎无法为WpfToolkit WatermarkTextBox创建自定义隐式样式。我试过了,但它没有编译:
<ResourceDictionary xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" ...>
<Style TargetType="xctk:WatermarkTextBox"
BasedOn="{StaticResource {x:Type xctk:WatermarkTextBox}}">...</Style>产生错误:
未能从文本'xctk:WatermarkTextBox‘创建'TargetType’
也曾尝试过:
<Style TargetType="{x:Type Control}" BasedOn="{StaticResource BaseStyle}" x:Key="WatermarkBaseStyle">
<Setter Property="FontSize" Value="24" />
</Style>
<Style TargetType="{x:Type xctk:WatermarkTextBox}" BasedOn="{StaticResource WatermarkBaseStyle}"/>产生错误:
“从文本‘xctk:WatermarkTextBox’创建'Type‘。”
发布于 2015-07-15 06:36:02
以下几点对我来说是可行的:
<Style TargetType="{x:Type xctk:WatermarkTextBox}"
BasedOn="{StaticResource {x:Type xctk:WatermarkTextBox}}">尝试在x:Type和BasedOn属性中使用TargetType标记扩展。
https://stackoverflow.com/questions/21531956
复制相似问题