开发学院图形图像Flash Silverlight(17) - 2.0数据之详解DataGrid, 详解L... 阅读

Silverlight(17) - 2.0数据之详解DataGrid, 详解ListBox

 2008-12-08 11:51:53 来源:WEB开发网   
核心提示: SourceData.csusing System;using System.Net;using System.Windows;using System.Windows.Controls;using System.Windows.Documents;using System.Windows

SourceData.cs

using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
  
using System.Collections.ObjectModel;
  
namespace Silverlight20.Data
{
  public class SourceData
  {
    // ObservableCollection<T> 内置实现了 INotifyCollectionChanged 接口(可直接应用于 OneWay 和 TwoWay 的绑定模式)
    public ObservableCollection<SourceDataModel> GetData()
    {
      var source = new ObservableCollection<SourceDataModel>();
  
      for (int i = 0; i < 100; i++)
      {
        source.Add(
          new SourceDataModel
          {
            Name = "Name" + i.ToString().PadLeft(4, '0'),
            Age = new Random(i).Next(20, 60),
            DayOfBirth = DateTime.Now,
            Male = Convert.ToBoolean(i % 2)
          });
      }
  
      return source;
    }
  }
}

1、DataGrid01.xaml

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

Tags:Silverlight 数据 详解

编辑录入:爽爽 [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
赞助商链接