如何在WPF中的RDLC报告中添加动态下拉列表



我必须在WPF应用程序中加载RDLC报告,并且需要在报告中包含下拉列表。根据下拉列表的选择,将生成不同的报告。我正在使用C#和WPF。

我必须在RDLC报告中列出员工的详细信息。有一个国家下拉列表,根据国家下拉列表的选择,我们需要显示所选国家/地区员工的详细信息。

我对此进行了分析。无法在报表查看器中添加动态下拉列表。它应该在报表查看器之外。我创建了一个RDLC文件,并添加了一个WPF窗口来显示RDLC报告。我在XAML文件中的报表查看器外部添加了组合框。请参阅下面的代码。

<Window x:Class="CAREERS.BundleManagement.App.Reports.FollowUpReportExaminer"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="FollowUpReportExaminer" Height="600" Width="800"
        xmlns:report="clr-namespace:CAREERS.BundleManagement.App.Reports" WindowStartupLocation="CenterScreen">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <StackPanel Margin="10" Grid.Row="0">
            <ComboBox>
                <ComboBoxItem>India</ComboBoxItem>
                <ComboBoxItem IsSelected="True">USA</ComboBoxItem>
                <ComboBoxItem>UK</ComboBoxItem>
            </ComboBox>
        </StackPanel>
        <report:ReportViewer Grid.Row="1" ></report:ReportViewer>
    </Grid>
</Window>

我们可以通过调用组合框的Loaded事件中指定的方法来动态加载组合框。通过调用SelectionChanged事件,我们可以加载基于报表的选择

最新更新