1
생성 된 객체를 보고서에 연결하고 SyncFusion ReportViewer를 통해 보려고하는 간단한 샘플 프로젝트를 만들었습니다. 응용 프로그램의SyncFusion ReportViewer를 객체에 연결
메인 화면은 다음과 같습니다
<Window x:Class="testApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
Title="MainWindow" Height="350" Width="525" Loaded="OnWindowLoad">
<Grid>
<syncfusion:ReportViewer Name="reportViewer1" ReportPath="c:\Pool\test\testApp\testApp\Report1.rdlc" />
</Grid>
</Window>
다음 내가 보고서의 모음에 표시 할 Person 클래스를 만들었습니다. 그것은 다음과 같습니다
namespace testApp
{
public class Person
{
private string m_name;
public string Name
{
get { return m_name; }
set { m_name = value; }
}
private int m_age;
public int Age
{
get { return m_age; }
set { m_age = value; } }
public Person(string name, int age)
{
Name = name;
Age = age;
}
}
}
그때 나는 .rdlc 보고서 파일을 생성하고 Person 클래스를 대상으로 개체 데이터 소스를 사용하는 PersonDataSet라는 데이터 집합을 만들었습니다.
PersonDataSet의 항목이있는 테이블이 이름과 나이로 표시됩니다. 임 사람의 목록을 작성하고 보고서에 전달하려고 응용 프로그램의 메인 윈도우의로드 이벤트 함수
: 명 데이터로 보고서를로드하는
private void OnWindowLoad(object sender, RoutedEventArgs e)
{
var persons = new List<Person>
{
new Person("Jan", 25),
new Person("Jana", 24)
};
ReportDataSource source = new ReportDataSource
{
Name = "PersonDataSet",
Value = persons
};
reportViewer1.DataSources.Add(source);
reportViewer1.RefreshReport();
}
대신은 보고서 뷰어입니다 끝없이 로딩 ..
내가 뭘 잘못하고있어?
감사합니다.