2017-10-05 1 views
0

J'essaye de créer un design sensible pour mon application de wpf mais ayant le problème. Parce que quand je le redimensionne it.it ne fonctionne pas. Ainsi n'importe qui peut m'aider dehors. En essayant d'ajuster l'écran en fonction de différentes tailles pour voir si des composants réagissent à cela. Malheureusement ils ne le font pas Je ne suis pas sûr de ce que je manqueIU réactive pour l'application WpF

<Window x:Class="LSLABAPP.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:LSLABAPP" 
      mc:Ignorable="d" 
      Title="MainWindow" Height="300" Width="525" MinHeight="300" MinWidth="525" ResizeMode="CanResizeWithGrip"> 
     <Grid> 
      <Grid.Background> 
       <ImageBrush/> 
      </Grid.Background> 
      <Grid.RowDefinitions> 
       <RowDefinition MinHeight="80" Height="50"></RowDefinition> 
       <RowDefinition MinHeight="40" Height="40"></RowDefinition> 
       <RowDefinition MinHeight="40" Height="40*"></RowDefinition> 
       <RowDefinition MinHeight="40" Height="40*"></RowDefinition> 
       <RowDefinition MinHeight="40" Height="40*"></RowDefinition> 
       <RowDefinition MinHeight="40" Height="40*"></RowDefinition> 
       <RowDefinition MinHeight="40" Height="40*"></RowDefinition> 


      </Grid.RowDefinitions> 

      <Grid.ColumnDefinitions> 

       <ColumnDefinition MinWidth="100" Width="100"></ColumnDefinition> 

       <ColumnDefinition Width="417"/> 
       <ColumnDefinition Width="0"/> 

      </Grid.ColumnDefinitions> 
      <TextBox x:Name="UserName" Grid.Column="1" HorizontalAlignment="Left" Height="25" Margin="30,10,0,0" Grid.Row="2" TextWrapping="Wrap" Text="UserName" VerticalAlignment="Top" Width="172"/> 
      <PasswordBox x:Name="Password" Grid.Column="1" HorizontalAlignment="Left" Margin="30,10,0,0" Grid.Row="3" VerticalAlignment="Top" Width="172" Height="25"/> 
      <Label x:Name="UsernameLable" Content="UserName" HorizontalAlignment="Left" Margin="10,10,0,0" Grid.Row="2" 
        Grid.Column="0" VerticalAlignment="Top" Width="81" Height="26"/> 
      <Label x:Name="PasswordLable" Content="Password" HorizontalAlignment="Left" Margin="10,10,0,0" Grid.Row="3" 
        Grid.Column="0" VerticalAlignment="Top" Width="81" RenderTransformOrigin="0.333,2.038" Height="26"/> 
      <Canvas Grid.Column="1" HorizontalAlignment="Left" Height="80" VerticalAlignment="Top" Width="417" Background="#FF4E79EE"> 
       <Label x:Name="label" Content="Testing" Canvas.Left="70" Canvas.Top="10" Width="260" Foreground="White" FontWeight="Bold"/> 
       <Label x:Name="label1" Content="DEV Environment" Canvas.Left="130" Canvas.Top="36" Foreground="red" FontWeight="Bold"/> 
      </Canvas> 
      <Canvas HorizontalAlignment="Left" Height="80" VerticalAlignment="Top" Width="100" Background="#FF4E79EE" /> 
      <Image Margin="0,0,414,0" Grid.ColumnSpan="2"> 
       <Image.Source> 
        <BitmapImage UriSource="Content/.ng" /> 
       </Image.Source> 
      </Image> 



     </Grid> 
    </Window> 
+0

vous devez éviter de coder en dur les valeurs de largeur et de hauteur dans WPF .. utiliser Max Hauteur, MaxWidth et dimensionnement proportionnelle. – Redouane

Répondre