我的Windows Phone应用程序中有一个TextBox。似乎只有文本框的上半部分可以点击来编辑文本。我需要整个文本框都是可点击的。
为什么会这样?
<Grid x:Name="FolderNameGrid">
<TextBlock Text="{Binding SelectedPostbox.LabelToUpper}"
Style="{StaticResource PageTitleTextBlockStyle}"
Visibility="{Binding IsInSearchMode, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter=!}" />
<TextBox x:Name="SearchTextBox"
Margin="20,10,20,10"
KeyDown="SearchTextBox_OnKeyDown"
TextChanged="SearchTextBox_OnTextChanged"
GotFocus="SearchTextBox_GotFocus"
PlaceholderText="{Binding TextSource, Converter={StaticResource Language}, ConverterParameter=Module-Messages-Search, FallbackValue=Module-Messages-Search}"
Visibility="{Binding IsInSearchMode, Converter={StaticResource BoolToVisibilityConverter}}" />
</Grid>
尝试将RowDefinitions添加到网格中。两个控件现在重叠。
例如
<Grid x:Name="FolderNameGrid">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Text="{Binding SelectedPostbox.LabelToUpper}"
Style="{StaticResource PageTitleTextBlockStyle}"
Visibility="{Binding IsInSearchMode, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter=!}" />
<TextBox Grid.Row="1"
x:Name="SearchTextBox"
Margin="20,10,20,10"
KeyDown="SearchTextBox_OnKeyDown"
TextChanged="SearchTextBox_OnTextChanged"
GotFocus="SearchTextBox_GotFocus"
PlaceholderText="{Binding TextSource, Converter={StaticResource Language}, ConverterParameter=Module-Messages-Search, FallbackValue=Module-Messages-Search}"
Visibility="{Binding IsInSearchMode, Converter={StaticResource BoolToVisibilityConverter}}" />
</Grid>