Finding a childs row and column in UniformGrid based on Index in WPF
vb.net, wpf
Solution
Sorry this is in C# but in principle you need to do
int rows = theGrid.Rows;
int columns = theGrid.Columns;
int index = theGrid.Children.IndexOf(childElement);
int row = index/columns; // divide
int column = index%columns; // modulus
And in VB.NET
dim rows as Integer = theGrid.Rows
dim columns as Integer = theGrid.Columns
dim index as Integer = theGrid.Children.IndexOf(childElement)
dim row as integer = index \ columns
dim column as integer = index mod columns
Problem
In WPF, I have a Uniform Grid and would like to be able to find the row and column based on the index of a child element. I know there is a mathematical way of doing this and would rather not use a normal Grid. If it helps, I can get the total number of rows and columns by using: ``` Math.Sqrt([*uniformgrid*].Children.Count) ```