Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello I'm making a program that has a toolbar and underneath it a tab control.In my designer it shows like this:
Image[^]
Exactly like i want. (the button is just there for testing).
But when I launch the application the tab controls shrink.
Image[^]

How can I fix this?

EDIT:
sorry i forgot the code
XML
<pre><Page x:Class="InvoiceX.pages.InvoiceEditor"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:local="clr-namespace:InvoiceX.pages"
      mc:Ignorable="d" 
      d:DesignHeight="450" d:DesignWidth="800"
      Title="InvoiceEditor">

    <Grid VerticalAlignment="Stretch">
        <Grid.RowDefinitions>
            <RowDefinition Height="5*" />
            <RowDefinition Height="85*" />
        </Grid.RowDefinitions>
        
        <ToolBar ToolBarTray.IsLocked="true" Grid.Row="0">
                <Menu>
                    <MenuItem Header="File">
                        <Button Command="New" Content="New" />
                        <Button Command="Open" Content="Open" />
                        <Button Command="Save" Content="Save" />
                    </MenuItem>
                </Menu>
         </ToolBar>

        <TabControl x:Name="InvoiceNavigation" Grid.Row="1" >
            <TabItem Header="Customer">
                <Grid Background="#FFE5E5E5">
                    <Button Command="Save" Content="Save"/>
                </Grid>

            </TabItem>
            <TabItem Header="Items">
                <Grid Background="#FFE5E5E5"/>
            </TabItem>
            <TabItem Header="Invoice">
                <Grid Background="#FFE5E5E5">
                </Grid>
            </TabItem>
        </TabControl>

    </Grid>
    
</Page>


What I have tried:

Searching the internet but I did not find anything that could help me in this situation.
Posted
Updated 11-Nov-19 3:38am
v2
Comments
ZurdoDev 11-Nov-19 9:35am    
Show your code.
dolfijn3000 11-Nov-19 9:50am    
sorry i forgot to ad dit its added now.
phil.o 11-Nov-19 9:53am    
Have you considered using a DockPanel instead of a Grid? Because this is exactly what it is designed for.
dolfijn3000 11-Nov-19 10:16am    
I changed it but I still have the same problem. https://pastebin.com/miGdg7jZ
In the design view, it still shows as I want but when I run it doesn't.
Richard Deeming 12-Nov-19 10:11am    
That XAML works fine for me. Do you have other styles defined somewhere which might override the VerticalAlignment of the inner grid?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900