Windows Phone TextBox几乎无法点击

时间:2015-04-09 14:35:37

标签: c# windows-phone-8 textbox clickable

我的Windows Phone应用程序中有一个TextBox。似乎只有TextBox的上半部分可以单击来编辑文本。我需要整个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>

1 个答案:

答案 0 :(得分:0)

尝试将RowDefinition添加到网格中。这两个控件现在重叠了。

e.g。

<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>