Skip to content

Make Controls:TextBoxHelper.UseFloatingWatermark="True" work for DatePicker #2269

@FilippoVigani

Description

@FilippoVigani

It would be cool if the option in TextBoxHelper.UseFloatingWatermark worked on DatePicker. Any way to make it work in case you don't plan to make it a functionality?
floatingwatermark

As a temporary workaround I created a simple style to achieve what I'd like:

<Style TargetType="{x:Type DatePickerTextBox}"
                   BasedOn="{StaticResource {x:Type DatePickerTextBox}}">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate>
                            <TextBox Controls:TextBoxHelper.Watermark="{Binding Path=(Controls:TextBoxHelper.Watermark),RelativeSource={RelativeSource TemplatedParent}}"
                                     Controls:TextBoxHelper.UseFloatingWatermark="True"
                                     VerticalContentAlignment="Center"
                                     Text="{Binding Text, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
                                     BorderThickness="0"
                                     Padding="0" />
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

result

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions