2014-03-26 2 views

답변

1
UIElement FindByCell1(Grid g, int row, int col) 
{ 
    var childs = g.Children.Cast<UIElement>() 
    return childs.Where(x => Grid.GetRow(x) == row && Grid.GetColumn(x) == col).FirstOrDefault(); 
} 

동일한 셀의 일부 요소가있을 수 있습니다 경우 : 경우

IEnumerable<UIElement> FindByCell(Grid g, int row, int col) 
{ 
    var childs = g.Children.Cast<UIElement>() 
    return childs.Where(x => Grid.GetRow(x) == row && Grid.GetColumn(x) == col); 
} 

,이 방법 - UI의 요소와 함께 직접 작업은 - 매우 매우 좋습니다, 그리고 그것 극단적으로 MVVM과 반대입니다.

관련 문제