StandaloneReportManagerService
- 3 minutes to read
StandaloneReportManagerService is an IReportManagerService implementation that allows you to convert a data source into a XtraReport object.
An example illustrating how to declare the StandaloneReportManagerService is shown below.
<ListBox Name="listBox" ItemsSource="{Binding Items}">
<dxmvvm:Interaction.Behaviors>
<dxrudex:StandaloneReportManagerService x:Name="EmployeesReportService" DataSource="{Binding ElementName=listBox, Path=ItemsSource}"/>
</dxmvvm:Interaction.Behaviors>
</ListBox>
Use one the following approaches to manage reports of the attached service:
- Invoke service methods by using the IReportManagerService interface directly (See the Reports Managing section in Reports Manager Concepts).
- Use the service’s embedded ViewModel of the ReportManagerServiceViewModel type with available commands (See the Service’s ViewModel section in Reports Manager Concepts).
- Use the auxiliary ReportManagerBehavior that automatically populates a BarSplitButtonItem with the necessary commands (See the Auxiliary ReportManagerBehavior section in Reports Manager Concepts).
Example
using DevExpress.Mvvm;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StandaloneReportManagerServiceExample.ViewModels {
public class MainViewModel : ViewModelBase {
public List<ItemViewModel> Items {
get { return GetProperty(() => Items); }
set { SetProperty(() => Items, value); }
}
public MainViewModel() {
Items = new List<ItemViewModel>() {
new ItemViewModel() { ID = 1, Name = "First" },
new ItemViewModel() { ID = 2, Name = "Second" },
new ItemViewModel() { ID = 3, Name = "Third" },
new ItemViewModel() { ID = 4, Name = "Fourth" },
};
}
}
public class ItemViewModel : ViewModelBase {
public string Name {
get { return GetProperty(() => Name); }
set { SetProperty(() => Name, value); }
}
public int ID {
get { return GetProperty(() => ID); }
set { SetProperty(() => ID, value); }
}
}
}
See Also