cancel
Showing results for 
Search instead for 
Did you mean: 

WPF Viewer help needed

Former Member
0 Kudos

I'm just starting my first WPF application using the WPF Viewer but I'm having problems trying to get it to work.  I've followed several How-To articles on using it but even in following the examples, I get the same error.  So I'm hoping I just don't have something setup on my computer.

The computer is a 64bit Windows 7.

Using Visual Studio 2010 SP1.

I installed the file:  CRforVS_13_0_4.exe   {which I noticed didn't give me needed x86 library files so I have my projects set to x64, and also tried AnyCPU.}

I installed the AdventureWorks2008_Database.zip file and attached it to my SQL Server 2008 {for the demo examples}.

I updated the AppConfig with the following lines:

  <startup useLegacyV2RuntimeActivationPolicy="true">

    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>

  </startup>

I have the Model1.edmx file created that links to the People table in the AdventureWorks2008 database.

I created a DataSet1.xsd file that just has 1 table with 3 columns on it.

I have the CrystalReport1.rpt file created that has the 3 fields on it's Detail line.  I set it's property to Copy Always.

I have the following lines in my windows loaded event when trying to display the data:

private void Window_Loaded(object sender, RoutedEventArgs e)

        {

            ReportDocument report = new ReportDocument();

            report.Load("../../CrystalReport1.rpt");

            using (AdventureWorksEntities db = new AdventureWorksEntities())

            {

                report.SetDataSource(from c in db.People

                                     select new { c.LastName, c.FirstName, c.MiddleName });

            }

            crystalReportsViewer1.ViewerCore.ReportSource = report;

        }

At the .SetDataSoruce line, I get the following error:

System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.Button', AncestorLevel='1''. BindingExpression:Path=IsEnabled; DataItem=null; target element is 'Image' (Name=''); target property is 'NoTarget' (type 'Object')

Can anyone help me so I can get this working?

Thank you,

Mike

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Still really need help with this.  Anyone???