Add InfoElement.ClearButtonInvisibleByHidden.#1596
Open
GF-Huang wants to merge 1 commit intoHandyOrg:masterfrom
Open
Add InfoElement.ClearButtonInvisibleByHidden.#1596GF-Huang wants to merge 1 commit intoHandyOrg:masterfrom
InfoElement.ClearButtonInvisibleByHidden.#1596GF-Huang wants to merge 1 commit intoHandyOrg:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
InfoElement.ClearButtonInvisibleByHidden="False" (default value)InfoElement.ClearButtonInvisibleByHidden="True"可能你会觉得这个属性似乎没太大的必要,为元素(在这个例子中是
hc:TextBox)设置一个MinWidth不就解决了边框大小变化的问题了?或者HorizontalAlignment设为Stretch。考虑下如果在多语言支持的程序环境下,不同语言的Placeholder长度差异可能非常大,为每个语言单独设置不同的MinWidth非常麻烦,粗暴地设置Stretch可能会导致TextBox变得非常宽。同时,除去Placeholder以后留空一大片空白影响美观。另一个有必要的场景如下:
Window 没有显式设置宽和高,而依赖内容自动计算出实际所需,这里实际是依赖
hc:TextBox的宽度,而hc:TextBox则依赖于Placeholder,把鼠标移到hc:TextBox上面触发ClearButton进行显示会导致窗口自动变宽以包含ClearButton的宽度;鼠标移开时又会触发ClearButton隐藏导致窗口变窄。更直观的效果就是鼠标滑过这个hc:TextBox的时候,整个窗口宽度会快速地变宽再还原,非常影响观感。