Hi Adam,
Thank you for contacting Syncfusion
Support.
We analyzed your query. In GrirTreeControl don’t have
support to access underlying object bindings within a Data Template
via {Binding Record.Data.xzy}. In our UGDocumentation we put this
information as wrongly. We will change this information in our UGDocumentation
ASAP. But you can bind some other object value to DataTemplate column means use
QueryCellInfo event and store the items to e.Style.CellValue2.
Using this CellValue2
you can bind the other object value within DataTemplate. Please refer the below
code snippet
XAML code:
<syncfusion:GridTreeColumn
HeaderText="First Name" MappingName="FirstName"
>
<syncfusion:GridTreeColumn.StyleInfo>
<syncfusion:GridStyleInfo CellType="DataBoundTemplate">
<syncfusion:GridStyleInfo.CellItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Style.CellValue2.LastName}"/>
</DataTemplate>
</syncfusion:GridStyleInfo.CellItemTemplate>
</syncfusion:GridStyleInfo>
</syncfusion:GridTreeColumn.StyleInfo>
</syncfusion:GridTreeColumn>
|
C# Code snippet:
void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
if
(e.Style.CellType == "DataBoundTemplate")
{
var node
= treeGrid.InternalGrid.GetNodeAtRowIndex(e.Style.RowIndex);
if (node
!= null)
{
var
item = node.Item as EmployeeInfo;
e.Style.CellValue2 = item;
}
}
}
|
Sample Link: http://www.syncfusion.com/downloads/support/directtrac/125862/CS-513814108.zip
Please let us know if you require further assistance
Thanks,
Ashok