Silverlight/XAML – Learning by Coding

[ sl2_button.xaml --> Grafik anzeigen ]

 1: <?xml version="1.0" encoding="UTF-8"?>
 2: <!-- coded by Thomas Meinike 08/08 -->
 3: <UserControl x:Class="sl2_button.Page"
 4:   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
 5:   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
 6:   Width="800" Height="600">
 7: 
 8:   <Canvas>
 9: 
10:     <Button x:Name="test" Canvas.Left="30" Canvas.Top="30" Width="150" Height="50"
11:       Background="Gray" Foreground="Blue" FontSize="14" Content="Text" Cursor="Hand"
12:       MouseEnter="Over" MouseLeave="Out"/>
13: 
14:   </Canvas>
15: 
16: 
17:   <!-- // zusätzlich verwendeter VB.NET-Code in Page.xaml.vb:
18: 
19:   Partial Public Class Page
20: 
21:     Inherits UserControl
22: 
23:     Public Sub New()
24:       InitializeComponent()
25:     End Sub
26: 
27:     Private Sub Over(ByVal sender As ObjectByVal e As System.Windows.Input.MouseEventArgsHandles Me.MouseEnter
28:       sender.Foreground = New SolidColorBrush(Colors.Red)
29:       sender.Background = New SolidColorBrush(Colors.Yellow)
30:     End Sub
31: 
32:     Private Sub Out(ByVal sender As ObjectByVal e As System.Windows.Input.MouseEventArgsHandles Me.MouseLeave
33:       sender.Foreground = New SolidColorBrush(Colors.Blue)
34:       sender.Background = New SolidColorBrush(Colors.Gray)
35:     End Sub
36: 
37:   End Class
38: 
39:   -->
40: 
41: </UserControl>

[zum Anfang]