<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
在运行时之前和运行时,应用程序的配置存在明显差异。我已经尝试在&#34; Show Hardware&#34;之后添加宽度和高度。标题没有任何运气。似乎无论如何我尝试对齐某些东西,它最终会如图2所示。任何意见/建议都将受到高度赞赏。
P.S。:默认情况下,窗口的宽度和高度分别为525和350,没有改变。