WPFは

2017-11-25 7 views
0
<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> 

WPFは

How it looks in visual studio prior to compilation前と実行時にアプリの設定で明らかに矛盾がある

How it looks during run time

実行時に異なるウィンドウ構成を有しています。私は幸運なしに "ハードウェアの表示"タイトルの後に幅と高さを追加しようとしました。しかし、私は何かを整列しようとすると、それは写真2のように終わります。どんなアドバイス/提案も高く評価されます。

P .:デフォルトでは、ウィンドウの幅と高さはそれぞれ変更されていない525と350です。

答えて

1

ウィンドウのとWidthにはクロムが含まれているため、ウィンドウの内容よりわずかに大きくなければなりません。逆のやり方でコンテンツのウィンドウサイズを管理する場合は、WindowSizeToContent="WidthAndHeight"を設定します。

+0

多くのありがとうございます。それはトリックを行うようだ! – Goku1989

+1

あなたは大歓迎です。その答えが役に立つと分かったら、あなたはそれを受け入れることができます(https://stackoverflow.com/help/someone-answers)。 – fuglede