2.0控件之ListBox, MediaElement, MultiScaleImage, PasswordBox, ProgressBar, RadioButton
2009-06-08 21:28
417 查看
示例
1、ListBox.xaml
<UserControl x:Class="Silverlight20.Control.ListBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel HorizontalAlignment="Left">
<!--
SelectionChanged - ListBox中某个对象被选中后所触发的事件
-->
<ListBox Margin="5" Width="200" Height="100" SelectionChanged="ListBox_SelectionChanged">
<ListBoxItem Content="ListBoxItem01" />
<ListBoxItem Content="ListBoxItem02" />
<ListBoxItem Content="ListBoxItem03" />
<ListBoxItem Content="ListBoxItem04" />
<ListBoxItem Content="ListBoxItem05" />
<ListBoxItem Content="ListBoxItem06" />
<ListBoxItem Content="ListBoxItem07" />
<ListBoxItem Content="ListBoxItem08" />
<ListBoxItem Content="ListBoxItem09" />
<ListBoxItem Content="ListBoxItem10" />
</ListBox>
<!--
ListBox中可以包含任何对象
-->
<ListBox Margin="5" Width="200">
<TextBlock Text="TextBlock" />
<TextBox Text="TextBox" />
<Button Content="Button" />
</ListBox>
</StackPanel>
</UserControl>
ListBox.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;
using System.Windows.Browser;
namespace Silverlight20.Control
2、MediaElement.xaml
<UserControl x:Class="Silverlight20.Control.MediaElement"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel HorizontalAlignment="Center">
<!--
Source - 视频路径
AutoPlay - 是否自动播放
-->
<MediaElement x:Name="mediaElement" Height="250" AutoPlay="False"
Source="/Silverlight20;component/Video/Demo.wmv" />
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<ToggleButton x:Name="play" Content="播放" Margin="5" Click="play_Click" />
<ToggleButton x:Name="mute" Content="静音" Margin="5" Click="mute_Click" />
</StackPanel>
</StackPanel>
</UserControl>
MediaElement.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
3、MultiScaleImage.xaml
<UserControl x:Class="Silverlight20.Control.MultiScaleImage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel HorizontalAlignment="Left">
<MultiScaleImage x:Name="msi" Width="400" Height="300"></MultiScaleImage>
</StackPanel>
</UserControl>
MultiScaleImage.xaml.cs(支持放大/缩小/拖动/滚轮之类的,摘自Deep Zoom Composer生成的代码)
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
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"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel HorizontalAlignment="Left">
<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>
</UserControl>
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
6、RadioButton.xaml
<UserControl x:Class="Silverlight20.Control.RadioButton"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel HorizontalAlignment="Left">
<!--
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>
</UserControl>
1、ListBox.xaml
<UserControl x:Class="Silverlight20.Control.ListBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel HorizontalAlignment="Left">
<!--
SelectionChanged - ListBox中某个对象被选中后所触发的事件
-->
<ListBox Margin="5" Width="200" Height="100" SelectionChanged="ListBox_SelectionChanged">
<ListBoxItem Content="ListBoxItem01" />
<ListBoxItem Content="ListBoxItem02" />
<ListBoxItem Content="ListBoxItem03" />
<ListBoxItem Content="ListBoxItem04" />
<ListBoxItem Content="ListBoxItem05" />
<ListBoxItem Content="ListBoxItem06" />
<ListBoxItem Content="ListBoxItem07" />
<ListBoxItem Content="ListBoxItem08" />
<ListBoxItem Content="ListBoxItem09" />
<ListBoxItem Content="ListBoxItem10" />
</ListBox>
<!--
ListBox中可以包含任何对象
-->
<ListBox Margin="5" Width="200">
<TextBlock Text="TextBlock" />
<TextBox Text="TextBox" />
<Button Content="Button" />
</ListBox>
</StackPanel>
</UserControl>
ListBox.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;
using System.Windows.Browser;
namespace Silverlight20.Control
2、MediaElement.xaml
<UserControl x:Class="Silverlight20.Control.MediaElement"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel HorizontalAlignment="Center">
<!--
Source - 视频路径
AutoPlay - 是否自动播放
-->
<MediaElement x:Name="mediaElement" Height="250" AutoPlay="False"
Source="/Silverlight20;component/Video/Demo.wmv" />
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<ToggleButton x:Name="play" Content="播放" Margin="5" Click="play_Click" />
<ToggleButton x:Name="mute" Content="静音" Margin="5" Click="mute_Click" />
</StackPanel>
</StackPanel>
</UserControl>
MediaElement.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
3、MultiScaleImage.xaml
<UserControl x:Class="Silverlight20.Control.MultiScaleImage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel HorizontalAlignment="Left">
<MultiScaleImage x:Name="msi" Width="400" Height="300"></MultiScaleImage>
</StackPanel>
</UserControl>
MultiScaleImage.xaml.cs(支持放大/缩小/拖动/滚轮之类的,摘自Deep Zoom Composer生成的代码)
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
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"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel HorizontalAlignment="Left">
<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>
</UserControl>
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
6、RadioButton.xaml
<UserControl x:Class="Silverlight20.Control.RadioButton"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel HorizontalAlignment="Left">
<!--
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>
</UserControl>
相关文章推荐
- 稳扎稳打Silverlight(5) - 2.0控件之ListBox, MediaElement, MultiScaleImage, PasswordBox, ProgressBar, RadioButton
- 稳扎稳打Silverlight(5) - 2.0控件之ListBox, MediaElement, MultiScaleImage, PasswordBox, ProgressBar, RadioButton
- 上接稳扎稳打Silverlight(5) - 2.0控件之ListBox, MediaElement, MultiScaleImage, PasswordBox
- 稳扎稳打Silverlight(5) - 2.0控件之ListBox, MediaElement, MultiScaleImage, PasswordBox
- Deep Zoom 的 Silverlight 展示控件 MultiScaleImage
- Deep Zoom 的 Silverlight 展示控件 MultiScaleImage
- Deep Zoom 的 Silverlight 展示控件 MultiScaleImage
- 红外小目标检测matlab程序——基于《Infrared Small-Target Detection Using Multiscale Gray Difference Weighted Image》
- Depth Map Prediction from a Single Image using a Multi-Scale Deep Network
- 系出名门Android(5) - 控件(View)之TextView, Button, ImageButton, ImageView, CheckBox, RadioButton, AnalogClock, DigitalClock
- 背水一战 Windows 10 (33) - 控件(选择类): ListBox, RadioButton, CheckBox, ToggleSwitch
- 在ASP.NET 2.0中操作数据之四十九:为GridView控件添加RadioButton
- Depth Map Prediction from a Single Image using a Multi-Scale Deep Network
- Windows Phone开发之控件Grid,TextBox,TextBlock,RadioButton,CheckBox,ListBox简介
- 稳扎稳打Silverlight(4) - 2.0控件之DataGrid, DatePicker, Grid, GridSplitter, HyperlinkButton, Image
- 一分钟了解“文章Infrared Small-Target Detection Using Multiscale Gray Difference Weighted Image Entropy”
- Android( 基本控件)、progressBar+Handler(进度条)、AutoCompleteTextView(单行自动补全)、MultiAutoCompleteTextView(多行补全)
- 【论文笔记】Depth Map Prediction from a Single Image using a Multi-Scale Deep Network
- 稳扎稳打Silverlight(4) - 2.0控件之DataGrid, DatePicker, Grid, GridSplitter, HyperlinkButton, Image
- 103.Daikon Forge高级控件checkbox、dropdownlist、listbox、progressbar