XAML layout with various combinations

My WPF application will be fetching usernames from a database and I want to display a button with each username on it in a WPF page.

I don't know how many users were in front of the hand, so I want to resize and position the buttons based on the number to display.
For example:

  • If there is one custom display, there is one button in the center of the screen.
  • If 4 users display 4 buttons in a 2x2 layout.
  • If 8 users display 8 buttons in a 3x3 grid with a zero position of the 9th row,
  • And so on up to 64 users (8x8 grid)

How can I do this using XAML?

+3


source to share


1 answer


WPF Uniform grid control is suitable for your requirement. It will contain rows and columns. Grid will take care of the automatic layout of the elements.



+3


source







All Articles