VariableSizedWrapGrid controls with different size in row

youki 846 Reputation points

Why does the CheckBox doesn't fit to the right from the CombobBox if i change the width with the mouse. There is still a lot of room to the right from the CheckBox.

I've tried anything with MaximumRowsOrColumns, ColumnSpan and RowSpan but I can't figure it out.


User's image

<Grid Grid.Row="1" Background="#272727" CornerRadius="3" Padding="0,10,0,0" Margin="0,0,15,0">

	<StackPanel Orientation="Vertical">

		<VariableSizedWrapGrid Orientation="Horizontal" Background="Green">

			<ComboBox x:Name="cmbApplication" 
				  Margin="0,0,5,0" Background="Gray">


			<CheckBox Name="cbApplication" Content="Aktiviert" Width="10" Background="Blue" ></CheckBox>




Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
438 questions
No comments
{count} votes

Accepted answer
  1. Xiaopo Yang - MSFT 5,851 Reputation points Microsoft Employee

    VariableSizedWrapGrid.ItemWidth Gets or sets the width of the layout area for each item that is contained in a VariableSizedWrapGrid and The default is NaN which means the VariableSizedWrapGrid uses the width of the first cell.

    VariableSizedWrapGrid.ColumnSpan Gets or sets a value that indicates the total number of columns that the element content spans within a parent VariableSizedWrapGrid.

    You can try VariableSizedWrapGrid.HorizontalChildrenAlignment Property. Stretch Property indicates An element stretched to fill the entire layout slot of the parent element.

    No comments

1 additional answer

Sort by: Most helpful
  1. youki 846 Reputation points


    I think i missed the ItemWidth and HorizontalChildrenAlignment in the VariableSizedWrapGrid tag.

    User's image

    <VariableSizedWrapGrid Orientation="Horizontal" MaximumRowsOrColumns="3" HorizontalChildrenAlignment="Left" ItemWidth="140" Background="Green">
    		VariableSizedWrapGrid.ColumnSpan="2" Background="Gray">
    	<CheckBox Content="Aktiviert" VariableSizedWrapGrid.ColumnSpan="1" Background="Red"></CheckBox>
    No comments