【WPF】TextBox汇总

一、隐藏边框

<TextBox Text="Hello" Width="480" TextWrapping="Wrap" IsReadOnly="True"  BorderBrush="{x:Null}" BorderThickness="0"></TextBox>

关键语句 BorderBrush="{x:Null}" BorderThickness="0"

 

二、使用KeyBinding绑定命令、键盘事件

eg:回车事件

            <TextBox Text="{Binding CurrentPage}" >
                <TextBox.InputBindings>
                    <KeyBinding Command="{Binding GotoPageCommand}" Key="Return"/>
                </TextBox.InputBindings>
            </TextBox>

参考1:https://blog.csdn.net/BYH371256/article/details/122506104

参考2:https://blog.csdn.net/BadAyase/article/details/125308737

posted @ 2021-09-24 09:28  不溯流光  阅读(138)  评论(0编辑  收藏  举报