IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VB.NET Discussion :

WPF grid à margin 0


Sujet :

VB.NET

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Homme Profil pro
    Inscrit en
    Novembre 2011
    Messages
    117
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Novembre 2011
    Messages : 117
    Par défaut WPF grid à margin 0
    Bonjour, sur mon application WPF je souhaite que ma grid soit au bord de ma fenêtre.

    Malgré un Margin="0,0,0,0" la grid se trouve avec une bordure par rapport à la fenêtre comme montré sur l'image joint.

    Pourquoi ?

    Merci d'avance.
    Images attachées Images attachées  

  2. #2
    Membre Expert Avatar de meziantou
    Homme Profil pro
    autre
    Inscrit en
    Avril 2010
    Messages
    1 223
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Autre

    Informations professionnelles :
    Activité : autre
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2010
    Messages : 1 223
    Par défaut
    Tu as peut être défini un padding au niveau de la fenêtre.

  3. #3
    Membre confirmé
    Homme Profil pro
    Inscrit en
    Novembre 2011
    Messages
    117
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Novembre 2011
    Messages : 117
    Par défaut
    Non, le padding, margin de la fenêtre est à 0.

  4. #4
    Membre Expert Avatar de meziantou
    Homme Profil pro
    autre
    Inscrit en
    Avril 2010
    Messages
    1 223
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Autre

    Informations professionnelles :
    Activité : autre
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2010
    Messages : 1 223
    Par défaut
    Tu as peut-être défini un style qui s'applique à la fenêtre ou à la grille.

    Tu peux poster un peu de code, ca aidera peut-être à identifier la source du problème.

  5. #5
    Membre confirmé
    Homme Profil pro
    Inscrit en
    Novembre 2011
    Messages
    117
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Novembre 2011
    Messages : 117
    Par défaut
    Voici le code XAML :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    <Window x:Class="MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="501" Width="633" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" Background="#ffffffff">
        <Grid Height="450" Width="600" Background="#FF313131" Margin="0,0,0,0" DataContext="{Binding}">
            <Image Height="22" HorizontalAlignment="Left" Margin="0,120,0,0" Name="Image1" Stretch="Fill" VerticalAlignment="Top" Width="600" Source="/WpfApplication1;component/Images/barre1.png" />
            <Image Height="22" HorizontalAlignment="Left" Margin="0,172,0,0" Name="Image2" Source="/WpfApplication1;component/Images/barre1.png" Stretch="Fill" VerticalAlignment="Top" Width="600" />
            <Image Height="22" HorizontalAlignment="Left" Margin="0,224,0,0" Name="Image3" Source="/WpfApplication1;component/Images/barre1.png" Stretch="Fill" VerticalAlignment="Top" Width="600" />
            <Image Height="27" HorizontalAlignment="Left" Margin="518,384,0,0" Name="Bouton1" Stretch="Fill" VerticalAlignment="Top" Width="63" Source="/WpfApplication1;component/Images/bouton1.png" Cursor="Hand" />
            <TextBox Height="15"  HorizontalAlignment="Left" Margin="252,176,0,0" Name="TextBox1" Text="connect" VerticalAlignment="Top" FontFamily="Terminal" FontSize="10" Width="97" TextAlignment="Center" Foreground="White" Background="#00000000" BorderThickness="0" />
            <TextBox FontFamily="Terminal"  FontSize="10" Foreground="White" Height="15" HorizontalAlignment="Left" Margin="252,229,0,0" Name="Textbox2" Text="nickname" TextAlignment="Center" VerticalAlignment="Top" Width="97" Background="#00000000" BorderThickness="0" />
            <Label Content="server" Height="20" HorizontalAlignment="Left" Margin="252,120,0,0" Name="Label1" VerticalAlignment="Top" FontFamily="Consolas" FontSize="10"  Foreground="White" Width="97" HorizontalContentAlignment="Center" Cursor="Hand" />
            <Image Height="22" HorizontalAlignment="Left" Margin="16,301,0,0" Name="Image5" Source="/WpfApplication1;component/Images/colBleu.png" Stretch="Fill" VerticalAlignment="Top" Width="82" Cursor="Hand" />
            <Image Height="22" HorizontalAlignment="Left" Margin="113,301,0,0" Name="Image6" Source="/WpfApplication1;component/Images/colJaune.png" Stretch="Fill" VerticalAlignment="Top" Width="82" Cursor="Hand" />
            <Image Height="22" HorizontalAlignment="Left" Margin="210,301,0,0" Name="Image7" Source="/WpfApplication1;component/Images/colMarron.png" Stretch="Fill" VerticalAlignment="Top" Width="82" Cursor="Hand" />
            <Image Height="22" HorizontalAlignment="Left" Margin="307,301,0,0" Name="Image8" Source="/WpfApplication1;component/Images/colRouge.png" Stretch="Fill" VerticalAlignment="Top" Width="82" Cursor="Hand" />
            <Image Height="22" HorizontalAlignment="Left" Margin="404,301,0,0" Name="Image9" Source="/WpfApplication1;component/Images/colVert.png" Stretch="Fill" VerticalAlignment="Top" Width="82" Cursor="Hand" />
            <Image Height="22" HorizontalAlignment="Left" Margin="500,301,0,0" Name="Image10" Source="/WpfApplication1;component/Images/colViolet.png" Stretch="Fill" VerticalAlignment="Top" Width="82" Cursor="Hand" />
            <Image Height="23" HorizontalAlignment="Left" Margin="0,427,0,0" Name="Image11" Source="/WpfApplication1;component/Images/statutbarre.png" Stretch="Fill" VerticalAlignment="Top" Width="600" />
        </Grid>
     
    </Window>

  6. #6
    Membre Expert Avatar de meziantou
    Homme Profil pro
    autre
    Inscrit en
    Avril 2010
    Messages
    1 223
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Autre

    Informations professionnelles :
    Activité : autre
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2010
    Messages : 1 223
    Par défaut
    Taille de la fenêtre : Height="501" Width="633"
    Taille de la grille : Height="450" Width="600"

    La grille est plus petite que la fenêtre, il y a donc forcément un blanc. Tu peux enlever la taille de la grille comme ca elle prendra toute la place disponible

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <Grid Background="#FF313131" DataContext="{Binding}">
    Au passage je pense que tu devrais changer la grille en Canvas vu ce que tu en fait

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. WPF Grid et Binding
    Par Lionhart dans le forum C#
    Réponses: 2
    Dernier message: 26/06/2014, 11h36
  2. WPF grid fusionné
    Par lolaalol dans le forum C#
    Réponses: 1
    Dernier message: 14/05/2013, 10h25
  3. wpf grid avec possibilité de multisélection
    Par yassine.s dans le forum Windows Presentation Foundation
    Réponses: 12
    Dernier message: 27/05/2011, 16h55
  4. [C# WPF] ajout dynamique <TextBlock> dans <Grid>
    Par luc648 dans le forum Windows Presentation Foundation
    Réponses: 2
    Dernier message: 06/06/2010, 21h39
  5. grid dans wpf
    Par asprog dans le forum VB.NET
    Réponses: 0
    Dernier message: 05/12/2008, 12h39

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo