How can I access the ListViewItems of a WPF ListView?

前端 未结 6 946
天命终不由人
天命终不由人 2020-12-09 10:33

Within an event, I\'d like to put the focus on a specific TextBox within the ListViewItem\'s template. The XAML looks like this:



        
6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-09 11:11

    Or it can be simply done by

    private void yourtextboxinWPFGrid_LostFocus(object sender, RoutedEventArgs e)
        {
           //textbox can be catched like this. 
           var textBox = ((TextBox)sender);
           EmailValidation(textBox.Text);
        }
    

提交回复
热议问题