There is no easy and fast way. It is possible only for O (n).
private void UniformGrid_MouseDown(object sender, MouseButtonEventArgs e) { // ΡΠ·Π½Π°Π΅ΠΌ, Π½Π° ΠΊΠ°ΠΊΠΎΠΌ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠ΅ ΠΊΠ»ΠΈΠΊΠ½ΡΠ»ΠΈ var element = e.Source as UIElement; if (element != null) { // ΡΠ·Π½Π°Π΅ΠΌ ΠΈΠ½Π΄Π΅ΠΊΡ ΡΡΠΎΠ³ΠΎ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠ° ΡΡΠ΅Π΄ΠΈ Π²ΡΠ΅Ρ
ΠΊΠΎΠ½ΡΡΠΎΠ»ΠΎΠ² Π³ΡΠΈΠ΄Π° int index = UniformGrid.Children.IndexOf(element); // ΡΠ·Π½Π°Π΅ΠΌ ΡΡΠ΄ ΠΈ ΠΊΠΎΠ»ΠΎΠ½ΠΊΡ int row = index / UniformGrid.Columns; int column = index % UniformGrid.Columns; } }
It is possible that it would be better to follow the MVVM path, where the content will be filled through the binding and where the cell number you will control yourself.