Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
90
Specify path to field's display text
posted

I am new to XamDataGrid, so this may be an easy question.

One of the fields in my data-grid corresponds to a property which is a custom business object.  I want to use this business object's "Description" property (of type String) as the text that gets displayed in the data-grid.  So how do I do that?  Please show the XAML.

As a temporary workaround, I overrode the business object's ToString() method, but this is not ideal.

 

Parents
No Data
Reply
  • 2180
    Offline posted

    Hi,
    You can achieve this with UnboundField in the xamDataGrid control.
    Let's have a business object - for example an object of type Person and the Person has a complex memeber FullName of type Name with two fields FirstName and LastName. You can display the FirstName and LastName in XAML in the following way:

    <ig:XamDataGrid x:Name="igDataGrid" >
        <ig:XamDataGrid.FieldLayoutSettings>
            <ig:FieldLayoutSettings AutoGenerateFields="False" />
        </ig:XamDataGrid.FieldLayoutSettings>
        <ig:XamDataGrid.FieldLayouts>
            <ig:FieldLayout>
                <ig:UnboundField Name="FirstName" Label="First Name" BindingPath="FullName.FirstName" />
                <ig:UnboundField Name="LastName" Label="Last Name" BindingPath="FullName.LastName" />
            </ig:FieldLayout>
     </ig:XamDataGrid.FieldLayouts>
    </ig:XamDataGrid>

    You can read more detailed description on this topic here:

    http://help.infragistics.com/NetAdvantage/WPF/2010.3/CLR4.0/?page=xamDataPresenter_Displaying_a_Complex_Property_XAML.html

    Best Regards

Children