DevExpress v24.2 Update — Your Feedback Matters
Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.
Take the survey
Not interested
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:
# Example
View 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 ); }
}
}
}
<UserControl
x:Class ="StandaloneReportManagerServiceExample.Views.MainView"
xmlns ="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x ="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc ="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d ="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dx ="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxr ="http://schemas.devexpress.com/winfx/2008/xaml/ribbon"
xmlns:dxb ="http://schemas.devexpress.com/winfx/2008/xaml/bars"
xmlns:dxmvvm ="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:dxrudex ="http://schemas.devexpress.com/winfx/2008/xaml/reports/userdesignerextensions"
xmlns:viewModels ="clr-namespace:StandaloneReportManagerServiceExample.ViewModels"
xmlns:reports ="clr-namespace:StandaloneReportManagerServiceExample.Reports"
mc:Ignorable ="d" d:DesignHeight ="300" d:DesignWidth ="300" >
<UserControl.DataContext >
<viewModels:MainViewModel />
</UserControl.DataContext >
<DockPanel >
<dxr:RibbonControl DockPanel.Dock ="Top" RibbonStyle ="Office2010" >
<dxr:RibbonDefaultPageCategory Caption ="defaultCategory" >
<dxr:RibbonPage Caption ="Home" >
<dxr:RibbonPageGroup Caption ="Tools" >
<dxb:BarSplitButtonItem Content ="Reports" LargeGlyph ="{dx:DXImage Image=Printer_32x32.png}" >
<dxmvvm:Interaction.Behaviors >
<dxrudex:ReportManagerBehavior Service ="{Binding ElementName=ReportService}" />
</dxmvvm:Interaction.Behaviors >
</dxb:BarSplitButtonItem >
</dxr:RibbonPageGroup >
</dxr:RibbonPage >
</dxr:RibbonDefaultPageCategory >
</dxr:RibbonControl >
<ListBox Name ="listBox" ItemsSource ="{Binding Items}" >
<ListBox.ItemTemplate >
<DataTemplate >
<TextBlock Text ="{Binding Name}" />
</DataTemplate >
</ListBox.ItemTemplate >
<dxmvvm:Interaction.Behaviors >
<dxrudex:StandaloneReportManagerService x:Name ="ReportService" DataSource ="{Binding ElementName=listBox, Path=ItemsSource}" >
<dxrudex:PredefinedReport ReportName ="Predefined Xtra Report" Type ="reports:PredefinedXtraReport" />
</dxrudex:StandaloneReportManagerService >
</dxmvvm:Interaction.Behaviors >
</ListBox >
</DockPanel >
</UserControl >
Imports DevExpress.Mvvm
Imports System
Imports System.Collections.Generic
Imports System.Collections.ObjectModel
Imports System.Linq
Imports System.Text
Imports System.Threading.Tasks
Namespace StandaloneReportManagerServiceExample.ViewModels
Public Class MainViewModel
Inherits ViewModelBase
Public Property Items() As List(Of ItemViewModel)
Get
Return GetProperty(Function () Items)
End Get
Set (ByVal value As List(Of ItemViewModel))
SetProperty(Function () Items, value)
End Set
End Property
Public Sub New ()
Items = New List(Of ItemViewModel)() From { _
New ItemViewModel() With {.ID = 1 , .Name = "First" }, _
New ItemViewModel() With {.ID = 2 , .Name = "Second" }, _
New ItemViewModel() With {.ID = 3 , .Name = "Third" }, _
New ItemViewModel() With {.ID = 4 , .Name = "Fourth" } _
}
End Sub
End Class
Public Class ItemViewModel
Inherits ViewModelBase
Public Property Name() As String
Get
Return GetProperty(Function () Name)
End Get
Set (ByVal value As String )
SetProperty(Function () Name, value)
End Set
End Property
Public Property ID() As Integer
Get
Return GetProperty(Function () ID)
End Get
Set (ByVal value As Integer )
SetProperty(Function () ID, value)
End Set
End Property
End Class
End Namespace
See Also