Bindings

Mar 1, 2010 at 11:15 PM
Edited Mar 1, 2010 at 11:16 PM

How can I change lets say the foreground colour based on the data? Lets say I build an IntegerToColor converter that returns red when the integer value is a multiple of 10. What do I bind that data to? Please exemplify as I am not sure what is the datacontext of the paragraph in the following example (extracted from SimpleReport.xaml in the source code)

 <xrd:TableRowForDataTable TableName="Ean">
                        <TableCell>
                            <Paragraph Foreground={Binding ?????? is this a DataRow???}>
                                <xrd:InlineTableCellValue PropertyName="Position" />
                            </Paragraph>
                        </TableCell>
Mar 3, 2010 at 3:16 PM

This place seems to be forgoten.

 However I don't think that this Reporting Engine has support for binding to custom collection (e.g use with the MVVM model). I found an interesting article of how to "do it yourself" here: http://msdn.microsoft.com/en-us/magazine/dd569761.aspx

If anyone thinks that this reporting engine can be used in a MVVM manner please explain.

Thanks in advance!

Dan

Mar 3, 2010 at 3:45 PM

I hope you're not right about the place being forgotten. It took me a LONG time to find a suitable reporting solution for my project and am glad I came across this. Its is very stable and I have used it in production and it is a great solution. I hope this project keeps on growing.

Mar 3, 2010 at 6:19 PM
Edited Mar 3, 2010 at 6:19 PM

Can you please tell me if you were able to change at runtime the look of a field in one of your reports? E.g. if a field value is "abc" change the font color to Red? Is that possible with this engine? I am running out of time and so far I decided to go with the solution I mentioned earlier or eventually try the Component1 WPF reporting classes.

Mar 3, 2010 at 7:21 PM

I don't think its possible in the direct manner you describe. But, it might be possible with some "messy" code. You could designate two fields in the template, one in black and one in red. Then, in your code, you could make one label blank (for example, the one in the black field) and put your data in the label for the red field. 

I know that's ugly, but I think that's the only way to do it for now. Again, I still believe this is one of the better reporting solutions out there for WPF right now.

Mar 3, 2010 at 10:56 PM
jimbeam451 wrote:

I don't think its possible in the direct manner you describe. But, it might be possible with some "messy" code. You could designate two fields in the template, one in black and one in red. Then, in your code, you could make one label blank (for example, the one in the black field) and put your data in the label for the red field. 

I know that's ugly, but I think that's the only way to do it for now. Again, I still believe this is one of the better reporting solutions out there for WPF right now.

 Agree, this is very ugly will never go that route, I'd rather build attached properties or extend the classes in this project. However I think I will go with the solution from MSDN magazine for now as I have to have fields that should respond to data changes and my project has already a MVVM model as the data comes from a web service (generated entities using .nettiers and codesmith)