1

我需要实现的非常简单。我在 Windows Phone 8 应用程序中有以下 PhoneTextBox。当 TextBox 有焦点时,我需要 LengthIndicatorVisible 为真,而当它失去焦点时,我不希望它在那里。

<toolkit:PhoneTextBox x:Name="TextBox1" MaxLength="480" GotFocus="TextBox1_GotFocus" LostFocus="TextBox1_LostFocus"/>

对焦方法如下:

private void TextBox1_GotFocus(object sender, RoutedEventArgs e)
{
    TextBox1.LengthIndicatorVisible = true;
    TextBox1.TextWrapping = TextWrapping.Wrap;
}

private void TextBox1_LostFocus(object sender, RoutedEventArgs e)
{
    TextBox1.LengthIndicatorVisible = false;
    TextBox1.TextWrapping = TextWrapping.NoWrap;
}

当它获得焦点并且我输入一些内容时,长度指示器会按原样显示。现在,即使调用 LostFocus() 方法,当它失去焦点时,长度指示符仍然存在。

此外,如果我放置一个 ActionIcon 文本框大小由于 TextWrapping 变大但是当文本被清除时它不会返回到它的默认大小(实际上是高度)

我已经四处寻找类似的行为,但据说它已在最新版本(我使用的版本 - Toolkit)上得到修复。

有人知道这里有什么问题吗?提前致谢。

4

0 回答 0