Silverlight/XAML – Learning by Coding

[ sl2_progressbar.xaml --> Grafik anzeigen ]

 1: <?xml version="1.0" encoding="UTF-8"?>
 2: <!-- coded by Thomas Meinike 10/08 -->
 3: <UserControl x:Class="sl2_progressbar.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:     <ProgressBar x:Name="prbar" Foreground="#F00" Background="#FFF"
11:       Value="0" Maximum="300" Width="500" Height="25" Margin="30"/>
12: 
13:     <TextBlock x:Name="prozent" Canvas.Left="270" Canvas.Top="35" Text="0%"/>
14: 
15:   </Canvas>
16: 
17: 
18:   <!-- // zusätzlich verwendeter VB.NET-Code in Page.xaml.vb:
19: 
20:   Partial Public Class Page
21:     Inherits UserControl
22:     Dim timer As Storyboard = New Storyboard
23: 
24:     Public Sub New()
25:       InitializeComponent()
26: 
27:       timer.Duration TimeSpan.FromMilliseconds(200)
28:       timer.Begin()
29:       AddHandler timer.CompletedAddressOf Setze_PRBar
30:     End Sub
31: 
32:     Sub Setze_PRBar()
33:       prbar.Value prbar.Value 5
34:       prozent.Text Int(prbar.Value prbar.Maximum 100).ToString "%"
35: 
36:       If prbar.Value prbar.Maximum Then
37:         timer.Begin()
38:       End If
39:     End Sub
40: 
41:   End Class
42: 
43:   -->
44: 
45: </UserControl>

[zum Anfang]