Martin
Martin

Reputation: 25

xaml in WPF: how to set distances between items in ListvVew - UniformGrid

In my C# WPF app I have a ListView, in which I defined the ItemsPanelTemplate as UniformGrid. Within the the UniformGrid I have Checkboxes in several rows and columns. The Checkboxes are styled as Grid (26 x 26) containing a Border (26 x 26) containing an Ellipse. Now I am wondering, why the horizontal distances between the checkboxes are bigger than the vertical distances. For better visibility I defined the Background properties as follows: ListView : Red UniformGrid : Green CheckBox-Grid : Yellow CheckBox-Ellipse: Gray

enter image description here

I tried all properties I know like HorizontalAlignment (center), VerticalAlignment (center), Padding (o), Margin (0), HorizontalItemAlignment (center), ... at all stages but the horizontal distance is always bigger than the vertical. What's the property to have equal horizontal and vertical distances?

Kind regards Martin

Upvotes: 0

Views: 126

Answers (1)

Martin
Martin

Reputation: 25

I solved it by setting the Margin of the Grid of the CheckBox (yellow) to "-3,0" but I think this more like a workaround than good coding.

Upvotes: 0

Related Questions