@Alice 我也遇到这个问题,请问如何在内存中定义的控件中定义事件呢?我直接写入事件报错。并且还找不到错误在哪里。
如:
private const string strXaml =
"<DataTemplate " +
"xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" " +
"xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" " +
"xmlns:sdk=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk\">" +
"<sdk:AutoCompleteBox MinimumPrefixLength=\"0\" Text=\"{Binding Path=NumOrder,Mode=TwoWay}\" GotFocus=\"AutoCompleteBox_GotFocus\" FilterMode=\"None\"/> " +
"</DataTemplate>";
/// <summary>
/// 获取焦点时
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void AutoCompleteBox_GotFocus(object sender, RoutedEventArgs e)
{
//事件方法
} |
|