We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Usage of Record.Data within DataTemplates

Thread ID:

Created:

Updated:

Platform:

Replies:

116519 Jun 4,2014 12:11 PM UTC Jun 6,2014 12:30 PM UTC WPF 1
loading
Tags: GridTreeControl
Adam Smith
Asked On June 4, 2014 12:11 PM UTC

Hi Guys,

This page (http://help.syncfusion.com/ug/wpf/grid/default.htm#!documents/datatemplate.htm) states it should be possible to access underlying object bindings within a Data Template via {Binding Record.Data.xzy}.  

This doesn't appear to work - do you have an example/sample that demonstrates this for the GridTreeControl?

Thanks,

Adam

Ashok N [Syncfusion]
Replied On June 6, 2014 12:30 PM UTC

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


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;