WEB开发网
开发学院图形图像Flash Silverlight(4) - 2.0控件之DataGrid, DatePicker... 阅读

Silverlight(4) - 2.0控件之DataGrid, DatePicker, Grid, GridSplitter, HyperlinkButton, Image

 2008-11-14 11:50:51 来源:WEB开发网   
核心提示: 6、Image.xaml<UserControl x:Class="Silverlight20.Control.Image"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation&

6、Image.xaml

<UserControl x:Class="Silverlight20.Control.Image"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <StackPanel HorizontalAlignment="Left">
    
    <!--
    Source - 程序目录下的图片文件地址
    -->
    <Image Source="/Logo.jpg" Margin="5" Width="100" />
    
    <!--
    Source - 程序集内的图片文件地址 [/程序集名;component/图片路径]
    -->
    <Image Source="/Silverlight20;component/Images/Logo.jpg" Margin="5" Width="200" />
  
    <!--
    Source - 互联网的图片文件地址
    -->
    <Image Source="http://silverlight.net/Themes/silverlight/images/logo.jpg" Margin="5" Width="100" />
  
    <!--
    Source - 后台方式设置Image的Source
    -->
    <Image x:Name="img" Margin="5" Width="100" />    
    
  </StackPanel>
</UserControl>

Image.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.Media.Imaging;
  
namespace Silverlight20.Control
{
  public partial class Image : UserControl
  {
    public Image()
    {
      InitializeComponent();
  
      // 后台方式设置Image的Source
      img.Source = new BitmapImage(new Uri("/Silverlight20;component/Images/Logo.jpg", UriKind.Relative));
    }
  }
}

OK

上一页  1 2 3 4 5 

Tags:Silverlight 控件 DataGrid

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