I have multiple StackPanels containing a material design PackIcon and a TextBox. Those are offset by 50 units below one another and contained in a WPF Grid.
The first (Username in my code) is visible, however the second and third are not. This happens both in Visual Studio's xaml preview, as well as in the running application.
Here is the code for the grid. Except for the contents and offset, all three StackPanels are identical.
<Grid Margin="0,50,250,0">
<TextBox Text="Connect" FontSize="24" Margin="20,50" VerticalAlignment="Top" HorizontalAlignment="Left"/>
<StackPanel Margin="5,100" VerticalAlignment="Top" Orientation="Horizontal" Height="30">
<MaterialDesign:PackIcon Kind="Account" VerticalAlignment="Center"/>
<TextBox Style="{DynamicResource MaterialDesignTextBox}" Width="200" Height="25" MaterialDesign:HintAssist.Hint="Username" Margin="10,0"/>
</StackPanel>
<StackPanel Margin="5,150" VerticalAlignment="Top" Orientation="Horizontal" Height="30">
<MaterialDesign:PackIcon Kind="Earth" VerticalAlignment="Center"/>
<TextBox Style="{DynamicResource MaterialDesignTextBox}" Width="200" Height="25" MaterialDesign:HintAssist.Hint="URL / IP Address" Margin="10,0"/>
</StackPanel>
<StackPanel Margin="5,200" VerticalAlignment="Top" Orientation="Horizontal" Height="30">
<MaterialDesign:PackIcon Kind="Ethernet" VerticalAlignment="Center"/>
<TextBox Style="{DynamicResource MaterialDesignTextBox}" Width="200" Height="25" MaterialDesign:HintAssist.Hint="Port" Margin="10,0"/>
</StackPanel>
</Grid>
Kindly add the following statement inside grid:
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
</Grid.RowDefinitions>
By default the row property of grid is set to take entire available space i.e "*" changing it to "auto" did the trick .