We are making an application that needs to bind to a data object that we defined in a similar fashion to what is described in the documentation on page 43.
However, we are running into an issue within the report designer when we try to add this as a data source. It is not selectable. The problem seems to be that our object type has a constructor that requires several parameters; this is the reason why it does not seem to be selectable. When we add a default constructor back into the code, it works. You can try it with the code supplied in the documentation. Within the project class, add a constructor that takes in one or more arguments and it will then cease to be able to be bind-able.
Is this a bug? An oversight? Or just a requirement that must be lived with? It just seems odd that we should have to define a default constructor for this just to be able to bind to this object.
On a related note, is it possible to make the object type an interface? So far it doesn't seem to be supported unless the object type is a concrete class. Is this by design or is this something that might change in later builds?
One last question... is the design team aware of random crashes that happen periodically while within the report designer? I wish I had more information about these crashes at the moment, but I can't seem to replicate this now that I need it to happen.
Overall, I think you guys are doing a great job with this tool and it seems to be coming along very nicely.
Are there any updates on this issue?
I also noticed that when I start doing data bindings in xaml, I get a couple error messages on the debugger whenever the xamreportviewer gets displayed.
System.Windows.Data Error: 40 : BindingExpression path error: 'ParameterControlViewModels' property not found on 'object' ''MainWindowVM' (HashCode=43140121)'. BindingExpression:Path=ParameterControlViewModels; DataItem='MainWindowVM' (HashCode=43140121); target element is 'ItemsControl' (Name=''); target property is 'ItemsSource' (type 'IEnumerable')
System.Windows.Data Error: 40 : BindingExpression path error: 'SubmitCommand' property not found on 'object' ''MainWindowVM' (HashCode=43140121)'. BindingExpression:Path=SubmitCommand; DataItem='MainWindowVM' (HashCode=43140121); target element is 'Button' (Name=''); target property is 'Command' (type 'ICommand')
These don't seem to be a cause of my problem, but I'm also curious as to why they are being displayed. Is this just the beginnings of something in the code that will be fleshed out for the future release?
I've included an example solution that's pretty bare bones and should show you the basics of the problem I'm running into. I set the datacontext property to the correct viewmodel whenever I create the xamreportviewer user control in my mainwindowVM.
Hi,
I tried out the code you sent and I still can’t reproduce the problem. Where/how are you initializing the DataContext property?
Thanks,
Leo
I found a further piece of information that I just discovered. When this scenario is in play: exporting, printing, and the page settings buttons on the toolbar do not work until the refresh button is pressed on the toolbar. They are simply greyed out and unclickable.