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.
Unfortunately, activation email could not send to your email. Please try again.

Usage of Record.Data within DataTemplates

Thread ID:

Created:

Updated:

Platform:

Replies:

116519 Jun 4,2014 08:11 AM Jun 6,2014 08:30 AM WPF 1
loading
Tags: GridTreeControl
Adam Smith
Asked On June 4, 2014 08:11 AM

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 08:30 AM

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.

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.

;