Skip to content
Peter Gill edited this page May 3, 2024 · 4 revisions

The Majorsilence Reporting designer control can be used from a windows forms or wpf application.

Make sure to add references to

  • DataProviders
  • RdlCri
  • RdlEngine
  • RdlViewer
  • RdlDesigner
dotnet add package Majorsilence.Reporting.ReportDesigner

If you are adding to a WPF application also make sure you add references to

  • System.Windows.Forms
  • WindowsFormsIntegration

One last note, as with any project make sure RdlEngineConfig.xml is copied to your bin directory and the correct path to the data providers dll is set. See Database Providers Howto.

See https://github.com/majorsilence/My-FyiReporting/tree/master/Examples/SampleDesignerControl for a fully working winform and WPF example.

C# winform example

        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Form frm = new Form();
            fyiReporting.RdlDesign.RdlUserControl ctl = new fyiReporting.RdlDesign.RdlUserControl();
            ctl.OpenFile(@"The path to the rdl file.rdl");
            ctl.Dock = DockStyle.Fill;
            frm.Controls.Add(ctl);

            Application.Run(frm);

        }

C# WPF Example

<Window x:Class="SampleDesignerControlWPF.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
        xmlns:myctrl="clr-namespace:fyiReporting.RdlDesign;assembly=RdlDesigner"
        Title="MainWindow" Loaded="Window_Loaded_1" Height="auto" Width="auto">


    <DockPanel >
        <WindowsFormsHost Margin="0"  Name="windowsFormsHost1" DockPanel.Dock="Top">
            <myctrl:RdlUserControl x:Name="reportDesigner"  />
        </WindowsFormsHost>
      
    </DockPanel>

</Window>
        private void Window_Loaded_1(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.Application.EnableVisualStyles();
            reportDesigner.OpenFile(@"The path to the rdl file.rdl");
        }