-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] [WIP] Watermark Enhancements #2898
Conversation
…xterior of the control
@punker can I ask why the "Breaking" label? I took care to ensure that "Interior" is the default setting - users don't have to declare it, and their code will work fine following the update, as demonstrated in the MetroDemo in my branch (unless you think something in |
Reviewing this PR is hard as it also reformats many XAML files. @amkuchta please consider using XAML Styler, a VS extension for formatting XAMl files. @punker76 added a settings file for XAML Styler. |
@thoemmi no problem, I'll pull the settings file. I already use XAML Style for my other projects, but my formatting for them is different. I'll ingest the settings for MA.M and add another commit later today (US time) |
…f Watermark TextTrimming
@thoemmi @punker76 formatting is updated per the referenced XAML Styler settings file - should be easier to follow along with now. I also began implementing This also implements #2889 by applying |
I must really say make changes always without any code formatting changes together, cause this makes it always hard to read and review the changes... so maybe the settings file is not up to date :-( oh man |
@punker76 noted. Might not be a bad idea to add text about the XAML Style settings file in the PR template - it would probably help to make sure that everyone is on the same page when they submit |
@amkuchta will do this, sorry |
@punker76 no need to apologize - just trying to help keep guys like me from creating headaches for guys like you |
…ng - now it works!
I'll incorporate this throughout (including on floating watermarks) tonight / tomorrow |
@@ -31,6 +31,8 @@ public class SpellCheckSeparator : Separator, ISpellCheckMenuItem | |||
{ | |||
} | |||
|
|||
public enum FloatingWatermarkLocations { Interior, Exterior }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you consider renaming this enum to singular. Because plural enum name should be used for enums with a [FlagAttribute]
[AttachedPropertyBrowsableForType(typeof(NumericUpDown))] | ||
[AttachedPropertyBrowsableForType(typeof(DatePicker))] | ||
[AttachedPropertyBrowsableForType(typeof(TimePickerBase))] | ||
public static string GetFloatingWatermarkLocation(DependencyObject obj) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why returning a string when FloatingWatermarkLocation is of type FloatingWatermarkLocations
?
[AttachedPropertyBrowsableForType(typeof(DatePicker))] | ||
[AttachedPropertyBrowsableForType(typeof(TimePickerBase))] | ||
[AttachedPropertyBrowsableForType(typeof(NumericUpDown))] | ||
public static string GetWatermarkTrimming(DependencyObject obj) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why returning a string when WatermarkTrimming is of type TextTrimming
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xxMUROxx I will rename the enum
, and the two functions return string
because FloatingWatermarkLocation
started out as typeof string
and I forgot to change it 😆 I'll change this too - good catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@xxMUROxx updated to address your concerns with the latest commit |
Thought of another item to implement that is Watermark based: an ability to override longer watermarks with something shorter for display when FloatingWatermarks are in use (I need to change it to a
Example GIF: |
…for override text to be MultiDataBinding that takes UseFloatingWatermark into account
@punker76 @thoemmi I'm done! I updated the main text for the PR to reflect what is done and what still needs to happen - short version is that editable Let me know if you guys want me to change anything, and thanks in advance for the help with the |
@punker76 @thoemmi I see now that there are some conflicts with this PR and the develop branch now that Thoughts? |
You have two options:
- merge develop into this branch (easiest)
- rebase the branch on develop (you have to force push)
I personally prefer the first as you can see on open PR created by me
Any changes you make to this branch (even rewriting history) is reflected to this PR. So no need to close and create a new one
|
@xxMUROxx, the issue is that the history itself is messed up - changes that I made were overwritten by XAML formatting updates, which makes analyzing the diff hard for @punker76 and @thoemmi. Creating a new pull request (which has the correct formatting applied from the start) will make analyzing the diff easier, which speeds up the review process. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why you need FloatingWatermarkOverrideText
. It's not that you toggle between interior and exterior watermark at runtime und need two different texts.
BTW, a new PR would be appreciated 😉
@thoemmi I have a watermark that reads "Email Address (you@example.com)". I want the example in the watermark, I only want my floating watermark to read "Email Address" (without the example, because it looks ugly). To achieve this, I set I could then go a step further by deciding to have the watermark float exterior to the box by setting Hope that clarifies! Also, I'll work the new PR tonight 😄 |
Ok, I see your point. However, personally I don't like watermark's appearing and disappearing, regardless if inside or outside the textbox: it changes the layout, and the user might be irritated by the moving controls. Like I said in #1825, what you're talking about is a header and not a watermark. |
@thoemmi the watermark shouldn't be "appearing or disappearing" - the transitions are the same, it's really just a matter of where the watermark is being shown and what it says. To address the "header" topic, wouldn't the current floating watermark really be just a header that is inside of the border of the TextBox? And as far as the moving control goes, the In any case, both points are semi-moot; the changes I have made use your original settings as the standard, and users must explicitly declare my options in order for them to take effect. If the users like yours better, they do not have to adjust their implementation at all, and current users will not see any change in how the controls function following the incorporation of this feature. |
Indeed, I'm not a fan of the already existing I'm curious how many users of MahApps.Metro are really using Anyway, that's just my $ 0.02. At the end of the day @punker76 has the final say. |
@thoemmi it's good to know that I shouldn't take it personally! In all honesty, I understand the "feature creep" that you are concerned about - unmanageable code is a pain. I wanted to implement this at the MahApps level for two reasons:
Like most devs, I'm lazy 🤣 |
Closing to create (another) new PR that is cleaner and has the correct formatting... It'll be a bit, largely because git sucks. |
What changed?
I love the functionality of the floating watermark, but don't like that the border stretches, as do any buttons contained within the control. My solution is to implement a watermark that floats outside of the control. Improvements include:
FloatingWatermarkLocation
, which can be used on the following controls:Controls:TextBoxHelper.FloatingWatermarkOverrideText
, which allows users to set a custom text for floating watermarks if they feel that the current watermark is too longTODO (Help Needed)
Status on all controls:
FloatingWatermarkLocation
works well on non-editable ComboBox controls... but if editing is enabled, forget about it (it works on initial load, but I cannot get it to work after the text has been changed). I could use some help wiring this togetherTemplateBinding
isn't working...@thoemmi , I figured that you may be the best person to take a look, since you did the initial creation of the UseFloatingWatermark feature. Thoughts? (Sorry for the duplicate tag - I moved this to its own PR, where it belongs)
Closed Issues