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

How to add a dynamic drop down list in RDLC reports in WPF

我必须在 WPF 应用程序中加载 RDLC 报告,并且需要在 report.Based 中包含一个下拉列表,用于选择下拉列表不同的报告 generated.I 我正在使用 C# 和 WPF .

例如:我必须在 RDLC 中列出员工的详细信息 report.There 是一个国家/地区下拉列表,根据国家/地区下拉列表的选择,我们需要显示所选国家/地区的员工详细信息.

我分析了 this.We 无法在报表中添加动态下拉列表 viewer.It 应该在报表查看器之外。 我创建了一个 RDLC 文件并添加了一个 WPF window 来显示 RDLC Report.I 在 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 事件,我们可以加载基于选择的报告