AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
24.74k stars 2.14k forks source link

Placeholder vs Watermark #4878

Open mrj001 opened 3 years ago

mrj001 commented 3 years ago

Controls such as NumericUpDown, AutoCompleteBox, CalendarDatePicker and TextBox implement a Watermark property.

However, the ComboBox implements a PlaceholderText property instead.

The TextBox.Watermark property documentation offers no explanatory text. There is no documentation on the ComboBox.PlaceholderText property.

It appears to me that this is inconsistent naming for the same concept. However, Issue#1282 contains the following relating to TextBox:

Need to add Placeholder related properties (instead of/in addition to Watermark)

The phrase "in addition to" implies that there is a difference between these two.

What is the difference between a Watermark and a PlaceholderText? Or should the ComboBox be updated for consistency?

mstr2 commented 3 years ago

Just a linguistic observation: the defining feature of a watermark is that it is always present on the marked object (for example in postage stamps, currency or a 'digital watermark'). A placeholder, on the other hand, can be removed at any time and replaced with something else.

grokys commented 3 years ago

The inconsistency comes from the different controls having different origins. The original controls had a Watermark property because that's what it's called in MahApps.Metro which adds this feature to WPF.

PlaceholderText was added to ComboBox as part of the fluent theme port and that's what it's called in WinUI: https://github.com/AvaloniaUI/Avalonia/pull/4019

I agree that we should standardize on one naming and that "Placeholder" is better than "Watermark" however this would be an API break.

We've talked in the past about being able to "alias" Avalonia properties, probably the best course of action would be to implement this feature, add PlaceholderText and make Watermark a deprecated alias of it.