Reputation: 1
<Page x:Class="ManufacturingWPF.ShowHardware"
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:ManufacturingWPF"
mc:Ignorable="d"
d:DesignHeight="350"
Title="ShowHardware" >
<Grid Background="AliceBlue" >
<!-- Making rows-->
<!--<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="30" />
</Grid.RowDefinitions> Just leaving it here for learning purposes-->
<!--Making Columns-->
<Grid.ColumnDefinitions>
<ColumnDefinition Width="400"/>
<ColumnDefinition Width="125"/>
</Grid.ColumnDefinitions>
<ListView Background="AliceBlue" x:Name="HardwareList" Grid.Column="0">
<!-- Like ListBox (i.e displaying a list of data) but with a different View setting-->
<ListView.View>
<GridView >
<!-- GridView comes with ListView and allows columns and data binding . SEE BELOW-->
<GridViewColumn DisplayMemberBinding="{Binding ID}" Header="ID"/>
<GridViewColumn DisplayMemberBinding="{Binding Date}" Header="Date"/>
<GridViewColumn DisplayMemberBinding="{Binding Nodes}" Header="Nodes"/>
<GridViewColumn DisplayMemberBinding="{Binding Repeaters}" Header="Repeaters"/>
<GridViewColumn DisplayMemberBinding="{Binding Hubs}" Header="Hubs"/>
</GridView>
</ListView.View>
</ListView>
<Button Content="Add Hardware" Grid.Column="1" HorizontalAlignment="Center" Width="115" Height="87" VerticalAlignment="Top" Margin="0,0,10,0"/>
<Button Content="Update Hardware" Margin="0,87,10,0" HorizontalAlignment="Center" Width="115" Height="87" VerticalAlignment="Top" Grid.Column="1"/>
<Button Content="Remove Hardware" HorizontalAlignment="Right" Margin="0,174,10,0" VerticalAlignment="Top" Width="115" Height="86" Grid.Column="1"/>
<Button Content="Stats" HorizontalAlignment="Right" Margin="0,260,10,0" Width="115" Height="80" VerticalAlignment="Top" Grid.Column="1"/>
</Grid>
How it looks in visual studio prior to compilation
There is an obvious discrepancy in the configuration of the app prior and during run time. I've tried adding width and height after the "Show Hardware" title without any luck. It seems that however I try to align something, it ends up as in picture two. Any advice / suggestions would be highly appreciated.
P.S.: by default the width and height of the window is 525 and 350 respectively which have not been altered.
Upvotes: 0
Views: 34
Reputation: 18201
The Height
and Width
of the window include the chrome, so they will have to be slightly larger than the window contents. If you want to do it the other way around and let the contents govern the window size, you could set SizeToContent="WidthAndHeight"
on your Window
.
Upvotes: 1