Bonjour a tous,
Je realise une petite application en silverlight 2.0 avec du C#, et jai besoin sur un control de parfois modifier son tooltip.
En fait mon application est une sorte de gestion d'emploi du temps et mes control sont en fait dérivé de la classe bouton. Je voudrez pouvoir ajouter des tooltip permettant a l'utilisateur de rajouter des commentaires sur ses creneaux horaire.
mon control :
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 <UserControl.Resources> <Storyboard x:Name="Sb_Click"> <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="rectangle" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"> <SplineColorKeyFrame KeyTime="00:00:00.5000000" Value="#7A000000"/> </ColorAnimationUsingKeyFrames> </Storyboard> <Storyboard x:Name="Sb_Click_Copy1"> <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="rectangle" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"> <SplineColorKeyFrame KeyTime="00:00:00.5000000" Value="#00000000"/> </ColorAnimationUsingKeyFrames> </Storyboard> </UserControl.Resources> <ToolTipService.ToolTip> <TextBlock x:Name="myTip" Text="text"/> </ToolTipService.ToolTip> <Canvas x:Name="LayoutRoot" Width="134" Height="34"> <Canvas.Background> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="#FF000000"/> <GradientStop Color="#FFFFFFFF" Offset="1"/> </LinearGradientBrush> </Canvas.Background> <Button Height="34" Width="134" Content="" x:Name="Bt_Calendrier"/> <TextBlock Height="18" Width="134" Canvas.Top="8" Text="_ _ _ _ _" TextWrapping="Wrap" x:Name="Legende" FontSize="12" FontWeight="Bold" FontFamily="Portable User Interface" TextAlignment="Center"/> <Rectangle Height="34" Width="134" Fill="#00000000" Stroke="#FF000000" x:Name="rectangle"/> </Canvas> </UserControl>
et mon code C# pour modifier le tooltip :
Code : Sélectionner tout - Visualiser dans une fenêtre à part LeBouton.myTip.Text = "Mon commentaire";
Le code ne plante pas mais a chaque fois ma page se retrouve toute blanche, il n'y a plus aucun composants je ne comprend vraiment pas.
Merci d'avance, Cordialement Mozo
Partager