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
380
Problem with Field Headers
posted

Hi..I m using infragistics xamdatagrid.

I m binding data from an xml file using xmldataprovider in grid.resources.

data is displaying in the grid nicely.my problem is when we bind the data the field header names it wil take from the xml file.

here we can give our own field header using filed label.i gave same like this.but field headers not changing..

<igDP:Field Name="CountyId" Label="COUNTRYID" />

here name means name in the xml file right. label means we can give what header we want for that field..

i gave same like this .but not coming.can u give reply for this..

i wil send some code also for this wat i wrote..

Here i m facing many small small problems.

1)Here I gave Label name in CAPITAL letters.but its not taking.it is displaying same as in the xml file.

2)Here i gave editastype is Int32. but it is taking string values also.

3)and i gave field width 30. it is not taking.

4)overall its not taking field layoutsettings.so it is not applying wat i gave inside this.

Please give reply.......

 

 

 

 

 

<

Grid.Resources ><XmlDataProvider x:Key="CountryData XPath="/Countries/Country"

Source="C:\Sample.xml"></XmlDataProvider></Grid.Resources>

<

igDP:XamDataGrid Name="MainDataGrid"

DataSource

="{Binding Source={StaticResource CountryData},XPath=/Country}">

<

igDP:XamDataGrid.FieldSettings>

 

<igDP:FieldSettings AllowSummaries="True" SummaryUIType="MultiSelect" SummaryDisplayArea="Bottom">

 

</igDP:FieldSettings></igDP:XamDataGrid.FieldSettings>

<

igDP:XamDataGrid.FieldLayouts>

 

<igDP:FieldLayout >

 

<igDP:FieldLayout.Fields>

 

<igDP:Field Name="CountryId" Label="COUNTRYID" >

 

<igDP:Field.Settings>

 

<igDP:FieldSettings EditAsType="{x:Type sys:Int32}" AllowResize="False"

 

CellWidth="30"></igDP:FieldSettings></igDP:Field.Settings></igDP:Field>

</

igDP:FieldLayout.Fields></igDP:FieldLayout>

</igDP:XamDataGrid.FieldLayouts>

 

</igDP:XamDataGrid>

Parents
  • 69686
    posted

    Hello,

    This is true -  the name has to be exactly the same as the one in the source. So to make sure that you have exactly the same names and really a quick way to do this is to use the trick that Josh Smith has shown in his blog post here.

    Using this, you will get all the fields generated automatically in the output and just copy and paste them and then set the appropriate labels.

    I would also suggest setting EditAsType not EditAsType so that the proper editor can be picked up for this field.

    Once you have defined the fields in the xaml, make sure you turn off the AutoGenerateFields property in the FieldLayoutSettings.

    Test this and let me know if you still have problems.

    Alex.

Reply Children