【发布时间】:2013-10-14 08:43:15
【问题描述】:
我有以下代码可以构建一个文本框。 该应用程序要求我将所有控件设为通用, 因为这就是我们的 api 发送给我们的方式。
TextBox txtcontent = new TextBox();
txtcontent.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Stretch;
txtcontent.SetValue(Grid.ColumnProperty, 1);
txtcontent.SetValue(Grid.RowProperty, RowCount);
txtcontent.Width = 320;
txtcontent.FontSize = 20;
txtcontent.TextWrapping = TextWrapping.Wrap;
txtcontent.Margin = new Thickness(10);
txtcontent.Foreground = App.scbAccTechGrayDark;
txtcontent.BorderBrush = App.scbAccTechGrayLight;
txtcontent.Background = App.scbAccTechGreenLight;
txtcontent.Tapped += txtcontent_Tapped;
现在的问题是当我点击文本框时它不会触发点击事件。 我知道鼠标点击会触发商店应用的点击事件?
这是点击事件的第一部分,但我从未到达。
void txtcontent_Tapped(object sender, TappedRoutedEventArgs e)
{
TextBox txtFinder = (sender as TextBox);
string[] myconver = (sender as TextBox).Tag.ToString().Split(',');
int BlockIndex = Convert.ToInt16(myconver[4].ToString());
int FieldID = Convert.ToInt16(myconver[5].ToString());
string ColumnName = Convert.ToString(myconver[6].ToString());
string FieldCode = Convert.ToString(myconver[7]);
string BlockName = Convert.ToString(myconver[8]);
}
谁能告诉我我必须做什么,或者我在这里做错了什么?
【问题讨论】:
-
你想实现什么行为?也许 GotFocus 活动对你有用。
-
@Anubis1233 感谢根据我需要工作的伙伴,如果您将其作为答案,我会为您选择它。实际上很明显,现在我认为 bout 它! :)
标签: c# visual-studio-2012 windows-8 windows-store-apps mouseclick-event