Hi,
I have a hierarchical xamgrid. I want to bind the texblock in the first-level hierarchy's header to a string in the parent class.
So if i had
Class Parent
{
string headerText;
ObservableCollection<Child> collection
}
I want a column in the child to have its header bound to headertext
hi,
You can try the approach described in the blog post by Devin Rader - http://community.infragistics.com/blogs/devin_rader/archive/2011/04/29/binding-to-properties-of-non-frameworkelements.aspx
HTH
what if the property is several levels into the hierarchy? it is not possible for me to move from the view model into my hierarchy. I have to move from the header to the parentrow's datacontext...see the figure
Hello,
Were you able to set the headers?
Sincerely,ValerieDeveloper Support Engineer Infragisticswww.infragistics.com/support
This is a bit trickier.
The DataContext for a HeaderTemplate only gives the Key for the column.
If you wanted something a bit more advanced, your best bet is to Re-Template the HeaderCellControl, and and use a RelativeSourceBinding to look up the specific property that you'd like to bind to.
So basically, in the ControlTemplate, you'd replace the ContentPresenter with at TextBlock with something that looks like:<TextBlock Text={Binding Cell.Row.Manager.ParentRow.Data.YourProperty, RelativeSource={RelativeSource TemplatedParent}}/>
-SteveZ
Can someone shed some light on this?