Silverlight(5) - 2.0控件之ListBox, MediaElement, MultiScaleImage, PasswordBox, ProgressBar, RadioButton
2008-11-14 11:50:48 来源:WEB开发网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
{
public partial class ListBox : UserControl
{
public ListBox()
{
InitializeComponent();
}
private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
// ListBox.SelectedItem - ListBox中被选中的对象
var lst = sender as System.Windows.Controls.ListBox;
MessageBox.Show(
((System.Windows.Controls.ListBoxItem)lst.SelectedItem).Content + " 被单击了",
"提示",
MessageBoxButton.OK);
}
}
}
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>
Tags:Silverlight 控件 ListBox
编辑录入:爽爽 [复制链接] [打 印]- ››ListBox 滑动到底部自动加载数据
- ››silverlight全屏显示图片
- ››控件一:Gallery 之无限循环的问题
- ››控件一:Gallery 之基础用法
- ››Silverlight MVVM 模式(一) 切近实战
- ››Silverlight for Windows Phone 7开发系列(1):...
- ››Silverlight for Windows Phone 7开发系列(2):...
- ››Silverlight for Windows Phone 7开发系列(3):...
- ››Silverlight for Windows Phone 7开发系列(4):...
- ››Silverlight for Symbian
- ››Silverlight3系列(四)数据绑定 Data Binding 1
- ››silverlight2 游戏 1 你能坚持多少秒
- 中查找“Silverlight(5) - 2.0控件之ListBox, MediaElement, MultiScaleImage, PasswordBox, ProgressBar, RadioButton”更多相关内容
- 中查找“Silverlight(5) - 2.0控件之ListBox, MediaElement, MultiScaleImage, PasswordBox, ProgressBar, RadioButton”更多相关内容
- 上一篇:Silverlight(6) - 2.0控件之ScrollViewer, Slider, StackPanel, TabControl, TextBlock, TextBox, ToggleButton
- 下一篇:Silverlight(4) - 2.0控件之DataGrid, DatePicker, Grid, GridSplitter, HyperlinkButton, Image
更多精彩
赞助商链接