Bonjour à tous!

Je suis en train de créer un application de type Quiz et j'ai un problème au niveau du déclenchement d'évènement.

Ce que je voudrai faire:

- il y a 4 boutons radio pour 4 réponses aux différentes questions.
- quand le monsieur qui fait le quiz clique sur un bouton je voudrai qu'il y ait un élément qui apparaisse pour indiquer si la réponse est bonne ou mauvaise.

Ce que j'ai réussi à faire:

- les 4 boutons sont là
- la fenêtre dont j'ai besoin pour dire au monsieur si la réponse est bonne ou mauvaise apparait sur l'écran mais seulement je n'arrive pas à déclencher son affichage au moment du clic sur un des boutons radio.
en fait je ne sais pas quoi mettre au niveau du "RoutedEvent" pour le moment j'ai "Mouse.MouseEnter" pour tester l'affichage de la fenêtre, mais ça ne répond pas à mon problème en définitive.

En fait pour la fenêtre "réponse" j'ai créé un "canvas" contenant un rectangle et un label.

Je vous joins mon code ci-dessous en espérant que vous pourrez m'aider.

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
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<Window x:Class="WpfApplication1.Window1"
 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="460" Width="800" ResizeMode="NoResize" Loaded="Window_Loaded"
xmlns:c="clr-namespace:WpfApplication1">
 
    <Grid>
 
        <Label Height="25" Name="label_question" Background="Aqua" BorderThickness="0" Margin="152.5,128.75,152.5,0" VerticalAlignment="Top"  Content="{Binding Path=questi}" />
        <StackPanel Height="150" Margin="266,0,266,40" Orientation="Vertical" VerticalAlignment="Bottom" >
 
            <RadioButton Height="16" Name="radioRep1" Width="120" Margin="10" Content="{Binding Path=response1}" Checked="radioRep1_Checked" />
            <RadioButton Height="16" Name="radioRep2" Width="120" Margin="10" Content="{Binding Path=response2}" Checked="radioRep2_Checked" />
            <RadioButton Height="16" Name="radioRep3" Width="120" Margin="10" Content="{Binding Path=response3}" Checked="radioRep3_Checked" />
            <RadioButton Height="16" Name="radioRep4" Width="120" Margin="10" Content="{Binding Path=response4}" Checked="radioRep4_Checked" />
 
        </StackPanel>
        <Canvas Margin="0,0,0,0" Height="110" Width="778"  VerticalAlignment="Bottom">
            <Canvas.RenderTransform>
                <TranslateTransform x:Name="transform" Y="109"/>
            </Canvas.RenderTransform>
            <Canvas.Triggers>
                <EventTrigger RoutedEvent="Mouse.MouseEnter">
                    <EventTrigger.Actions>
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation Storyboard.TargetName="transform" Storyboard.TargetProperty="Y" To="0" Duration="0:0:2"/>
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger.Actions>
                </EventTrigger>
            </Canvas.Triggers>
        <Rectangle Canvas.Top="0"  Canvas.Left="0" Height="109" Width="778" Stroke="Black" VerticalAlignment="Bottom"  Fill="Aqua"  />
            <Label Canvas.Top="50" Canvas.Left="10" Content="blablabla"/>
 
        </Canvas>
 
    </Grid>     
</Window>
Merci beaucoup par avance!

Damien