2

From here it seems possible to create a custom implicit style for WpfToolkit IntegerUpDown control.

<Style TargetType="xctk:IntegerUpDown"
       BasedOn="{StaticResource {x:Type xctk:IntegerUpDown}}">

I cannot seem to create a custom implicit style for WpfToolkit WatermarkTextBox though. I have tried this but it does not compile:

<ResourceDictionary xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" ...>

<Style TargetType="xctk:WatermarkTextBox"
       BasedOn="{StaticResource {x:Type xctk:WatermarkTextBox}}">...</Style>

Produces error:

Failed to create a 'TargetType' from the text 'xctk:WatermarkTextBox'

Also tried:

<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}"/>

Produces error:

'Failed to create a 'Type' from the text 'xctk:WatermarkTextBox'.'

Brock Hensley
  • 3,617
  • 2
  • 29
  • 47

1 Answers1

2

The following works for me:

<Style TargetType="{x:Type xctk:WatermarkTextBox}" 
       BasedOn="{StaticResource {x:Type xctk:WatermarkTextBox}}">

Try using the x:Type markup extension in both the TargetType and BasedOn properties.

lc.
  • 113,939
  • 20
  • 158
  • 187