I am really confused why some of my textboxes and buttons are being cut off, could someone please help me fix this problem? Thanks!!
XAML CODE
<Grid>
<TabControl>
<TabItem Name="tabHome">
<TabItem.Header>
<Label Content="Home" MouseLeftButtonDown="tabHome_Click"/>
</TabItem.Header>
<Grid>
<Button Content="Parse" Height="23" x:Name="btn_parse" Width="75" Click="buttonParse_Click" Margin="180,10,180,176"/>
<TextBox IsReadOnly="True" x:Name="txtbox_filepath" Height="25" Width="135" Margin="151,52,150,132" />
<Button Content="Reset" Height="23" x:Name="btn_reset" Width="75" Margin="180,122,180,64" Click="buttonReset_Click"/>
</Grid>
</TabItem>
<TabItem Name="tabConfig">
<TabItem.Header>
<Label Content="Configuration" MouseLeftButtonDown="tabConfig_Click"/>
</TabItem.Header>
<ScrollViewer>
<StackPanel Name="panelConfig">
</StackPanel>
</ScrollViewer>
</TabItem>
<Grid>
Screenshot
As you can see the button and the textbox is cut off in the corners.
Thank you for the help I appreciate it.
When you give a Margin value like this Margin="180,10,180,176"
then it means that the control has to be placed 180 dip from Left and 10 dip from Top, 180 from Right and 176 from bottom with reference to the parent control. Your controls were clipped because of the high Margin values.
Note: dip - device independent pixels.
It is better to create RowDefinitions
for Grid
and place controls in separate rows with reasonable margin value as shown below.
<Grid>
<TabControl>
<TabItem Name="tabHome">
<TabItem.Header>
<Label Content="Home"/>
</TabItem.Header>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Button Grid.Row="0" Content="Parse" Height="23" x:Name="btn_parse" Width="75" Margin="10" />
<TextBox Grid.Row="1" IsReadOnly="True" x:Name="txtbox_filepath" Height="25" Width="135" Margin="10" />
<Button Grid.Row="2" Content="Reset" Height="23" x:Name="btn_reset" Width="75" Margin="10"/>
</Grid>
</TabItem>
<TabItem Name="tabConfig">
<TabItem.Header>
<Label Content="Configuration"/>
</TabItem.Header>
<ScrollViewer>
<StackPanel Name="panelConfig">
</StackPanel>
</ScrollViewer>
</TabItem>
</TabControl>
</Grid>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With