Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Form size at startup

Avatar of Labelsoft
LabelsoftFlag for Netherlands asked on
Microsoft Development
2 Comments1 Solution479 ViewsLast Modified:
Dear Experts,

I am new to WPF and I am trying to make my first application. I am experimenting with xaml right now and I have run into the following problem:

When I start up the form it is not the size I would expect, but when I click the form it pops to the size as I would expect it. I do not understand this behaviour. Does anyone know what is causing this?

I have included the xaml that I am using.
<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:AutoUpdateMonitorVML;assembly=AutoUpdateMonitorVML"
    Title="MainWindow" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:my="clr-namespace:AutoUpdateMonitorVML;assembly=AutoUpdateMonitorVML" WindowStartupLocation="CenterScreen" VerticalContentAlignment="Center" HorizontalContentAlignment="Stretch" d:DesignHeight="248" d:DesignWidth="525" SizeToContent="WidthAndHeight" Width="525" Height="248">
    <DockPanel Height="Auto" HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="DockPanel1" VerticalAlignment="Stretch" Width="Auto" ForceCursor="False" LastChildFill="True">
        <Menu Height="20" Name="MainMenu" DockPanel.Dock="Top" VerticalAlignment="Top">
            <MenuItem Name="FileMenuItem" Header="Bestand">
                <MenuItem Name="RefreshServerMenuItem" Header="Refresh server" Click="MenuItem_Click" />
                <MenuItem Name="RefreshAllMenuItem" Header="Refresh all" Click="MenuItem_Click" />
                <MenuItem Name="UpdateServerMenuItem" Header="Update server" Click="MenuItem_Click" />
                <MenuItem Name="UpdateAllMenuItem" Header="Update all" Click="MenuItem_Click" />
                <Separator />
                <MenuItem Name="CloseMenuItem" Header="Afsluiten" Click="MenuItem_Click" />
            </MenuItem>
            <MenuItem Name="ToolsMenuItem" Header="Tools">
                <MenuItem Name="ManageServersMenuItem" Header="Refresh server" Click="MenuItem_Click" />
                <MenuItem Name="ManageDirectoryTypesMenuItem" Header="Refresh all" Click="MenuItem_Click" />
                <MenuItem Name="ManageSourceMenuItem" Header="Update server" Click="MenuItem_Click" />
            </MenuItem>
        </Menu>
        <DockPanel LastChildFill="True">
            <ToolBarPanel DockPanel.Dock="Top">
                <ToolBar />
            </ToolBarPanel>
            <Grid >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Name="Left" Width="2*" > </ColumnDefinition>
                    <ColumnDefinition Name="Middle" Width="3*"> </ColumnDefinition>
                    <ColumnDefinition Name="Right" Width="1*"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <ListView Height="Auto" HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="ServerListView" VerticalAlignment="Stretch" Width="Auto" ItemsSource="{Binding Servers}" Grid.Column="0">
                <ListView.View>
                    <GridView>
                        <GridViewColumn Header="Icoontje" DisplayMemberBinding="{Binding ID}"/>
                        <GridViewColumn Header="Name" DisplayMemberBinding="{Binding Name}"/>
                        <GridViewColumn Header="Status" DisplayMemberBinding="{Binding Name}"/>
                    </GridView>
                </ListView.View>
                <!--<ListView.Resources>
                <DataTemplate DataType="{x:Type local:ServerVM}" >
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="icoontje" />
                        <TextBlock Text="{Binding Name}" />
                        <TextBlock Text="status" />
                    </StackPanel>
                </DataTemplate>
            </ListView.Resources>-->
            </ListView>
            <TreeView Grid.Column="1" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            </TreeView>
            <TreeView Grid.Column="2" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            </TreeView>
            <GridSplitter Grid.Column="1" Height="Auto" HorizontalAlignment="Left" Margin="0,0,0,0" Name="GridSplitter1" VerticalAlignment="Stretch" Width="1" />
            <GridSplitter Grid.Column="2" Height="Auto" HorizontalAlignment="Left" Margin="0,0,0,0" Name="GridSplitter2" VerticalAlignment="Stretch" Width="1" />
            </Grid>
        </DockPanel>
    </DockPanel>
</Window>
ASKER CERTIFIED SOLUTION
Avatar of saragani
saragani

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answers