I want to create my xaml Grid element from the amount of elements
i.e. if I have 6 elements I'll have to do 3 columns and 2 rows (or vice versa)
But my amount of elements (input) can be any value, can be 7, 8, 19, etc.
How can I determinate how many columns and rows I need?
EDIT: More information: I want my grid as square as possible, doesn't matter the possible empty spots