Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我使用多行文本框时,文本框的文本/内容应该对齐到顶部,如果它是单行文本框,那么它的文本对齐方式应该是默认的(中心),我需要在文本框样式中设置它,所以当有一个多行文本框时,我的样式会自动相应地调整内容。
你只需要VerticalContentAlignment="Top"在你的文本框中设置,如:
VerticalContentAlignment="Top"
<TextBox TextWrapping="Wrap" AcceptsReturn="True" Text="sample ... " VerticalContentAlignment="Top" />