This question is locked. New answers and comments are not allowed.
Hi ,
I have a GridView,I want to handle the GotFocus event of it. When You click the GridViewCell or somewhere else,it will got focus.But When you click on the column's header(or title anyway), nothing happen.
RadControls for Silverlight Q2 2010 SP2
Microsoft Silverlight Version: 4.0.50917.0
Microsoft Visual Studio 2010 Version 10.0.30319.1 RTMRel
Microsoft .NET Framework Version 4.0.30319 RTMRel
My code as follows. Help me ,please!
GridViewDemo.xaml
GridViewDemo.xaml.cs
I have a GridView,I want to handle the GotFocus event of it. When You click the GridViewCell or somewhere else,it will got focus.But When you click on the column's header(or title anyway), nothing happen.
RadControls for Silverlight Q2 2010 SP2
Microsoft Silverlight Version: 4.0.50917.0
Microsoft Visual Studio 2010 Version 10.0.30319.1 RTMRel
Microsoft .NET Framework Version 4.0.30319 RTMRel
My code as follows. Help me ,please!
GridViewDemo.xaml
<UserControl x:Class="DockingPane.GridViewDemo" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"> <Grid x:Name="LayoutRoot" Background="White"> <telerik:RadGridView x:Name="gridView"> </telerik:RadGridView> </Grid></UserControl>GridViewDemo.xaml.cs
using System;using System.Collections.Generic;using System.Linq;using System.Net;using System.Windows;using System.Windows.Controls;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Animation;using System.Windows.Shapes;using System.Collections.ObjectModel;using System.Diagnostics;namespace DockingPane{ public partial class GridViewDemo : UserControl { public GridViewDemo() { InitializeComponent(); this.gridView.ItemsSource = EmployeeService.GetEmployees(); this.gridView.GotFocus += new RoutedEventHandler(GridView_GotFocus); } public string Title = "GridViewDemo"; private void GridView_GotFocus(object sender,RoutedEventArgs e) { UIElement element = e.OriginalSource as UIElement; Debug.WriteLine(element.ToString()); } } public class Employee { public string FirstName { get; set; } public string LastName { get; set; } public int Age { get; set; } public bool Married { get; set; } } public class EmployeeService { public static ObservableCollection<Employee> GetEmployees() { ObservableCollection<Employee> employees = new ObservableCollection<Employee>(); Employee employee = new Employee(); employee.FirstName = "Maria"; employee.LastName = "Anders"; employee.Married = true; employee.Age = 24; employees.Add(employee); employee = new Employee(); employee.FirstName = "Ana"; employee.LastName = "Trujillo"; employee.Married = true; employee.Age = 44; employees.Add(employee); employee = new Employee(); employee.FirstName = "Antonio"; employee.LastName = "Moreno"; employee.Married = true; employee.Age = 33; employees.Add(employee); employee = new Employee(); employee.FirstName = "Thomas"; employee.LastName = "Hardy"; employee.Married = false; employee.Age = 13; employees.Add(employee); employee = new Employee(); employee.FirstName = "Hanna"; employee.LastName = "Moos"; employee.Married = false; employee.Age = 28; employees.Add(employee); employee = new Employee(); employee.FirstName = "Frederique"; employee.LastName = "Citeaux"; employee.Married = true; employee.Age = 67; employees.Add(employee); employee = new Employee(); employee.FirstName = "Martin"; employee.LastName = "Sommer"; employee.Married = false; employee.Age = 22; employees.Add(employee); employee = new Employee(); employee.FirstName = "Laurence"; employee.LastName = "Lebihan"; employee.Married = false; employee.Age = 32; employees.Add(employee); employee = new Employee(); employee.FirstName = "Elizabeth"; employee.LastName = "Lincoln"; employee.Married = false; employee.Age = 9; employees.Add(employee); employee = new Employee(); employee.FirstName = "Victoria"; employee.LastName = "Ashworth"; employee.Married = true; employee.Age = 29; employees.Add(employee); return employees; } }}