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] Autosize à l’intérieur d'un bouton


Sujet :

VB.NET

  1. #1
    Membre averti Avatar de megamario
    Homme Profil pro
    VB6/VB.net/C/C++/C#
    Inscrit en
    Septembre 2008
    Messages
    929
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : France, Indre et Loire (Centre)

    Informations professionnelles :
    Activité : VB6/VB.net/C/C++/C#
    Secteur : Industrie

    Informations forums :
    Inscription : Septembre 2008
    Messages : 929
    Points : 312
    Points
    312
    Par défaut [WPF] Autosize à l’intérieur d'un bouton
    Bonjour,

    J'ai un petit souci surement tout bête.

    Dans des boutons j'ai plusieurs information sous forme de case dans un grid: voyant (coloration dégradé), mesure(textblox)...
    J'en est 120 exactement.
    Pourquoi j'ai choisi de mettre ces information dans un bouton ? Tout simplement pour que l'utilisateur puisse cliquer sur ces informations afin d’ouvrir une autre vue avec encore plus d'information.

    Tout fonctionne bien sauf que l'un de mes collaborateurs estime que l'écriture dans les Textblox est trop petite, mais certain de nos client on toujours des écrans de petite taille genre 800*600. Mes boutons se trouve dans des listbox, 4 exactement chacun formant 2 lignes de 15 boutons.

    J'ai réussi a ajuster le texte automatiquement lors d'un agrandissement grace a Viewbox et Stretch="Uniform"

    Voila l'un de mes élements:
    Code XAML : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    <Border BorderBrush="{Binding BORDER_General_BorderBrush, FallbackValue='Black'}"  
                            BorderThickness="{Binding BORDER_General_BorderThickness, FallbackValue='2'}" 
                            Background="{Binding BORDER_General_Background,FallbackValue='Gray'}" 
                            CornerRadius="1"
                            Grid.Row="6" 
                            Height="Auto" Width="Auto">
                    <Viewbox Stretch="Uniform">
                        <TextBlock Background="Transparent" Height="Auto" Width="Auto"
                                       Foreground= "{Binding TXT_Current_Foreground,FallbackValue='Yellow'}"
                                       FontSize="{Binding TXT_Current_Fontsize,FallbackValue='Auto'}"
                                       TextAlignment="{Binding TXT_General_Alignement, FallbackValue='Center'}"   VerticalAlignment ="Center"
                                       Text="{Binding Current, FallbackValue='30,20'}"/>
                    </Viewbox>
                </Border>

    Ce code fonctionne bien lorsque je suis juste dans un Grid sur ma vue, mais lorsque je pose ce Grid à l’intérieur du bouton il est centré et n'utilise pas automatiquement tout l'espace disponible.

    L'indication de l'alignement n'est pas pris en compte non plus tout comme la marge du coup.

    Il y a peut être un paramètre tout simple, mais je ne l'ai ps encore trouvé. A moins d'utiliser un autre Object que le bouton, mais j'ai besoin de la Command, et utilisable en MVVM.

    A l'origine je suis avec un StackPanel pour placer mes éléments dans le bouton, mais l'Object <Viewbox Stretch="Uniform"> ne réagi pas correctement agrandissant beaucoup plus les zones de texte, alors que dans le Grid mes 10 éléments dans le bouton garde les mêmes proportion.


    Voici un exemple:
    Code XAML : 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
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    <Window x:Class="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:Test_Auto_size_text"
            mc:Ignorable="d"
            Title="MainWindow" Height="218.959" Width="48.001">
        <Grid Margin="2">
            <Grid Margin="5"   >
                <Grid.RowDefinitions>
                    <RowDefinition Height="1*" />
                    <RowDefinition Height="1*" />
                    <RowDefinition Height="1*" />
                    <RowDefinition Height="1*" />
                    <RowDefinition Height="1*" />
                    <RowDefinition Height="1*" />
                    <RowDefinition Height="1*" />
                    <RowDefinition Height="1*" />
                    <RowDefinition Height="1*" />
                    <RowDefinition Height="1*" />
                </Grid.RowDefinitions>
                <Border BorderBrush="{Binding BORDER_General_BorderBrush, FallbackValue='Black'}"  
                            BorderThickness="{Binding BORDER_General_BorderThickness, FallbackValue='2'}" 
                            CornerRadius="1" Height="Auto" Width="Auto" 
                            Grid.Row="0"   >
                    <Border.Background>
                        <RadialGradientBrush>
                            <GradientStop Color="{Binding Installed_Color1}" Offset="0.358"/>
                            <GradientStop Color="{Binding Installed_Color2}" Offset="1"/>
                        </RadialGradientBrush>
                    </Border.Background>
                    <TextBlock Background="Transparent" 
                                       Foreground= "{Binding TXT_Title_Foreground,FallbackValue='Black'}"
                                       FontSize="{Binding TXT_Title_Fontsize,FallbackValue='9'}"
                                       Margin="0,1,0,1" TextAlignment="Right" VerticalAlignment ="Center"
                                       Text="{Binding Installed_Text, FallbackValue=''}"/>
                </Border>
                <Border BorderBrush="{Binding BORDER_General_BorderBrush, FallbackValue='Black'}"  
                            BorderThickness="{Binding BORDER_General_BorderThickness, FallbackValue='2'}" 
                            CornerRadius="1" 
                            Grid.Row="1"   >
                    <Border.Background>
                        <RadialGradientBrush>
                            <GradientStop Color="{Binding Logged_Color1}" Offset="0.358"/>
                            <GradientStop Color="{Binding Logged_Color2}" Offset="1"/>
                        </RadialGradientBrush>
                    </Border.Background>
                    <TextBlock Background="Transparent" 
                                       Foreground= "{Binding TXT_Title_Foreground,FallbackValue='Black'}"
                                       FontSize="{Binding TXT_Title_Fontsize,FallbackValue='9'}"
                                       Margin="0,1,0,1" TextAlignment="Right" VerticalAlignment ="Center"
                                       Text="{Binding Logged_Text, FallbackValue=''}"/>
                </Border>
                <Border BorderBrush="{Binding BORDER_General_BorderBrush, FallbackValue='Black'}"  
                            BorderThickness="{Binding BORDER_General_BorderThickness, FallbackValue='2'}" 
                            CornerRadius="1" 
                            Grid.Row="2">
                    <Border.Background>
                        <RadialGradientBrush>
                            <GradientStop Color="{Binding Idle_Color1}" Offset="0.358"/>
                            <GradientStop Color="{Binding Idle_Color2}" Offset="1"/>
                        </RadialGradientBrush>
                    </Border.Background>
                    <TextBlock Background="Transparent" 
                                       Foreground= "{Binding TXT_Title_Foreground,FallbackValue='Black'}"
                                       FontSize="{Binding TXT_Title_Fontsize,FallbackValue='9'}"
                                       Margin="0,1,0,1" TextAlignment="Right" VerticalAlignment ="Center"
                                       Text="{Binding Idle_Text, FallbackValue=''}"/>
                </Border>
                <Border BorderBrush="{Binding BORDER_General_BorderBrush, FallbackValue='Black'}"  
                            BorderThickness="{Binding BORDER_General_BorderThickness, FallbackValue='2'}" 
                            CornerRadius="1" 
                            Grid.Row="3"   >
                    <Border.Background>
                        <RadialGradientBrush>
                            <GradientStop Color="{Binding NotDetected_Color1}" Offset="0.358"/>
                            <GradientStop Color="{Binding NotDetected_Color2}" Offset="1"/>
                        </RadialGradientBrush>
                    </Border.Background>
                    <TextBlock Background="Transparent" 
                                       Foreground= "{Binding TXT_Title_Foreground,FallbackValue='Black'}"
                                       FontSize="{Binding TXT_Title_Fontsize,FallbackValue='9'}"
                                       Margin="0,1,0,1" TextAlignment="Right"  VerticalAlignment ="Center"
                                       Text="{Binding NotDetected_Text, FallbackValue=''}"/>
                </Border>
                <Border BorderBrush="{Binding BORDER_General_BorderBrush, FallbackValue='Black'}"  
                            BorderThickness="{Binding BORDER_General_BorderThickness, FallbackValue='2'}" 
                            CornerRadius="1" 
                            Grid.Row="4"   >
                    <Border.Background>
                        <RadialGradientBrush>
                            <GradientStop Color="{Binding MajorAlarm_Color1}" Offset="0.358"/>
                            <GradientStop Color="{Binding MajorAlarm_Color2}" Offset="1"/>
                        </RadialGradientBrush>
                    </Border.Background>
                    <TextBlock Background="Transparent" 
                                       Foreground= "{Binding TXT_Title_Foreground,FallbackValue='Black'}"
                                       FontSize="{Binding TXT_Title_Fontsize,FallbackValue='9'}"
                                       Margin="0,1,0,1" TextAlignment="Right" VerticalAlignment ="Center"
                                       Text="{Binding MajorAlarm_Text, FallbackValue=''}"/>
                </Border>
                <Border BorderBrush="{Binding BORDER_General_BorderBrush, FallbackValue='Black'}"  
                            BorderThickness="{Binding BORDER_General_BorderThickness, FallbackValue='2'}" 
                            CornerRadius="1" 
                            Grid.Row="5">
                    <Border.Background>
                        <RadialGradientBrush>
                            <GradientStop Color="{Binding MinorAlarm_Color1}" Offset="0.358"/>
                            <GradientStop Color="{Binding MinorAlarm_Color2}" Offset="1"/>
                        </RadialGradientBrush>
                    </Border.Background>
                    <TextBlock Background="Transparent" 
                                       Foreground= "{Binding TXT_Title_Foreground,FallbackValue='Black'}"
                                       FontSize="{Binding TXT_Title_Fontsize,FallbackValue='9'}"
                                       Margin="0,1,0,1" TextAlignment="Right" VerticalAlignment ="Center"
                                       Text="{Binding MinorAlarm_Text, FallbackValue=''}"/>
                </Border>
                <Border BorderBrush="{Binding BORDER_General_BorderBrush, FallbackValue='Black'}"  
                            BorderThickness="{Binding BORDER_General_BorderThickness, FallbackValue='2'}" 
                            Background="{Binding BORDER_General_Background,FallbackValue='Gray'}" 
                            CornerRadius="1"
                            Grid.Row="6" 
                            Height="Auto" Width="Auto">
                    <Viewbox Stretch="Uniform">
                        <TextBlock Background="Transparent" Height="Auto" Width="Auto"
                                       Foreground= "{Binding TXT_Current_Foreground,FallbackValue='Yellow'}"
                                       FontSize="{Binding TXT_Current_Fontsize,FallbackValue='Auto'}"
                                       TextAlignment="{Binding TXT_General_Alignement, FallbackValue='Center'}"   VerticalAlignment ="Center"
                                       Text="{Binding Current, FallbackValue='30,20'}"/>
                    </Viewbox>
                </Border>
                <Border BorderBrush="{Binding BORDER_General_BorderBrush, FallbackValue='Black'}"  
                            BorderThickness="{Binding BORDER_General_BorderThickness, FallbackValue='2'}" 
                            Background="{Binding BORDER_General_Background,FallbackValue='Gray'}" 
                            CornerRadius="1"
                            Grid.Row="7">
                    <TextBlock Background="Transparent" 
                                       Foreground= "{Binding TXT_Temperature_Foreground,FallbackValue='Yellow'}"
                                       FontSize="{Binding TXT_Temperature_Fontsize,FallbackValue='9'}"
                                       Margin="0,1,0,1" TextAlignment="{Binding TXT_General_Alignement, FallbackValue='Center'}"  VerticalAlignment ="Center"
                                       Text="{Binding Temperature, FallbackValue='- - -'}"/>
                </Border>
                <Border BorderBrush="{Binding BORDER_General_BorderBrush, FallbackValue='Black'}"  
                            BorderThickness="{Binding BORDER_General_BorderThickness, FallbackValue='2'}" 
                            Background="{Binding BORDER_General_Background,FallbackValue='Gray'}" 
                            CornerRadius="1"
                            Grid.Row="8"   >
                    <TextBlock Background="Transparent" 
                                       Foreground= "{Binding TXT_Tension_Foreground,FallbackValue='Yellow'}"
                                       FontSize="{Binding TXT_Tension_Fontsize,FallbackValue='9'}"
                                       Margin="0,1,0,1" TextAlignment="{Binding TXT_General_Alignement, FallbackValue='Center'}"  VerticalAlignment ="Center"
                                       Text="{Binding Tension, FallbackValue='- - -'}"/>
                </Border>
                <Border BorderBrush="{Binding BORDER_General_BorderBrush, FallbackValue='Black'}"  
                            BorderThickness="{Binding BORDER_General_BorderThickness, FallbackValue='2'}" 
                            Background="{Binding BORDER_General_Background,FallbackValue='Gray'}" 
                            CornerRadius="1"
                            Grid.Row="9" >
                    <TextBlock Background="Transparent" 
                                       Foreground= "{Binding TXT_Tension_Foreground,FallbackValue='Yellow'}"
                                       FontSize="{Binding TXT_Id_Fontsize,FallbackValue='10'}"
                                       Margin="0,1,0,1" TextAlignment="Center" VerticalAlignment ="Center"
                                       Text="{Binding Idx, FallbackValue='- - -'}"/>
                </Border>
            </Grid>
        </Grid>
     
    </Window>

    Ils ont tous des zones de texte, car ma 1ere colonne (de ma listbox) se compose que de texte afin d'indiquer la signification des voyants et mesures.

    Le but final dans tout cela, c'est donc d'avoir donc un bouton (ou autre) avec des zones à l’intérieur (10 zones) qui s'agrandiront de façon proportionnel (Text compris), lors de l'agrandissement de la vue.

    Nom : Rectifier1.png
