Hi
I created a class with some some attributes, i created an ObservableCollection of this class and want to print this.
Bur when i don't know how to set this class as DataSource .
Could you please help me in this.
Thanks
Hi,
If you want to use a collection as a Data Source, you could use the Object Data Source.
For example, consider the following class:
public class Person
{
private static int Seed = 10;
public Person()
var value = Seed++;
Name = "Name" + value;
Age = value;
}
public string Name { get; set; }
public int Age { get; set; }
// It could be an ObservableCollection too
public static IEnumerable<Person> GetSampleData()
return new List<Person>
new Person(), new Person(), new Person(),
};
Just create a DS based on the GetSampleData method, drag&drop it to the report, hit preview and you should see the six persons being rendered as a table.
At runtime you can bind the data source to a collection containing the actual data you want to render, e.g. you can bind the data source to a collection in your view model.
<ig:XamReportViewer>
<ig:XamReportViewer.RenderSettings>
<ig:ClientRenderSettings DefinitionUri="MyNamespace.MyReport.igr, MyAssembly">
<ig:ClientRenderSettings.DataSources>
<ig:DataSource TargetDataSource="Person"
ItemsSource="{Binding Persons}" />
</ig:ClientRenderSettings.DataSources>
</ig:ClientRenderSettings>
</ig:XamReportViewer.RenderSettings>
</ig:XamReportViewer>
Hope it clarifies.
Please tell me if you need something else or you have any problem.
Thanks,
Leo
Hi thanks for answer .. i will try and let u know ..
bye
thanks again