如何在wpf datagrid中逐行获取

时间:2016-09-24 11:58:50

标签: c# wpf datagrid

我有一个数据网格,当我在这个数据网格上加载数据时,我想专注于选定的行。但我不能逐条排名。

if (gridAppointment.SelectedIndex >= 0)
{
   gridAppointment.ScrollIntoView(gridAppointment.Items[gridAppointment.SelectedIndex]);
   DataGridRow row = (DataGridRow)gridAppointment.ItemContainerGenerator.ContainerFromIndex(
         gridAppointment.SelectedIndex);
   if (row != null)
       row.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));                                               
 }

1 个答案:

答案 0 :(得分:0)

当您选择行时,下一个条件为真,您可以获得所有单元格值。

#!/bin/bash
echo -n "Please enter some input: "
read input

for number in `seq -f "%03g" 1 $input`
do
  command anyname-${number} -some -parameter
done