问题描述
我有一个 C# 商店应用程序,其中有一个搜索框或文本框.我注意到当我在文本或搜索框中输入文本时,我没有在框的末尾获得X"按钮来清除文本.在这个例子中,有人遇到了类似的问题:Remove "X"文本框末尾的按钮但我想撤消该操作.
I have a C# store app where i have a search box or a textbox. I noticed that when i enter text in either the text or searchbox i don't get the "X" button at the end of the box to clear the text.In this example there is someone with a similar problem: Remove "X" button at the end of a TextBox But i want to reverse that action.
正如我在上面的链接中所了解的,该按钮应该会自动出现,但它不会.有谁知道如何让X"按钮出现在搜索框或文本框上?
As I understand in the above link, the button should appear automatically, but it does not. Does anyone know how I can get that "X" button to appear on either a searchbox or textbox?
盒子:
<TextBox x:Name="textboxNoX" Grid.Column="1" HorizontalAlignment="Left" Margin="401,66,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="259"/>
<SearchBox x:Name="searchbarNoX" Grid.Column="1" HorizontalAlignment="Left" Margin="400.998,33.478,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" Width="256.565" d:LayoutRounding="Auto">
推荐答案
啊,属性TextWrapping="Wrap"
应该设置为TextWrapping="NoWrap"
.
这篇关于C# 商店应用程序.在文本框或搜索框的末尾添加“X"按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!