2016-12-08 2 views
0

最初のC#アプリケーションを作成しようとしていて、問題が発生しました。あなたは高さと幅を見ることができるようにLogin.xamlコードC#Multi Page WPFアプリケーション、高さおよび幅が同じでないページ

<Page x:Class="WPF_Navigation.incl.pages.Login" 
    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:WPF_Navigation.incl.pages" 
    mc:Ignorable="d" 
    Height="350px" Width="525px" 
    Title="Login"> 

<Grid> 
    <Button x:Name="button" Content="Button" HorizontalAlignment="Left" Margin="440,320,0,0" VerticalAlignment="Top" Width="75"/> 
</Grid> 

以下

<NavigationWindow x:Class="WPF_Navigation.MainWindow" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:local="clr-namespace:WPF_Navigation" 
    mc:Ignorable="d" 
    Title="MainWindow" Height="350px" Width="525px" Source="incl/pages/Login.xaml"> 

以下

MainWindow.xamlコード両方で正確に同じで、ボタンは350px X 525pxウィンドウの右下隅にあります。それで、なぜ私はアプリを実行するとボタンが画面外に出るのですか?

MainWindow Image

+0

画像をもう一度見ると、MainWindowはウィンドウでログインはページなので、タイトルバーとナビゲーションバーが原因である可能性があります。 – Brabazoo

答えて

1

窓の高さは、そのUIのすべてを含んでいる(下の画像に見られるようにウィンドウのサイズを変更する必要がありました):あなたのページ+タイトル+ボーダー+ ???。この例

<Window 
    x:Name="TheWindow" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Height="200"> 
    <Grid x:Name="TheGrid"> 
    <TextBlock Text="{Binding Path=ActualHeight, ElementName=TheGrid}" /> 
    </Grid> 
</Window> 

を参照すると、この得られます

enter image description here

だから、ウィンドウのUIの39個のピクセルの差がある(お使いのOSによって異なります)。

希望します。

+0

ありがとう、それが問題になるかもしれないと思った。 – Brabazoo

関連する問題