WEB开发网
开发学院图形图像Flash Silverlight(5) - 2.0控件之ListBox, MediaElemen... 阅读

Silverlight(5) - 2.0控件之ListBox, MediaElement, MultiScaleImage, PasswordBox, ProgressBar, RadioButton

 2008-11-14 11:50:48 来源:WEB开发网   
核心提示: ListBox.xaml.csusing System;using System.Collections.Generic;using System.Linq;using System.Net;using System.Windows;using System.Windows.Control

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>

上一页  1 2 3 4 5 6 7  下一页

Tags:Silverlight 控件 ListBox

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接