首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 媒体动画 > CAD教程 >

为什么datapager初始化加载数据时第一条数据处于选中状态解决方法

2012-04-15 
为什么datapager初始化加载数据时第一条数据处于选中状态xaml:Grid x:NameLayoutRoot BackgroundWhi

为什么datapager初始化加载数据时第一条数据处于选中状态

xaml:

<Grid x:Name="LayoutRoot" Background="White">
  <telerik:RadGridView HorizontalAlignment="Left" Margin="0,12,0,0" Name="radGridView1" VerticalAlignment="Top" Width="388">
  <telerik:RadGridView.Columns>
  <telerik:GridViewSelectColumn></telerik:GridViewSelectColumn>
  </telerik:RadGridView.Columns>
  </telerik:RadGridView>
  <telerik:RadDataPager PageSize="3" Height="28" HorizontalAlignment="Left" Margin="12,174,0,0" Name="radDataPager1" VerticalAlignment="Top" Width="355" />
  </Grid>

.cs:
 public partial class MainPage : UserControl
  {
  public MainPage()
  {
  InitializeComponent();
  this.radDataPager1.Source = null;
  PagedCollectionView pcv = new PagedCollectionView(GetEmployeeList());
  this.radDataPager1.Source = pcv;
  this.radGridView1.ItemsSource = pcv;
  }
  public List<EmployeeInfo> GetEmployeeList()
  {
  List<EmployeeInfo> employeeList = new List<EmployeeInfo>();
  employeeList.Add(new EmployeeInfo { EmployeeID = 1, EmployeeName = "大林", Salary = 1000, City = "合肥" });
  employeeList.Add(new EmployeeInfo { EmployeeID = 2, EmployeeName = "小林", Salary = 1000, City = "合肥" });
  employeeList.Add(new EmployeeInfo { EmployeeID = 3, EmployeeName = "张三", Salary = 1000, City = "合肥" });
  employeeList.Add(new EmployeeInfo { EmployeeID = 4, EmployeeName = "李四", Salary = 1500, City = "天津" });
  employeeList.Add(new EmployeeInfo { EmployeeID = 5, EmployeeName = "王五", Salary = 2000, City = "上海" });
  employeeList.Add(new EmployeeInfo { EmployeeID = 6, EmployeeName = "赵六", Salary = -800, City = "北京" });
  employeeList.Add(new EmployeeInfo { EmployeeID = 7, EmployeeName = "尤七", Salary = 2100, City = "武汉" });
  employeeList.Add(new EmployeeInfo { EmployeeID = 8, EmployeeName = "马八", Salary = 2300, City = "海口" });
  employeeList.Add(new EmployeeInfo { EmployeeID = 9, EmployeeName = "许九", Salary = 2300, City = "海口" });
  employeeList.Add(new EmployeeInfo { EmployeeID = 10, EmployeeName = "代十", Salary = 2300, City = "海口" });
  return employeeList;
  }
  }

[解决办法]
你可以让它绑定后,再把焦点换成其它呗
这是我个人观点

热点排行