Affichages : 217
Taille : 1,4 Ko

    Nom : RectifierPlant3.png
Affichages : 253
Taille : 50,3 Ko

  2. #2
    Modérateur
    Avatar de Sankasssss
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Novembre 2006
    Messages
    1 842
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : Belgique

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Novembre 2006
    Messages : 1 842
    Points : 4 232
    Points
    4 232
    Par défaut
    Bonjour,

    Avec un mix de cette solution : https://stackoverflow.com/questions/...l-width-in-wpf
    ça à l'air de fonctionner :
    Code xaml : 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
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    <Window x:Class="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:Test_Auto_size_text"
            mc:Ignorable="d"
            Title="MainWindow" Height="690.434" Width="545.832">
        <Grid Margin="2">
            <Grid Margin="5"   >
                <Grid.RowDefinitions>
                    <RowDefinition Height="1*" />
                    <RowDefinition Height="1*" />
                    <RowDefinition Height="1*" />
                    <RowDefinition Height="1*" />
                    <RowDefinition Height="1*" />
                    <RowDefinition Height="1*" />
                    <RowDefinition Height="1*" />
                    <RowDefinition Height="1*" />
                    <RowDefinition Height="1*" />
                    <RowDefinition Height="1*" />
                </Grid.RowDefinitions>
                <Border BorderBrush="{Binding BORDER_General_BorderBrush, FallbackValue='Black'}"  
                            BorderThickness="{Binding BORDER_General_BorderThickness, FallbackValue='2'}" 
                            CornerRadius="1" Height="Auto" Width="Auto" 
                            Grid.Row="0"   >
                    <Border.Background>
                        <RadialGradientBrush>
                            <GradientStop Color="{Binding Installed_Color1}" Offset="0.358"/>
                            <GradientStop Color="{Binding Installed_Color2}" Offset="1"/>
                        </RadialGradientBrush>
                    </Border.Background>
                    <TextBlock Background="Transparent" 
                                       Foreground= "{Binding TXT_Title_Foreground,FallbackValue='Black'}"
                                       FontSize="{Binding TXT_Title_Fontsize,FallbackValue='9'}"
                                       Margin="0,1,0,1" TextAlignment="Right" VerticalAlignment ="Center"
                                       Text="{Binding Installed_Text, FallbackValue=''}"/>
                </Border>
                <Border BorderBrush="{Binding BORDER_General_BorderBrush, FallbackValue='Black'}"  
                            BorderThickness="{Binding BORDER_General_BorderThickness, FallbackValue='2'}" 
                            CornerRadius="1" 
                            Grid.Row="1"   >
                    <Border.Background>
                        <RadialGradientBrush>
                            <GradientStop Color="{Binding Logged_Color1}" Offset="0.358"/>
                            <GradientStop Color="{Binding Logged_Color2}" Offset="1"/>
                        </RadialGradientBrush>
                    </Border.Background>
                    <TextBlock Background="Transparent" 
                                       Foreground= "{Binding TXT_Title_Foreground,FallbackValue='Black'}"
                                       FontSize="{Binding TXT_Title_Fontsize,FallbackValue='9'}"
                                       Margin="0,1,0,1" TextAlignment="Right" VerticalAlignment ="Center"
                                       Text="{Binding Logged_Text, FallbackValue=''}"/>
                </Border>
                <Border BorderBrush="{Binding BORDER_General_BorderBrush, FallbackValue='Black'}"  
                            BorderThickness="{Binding BORDER_General_BorderThickness, FallbackValue='2'}" 
                            CornerRadius="1" 
                            Grid.Row="2">
                    <Border.Background>
                        <RadialGradientBrush>
                            <GradientStop Color="{Binding Idle_Color1}" Offset="0.358"/>
                            <GradientStop Color="{Binding Idle_Color2}" Offset="1"/>
                        </RadialGradientBrush>
                    </Border.Background>
                    <TextBlock Background="Transparent" 
                                       Foreground= "{Binding TXT_Title_Foreground,FallbackValue='Black'}"
                                       FontSize="{Binding TXT_Title_Fontsize,FallbackValue='9'}"
                                       Margin="0,1,0,1" TextAlignment="Right" VerticalAlignment ="Center"
                                       Text="{Binding Idle_Text, FallbackValue=''}"/>
                </Border>
                <Border BorderBrush="{Binding BORDER_General_BorderBrush, FallbackValue='Black'}"  
                            BorderThickness="{Binding BORDER_General_BorderThickness, FallbackValue='2'}" 
                            CornerRadius="1" 
                            Grid.Row="3"   >
                    <Border.Background>
                        <RadialGradientBrush>
                            <GradientStop Color="{Binding NotDetected_Color1}" Offset="0.358"/>
                            <GradientStop Color="{Binding NotDetected_Color2}" Offset="1"/>
                        </RadialGradientBrush>
                    </Border.Background>
                    <TextBlock Background="Transparent" 
                                       Foreground= "{Binding TXT_Title_Foreground,FallbackValue='Black'}"
                                       FontSize="{Binding TXT_Title_Fontsize,FallbackValue='9'}"
                                       Margin="0,1,0,1" TextAlignment="Right"  VerticalAlignment ="Center"
                                       Text="{Binding NotDetected_Text, FallbackValue=''}"/>
                </Border>
                <Border BorderBrush="{Binding BORDER_General_BorderBrush, FallbackValue='Black'}"  
                            BorderThickness="{Binding BORDER_General_BorderThickness, FallbackValue='2'}" 
                            CornerRadius="1" 
                            Grid.Row="4"   >
                    <Border.Background>
                        <RadialGradientBrush>
                            <GradientStop Color="{Binding MajorAlarm_Color1}" Offset="0.358"/>
                            <GradientStop Color="{Binding MajorAlarm_Color2}" Offset="1"/>
                        </RadialGradientBrush>
                    </Border.Background>
                    <TextBlock Background="Transparent" 
                                       Foreground= "{Binding TXT_Title_Foreground,FallbackValue='Black'}"
                                       FontSize="{Binding TXT_Title_Fontsize,FallbackValue='9'}"
                                       Margin="0,1,0,1" TextAlignment="Right" VerticalAlignment ="Center"
                                       Text="{Binding MajorAlarm_Text, FallbackValue=''}"/>
                </Border>
                <Button Grid.Row="5">
                    <TextBox></TextBox>
                </Button>
                <Button Grid.Row="6" Height="Auto" Width="Auto" >
                    <Button.Template>
                        <ControlTemplate TargetType="{x:Type Button}">
                            <Grid>
                                <Border Background="{TemplateBinding Background}"
                             BorderBrush="{TemplateBinding BorderBrush}"
                             BorderThickness="{TemplateBinding BorderThickness}">
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="Auto"/>
                                        </Grid.ColumnDefinitions>
                                        <ContentPresenter HorizontalAlignment="Stretch"  Grid.Column="0" VerticalAlignment="Center"/>
                                        <Canvas Background="AliceBlue" Grid.Column="1" />
                                    </Grid>
                                </Border>
                            </Grid>
                        </ControlTemplate>
                    </Button.Template>
     
                    <Border BorderBrush="{Binding BORDER_General_BorderBrush, FallbackValue='Black'}"  
                            BorderThickness="{Binding BORDER_General_BorderThickness, FallbackValue='2'}" 
                            Background="{Binding BORDER_General_Background,FallbackValue='Gray'}" 
                            CornerRadius="1">
                        <Viewbox Stretch="Uniform">
                            <TextBlock Background="Transparent" Height="Auto" Width="Auto"
                                       Foreground= "{Binding TXT_Current_Foreground,FallbackValue='Yellow'}"
                                       FontSize="{Binding TXT_Current_Fontsize,FallbackValue='Auto'}"
                                       TextAlignment="{Binding TXT_General_Alignement, FallbackValue='Center'}"   VerticalAlignment ="Center"
                                       Text="{Binding Current, FallbackValue='30,20'}"/>
                        </Viewbox>
                    </Border>
                </Button>
                <Border BorderBrush="{Binding BORDER_General_BorderBrush, FallbackValue='Black'}"  
                            BorderThickness="{Binding BORDER_General_BorderThickness, FallbackValue='2'}" 
                            Background="{Binding BORDER_General_Background,FallbackValue='Gray'}" 
                            CornerRadius="1"
                            Grid.Row="7">
                    <TextBlock Background="Transparent" 
                                       Foreground= "{Binding TXT_Temperature_Foreground,FallbackValue='Yellow'}"
                                       FontSize="{Binding TXT_Temperature_Fontsize,FallbackValue='9'}"
                                       Margin="0,1,0,1" TextAlignment="{Binding TXT_General_Alignement, FallbackValue='Center'}"  VerticalAlignment ="Center"
                                       Text="{Binding Temperature, FallbackValue='- - -'}"/>
                </Border>
                <Border BorderBrush="{Binding BORDER_General_BorderBrush, FallbackValue='Black'}"  
                            BorderThickness="{Binding BORDER_General_BorderThickness, FallbackValue='2'}" 
                            Background="{Binding BORDER_General_Background,FallbackValue='Gray'}" 
                            CornerRadius="1"
                            Grid.Row="8"   >
                    <TextBlock Background="Transparent" 
                                       Foreground= "{Binding TXT_Tension_Foreground,FallbackValue='Yellow'}"
                                       FontSize="{Binding TXT_Tension_Fontsize,FallbackValue='9'}"
                                       Margin="0,1,0,1" TextAlignment="{Binding TXT_General_Alignement, FallbackValue='Center'}"  VerticalAlignment ="Center"
                                       Text="{Binding Tension, FallbackValue='- - -'}"/>
                </Border>
                <Border BorderBrush="{Binding BORDER_General_BorderBrush, FallbackValue='Black'}"  
                            BorderThickness="{Binding BORDER_General_BorderThickness, FallbackValue='2'}" 
                            Background="{Binding BORDER_General_Background,FallbackValue='Gray'}" 
                            CornerRadius="1"
                            Grid.Row="9" >
                    <TextBlock Background="Transparent" 
                                       Foreground= "{Binding TXT_Tension_Foreground,FallbackValue='Yellow'}"
                                       FontSize="{Binding TXT_Id_Fontsize,FallbackValue='10'}"
                                       Margin="0,1,0,1" TextAlignment="Center" VerticalAlignment ="Center"
                                       Text="{Binding Idx, FallbackValue='- - -'}"/>
                </Border>
            </Grid>
        </Grid>
     
    </Window>

Discussions similaires

  1. Wpf validation de data via bouton
    Par Lionhart dans le forum C#
    Réponses: 1
    Dernier message: 17/02/2015, 16h07
  2. [Débutant] WPF window form avec des boutons de réduire et fermeture
    Par midou256 dans le forum C#
    Réponses: 2
    Dernier message: 29/04/2013, 20h20
  3. WPF window form avec des boutons de réduire et fermeture
    Par midou256 dans le forum Windows Presentation Foundation
    Réponses: 3
    Dernier message: 18/04/2013, 21h12
  4. WPF Donner les valeurs aux Boutons
    Par Im.Cresus dans le forum Windows Presentation Foundation
    Réponses: 4
    Dernier message: 26/06/2009, 13h54
  5. [WPF] ListView avec colonnes et boutons
    Par Chris_LaFouine dans le forum Windows Presentation Foundation
    Réponses: 1
    Dernier message: 30/05/2008, 16h16

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