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
| <Window
x:Class="MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:my="clr-namespace:test_buttons"
Title="test_buttons"
Height="320"
Width="380">
<Window.CommandBindings>
<CommandBinding Command="{x:Static my:MainWindow.Button1Command}" Executed ="CommandBinding_Button1" />
<CommandBinding Command="{x:Static my:MainWindow.Button2Command}" Executed ="CommandBinding_Button2" />
</Window.CommandBindings>
<Grid>
<Button
x:Name="Button1"
Content="Bouton Bleu"
Grid.Column="0"
Grid.Row="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
Margin="35,69,34,0"
Width="221"
Height="112"
Background="Blue"
Command="{x:Static my:MainWindow.Button1Command}" />
<Button
x:Name="Button2"
Content="Bouton Rouge"
Grid.Column="0"
Grid.Row="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
Margin="35,69,34,0"
Width="221"
Height="112"
Background="Red"
Command="{x:Static my:MainWindow.Button2Command}" />
</Grid>
</Window> |
Partager