using DevExpress.CodeParser;
|
using DevExpress.XtraReports.UI;
|
using System;
|
using System.Collections;
|
using System.ComponentModel;
|
using System.Drawing;
|
|
namespace HStation.WinFrmUI
|
{
|
public partial class XtraReport1 : DevExpress.XtraReports.UI.XtraReport
|
{
|
public XtraReport1()
|
{
|
InitializeComponent();
|
ininal();
|
}
|
|
private SimulationPrintViewModel _printViewModel;
|
|
public void SetBingdingData(SimulationPrintViewModel viewModel)
|
{
|
_printViewModel = viewModel;
|
}
|
|
private void ininal()
|
{
|
// 获取数据源
|
List<Product> dataSource = CreateSampleProductList();
|
// this.xrTable1.DataBindings.Add("Text", dataSource, "Price");
|
this.DataSource = dataSource;
|
xrTable2.DataBindings.Add("Text", dataSource, "Price");
|
xrTable2.DataBindings.Add("Text", dataSource, "ProductName");
|
}
|
|
public class Product
|
{
|
public string ProductName { get; set; }
|
public decimal Price { get; set; }
|
}
|
|
public List<Product> CreateSampleProductList()
|
{
|
List<Product> products = new List<Product>
|
{
|
new Product { ProductName = "苹果", Price = 5.99m },
|
new Product { ProductName = "香蕉", Price = 3.99m },
|
new Product { ProductName = "橙子", Price = 4.99m }
|
};
|
|
return products;
|
}
|
}
|
}
|