I need to get the contents of a cell in a Grid in C #. Is there a way to do something like this?
Grid
UIElement element = MyGrid.Children.getElementAt(x, y)
You can use Linq:
// using System.Linq; var element = grid.Children.Cast<UIElement>(). FirstOrDefault(e => Grid.GetColumn(e) == x && Grid.GetRow(e) == y);
or if the specified cell contains more than one element:
var elements = grid.Children.Cast<UIElement>(). Where(e => Grid.GetColumn(e) == x && Grid.GetRow(e) == y);
where the elements are IEnumerable<UIElement> .
IEnumerable<UIElement>