4、PasswordBox.xaml
<UserControl x:Class="Silverlight20.Control.PasswordBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel HorizontalAlignment="Left">
<!--
Password - PasswordBox控件的密碼值
PasswordChar - PasswordBox控件所顯示的密碼替代字元。預設值為“●”
-->
<PasswordBox Width="200" PasswordChar="*"></PasswordBox>
</StackPanel>
</UserControl>
5、ProgressBar.xaml
<UserControl x:Class="Silverlight20.Control.ProgressBar"
<TextBlock x:Name="lblPercent" TextAlignment="Center" />
Minimum - ProgressBar控件的最小值。參見基類System.Windows.Controls.Primitives.RangeBase
Maximum - ProgressBar控件的最大值。參見基類System.Windows.Controls.Primitives.RangeBase
Value - ProgressBar控件的值。參見基類System.Windows.Controls.Primitives.RangeBase
ValueChanged - ProgressBar控件的值發生變化時所觸發的事件
<ProgressBar x:Name="progressBar" Width="200" Height="20" Minimum="10" Maximum="70"></ProgressBar>
IsIndeterminate - 是否無法确定目前的進度值
false - 可以确定目前的進度值
true - 無法确定目前的進度值。一個Loading動畫
<ProgressBar Width="200" Height="20" IsIndeterminate="True" Margin="5"></ProgressBar>
</StackPanel>
ProgressBar.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace Silverlight20.Control
{
public partial class ProgressBar : UserControl
{
Storyboard _loop = new Storyboard();
int _count = 0;
public ProgressBar()
{
InitializeComponent();
ProgressBarDemo();
}
void ProgressBarDemo()
_loop.Duration = TimeSpan.FromMilliseconds(100d);
_loop.Completed += new EventHandler(_loop_Completed);
_loop.Begin();
void _loop_Completed(object sender, EventArgs e)
progressBar.Value = _count;
lblPercent.Text = _count.ToString() + "%";
if (_count > 100)
_count = 0;
else
_count++;
}
}
6、RadioButton.xaml
<UserControl x:Class="Silverlight20.Control.RadioButton"
GroupName - RadioButton控件所屬組的組名
Checked - 被選中後所觸發的事件
Click - 被單擊後所觸發的事件
<RadioButton GroupName="groupName" Content="紅色的RadioButton" Background="Red" Margin="5" />
IsEnabled - RadioButton是否有效
<RadioButton GroupName="groupName" Content="無效的RadioButton" IsEnabled="False" Margin="5" />
IsChecked - 是否被選中
RadioButton.Content - RadioButton所對應的内容
<RadioButton GroupName="groupName" Margin="5" IsChecked="true">
<RadioButton.Content>
<Image Source="/Silverlight20;component/Images/Logo.jpg" Width="200" />
</RadioButton.Content>
</RadioButton>
</StackPanel>
OK
<a href="http://down.51cto.com/data/100302" target="_blank">[源碼下載下傳]</a>
本文轉自webabcd 51CTO部落格,原文連結:http://blog.51cto.com/webabcd/342817,如需轉載請自行聯系原作者