Uniform grid with gridlines always visible (WPF)

877 views Asked by At

I would need to create a WPF component that accepts a row and column layout ​​as input (2 rows and 2 columns, 3 rows and 3 columns, etc.).

So I took a listview and as itempaneltemplate I use a uniformgrid.

When I add an element to the listview (which is a usercontrol, added via a datatemplate) it is set according to the uniform grid layout.

What I can't implement is that when I set up a layout, I would like the boxes that will then be filled by my user control at runtime to be visible even when the listview is empty.

Sample Image: enter image description here

1

There are 1 answers

0
EldHasp On BEST ANSWER

The Uniformgrid is just a panel. She has no means of marking boundaries. In each cell, you need to place a Border with its own borders. And in the Content Border (where necessary) place the output of the required element.

One example: Draw samurai sudoku grid on WPF