Textbox标记和IsHitTestVisible属性

Pra*_*hee 6 c# wpf xaml

<TextBox Foreground="Black" 
         FontFamily="Times New Roman" 
         FontWeight="Bold" 
         FontSize="15" 
         MaxHeight="50" 
         Margin="6,95,40.067,0" 
         Name="txt1" VerticalAlignment="Top" 
         IsHitTestVisible="False" 
         Height="30" 
         Grid.Row="4" 
         Grid.Column="2"/> 
Run Code Online (Sandbox Code Playgroud)

IsHitTestVisible属性在TextBox上的作用是什么?

gau*_*rma 12

当你在另一个控件里面有一个控件时,比如,如果你有一个TextBox里面...让我们说另一个TextBox.然后通过将isHitTestvisible父控件的属性设置为False,允许用户键入子TextBox.如果将其设置为True,则将在父控件级别处理RoutedEvent.

此属性主要在您使用时使用Adorners.


Tar*_*ion 0

如果此元素可以作为至少一个点的命中测试结果返回,则为 true;否则为假。默认值是true。

来源:MSDN

另请参阅:视觉层中的命中测试