1
Vote

RelativeSource DataBinding Problem

description

Hi,
First of all thank you very much for this project, which has been a life saver.
I use your project to print datagrids, and it works perfectly, but recently i've been trying to add a few things and it didn't work that well so i thought i should post my problem here.

On the datagrid i'm printing, you can right click on the header section and chose which ones to hide or display.
I wanted my printing solution to take this into account so I decide to add a Visibility dependency property to the Report class so that I could use it to hide or display some elements in my ItemTemplate.

First problem was that the ItemTemplate DataContext is the ItemSource current element, not the Report Control, but i expected that much, and i thought of using either ElementName binding or RelativeSource binding to be able to get my new dependency properties values.
But this didn't work either. I really think i'm using the RelativeSource binding properly ( I allready used it before), and i don't get any binding errors in the console (well that doesn't mean anything ),
but i can't seem to get it to work with this control.

If anyone has ever tried or done something like this, I would really appreciate your help.
If i'm not clear enough, don't hesitate to ask me.

Thank you in advance!

comments