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>
Hi alex..
thanks for ur reply.
can u please give some sample code any one of these..
i dont know how to use xamnumericeditor in the field...
thanks in advance.
thanks for ur reply..can u please give some sample code for the first way or second way...
when i enter numeric value in the cell it should accept between 1 and 50..
please give reply..
Thank u in advance...
In this case, I could go couple of ways:
1. You can set ValueConstraint property (create a style for the ValueEditor (i.e. XamNumericEditor)) in the Field and set Max and Min~Exclusice/Inclusive.
2. You can also handle the EditModeEnded event to check for the value of the cell.
3. You can create a converter (IValueConverter) and perform this logic there.
Hope this helps,
Alex.
Hi Alex..
Thanks for ur quick reply..my all problems solved.it works fine..
one more doubt..when i enter data in field the value sholud be between 1 and 100.
how can i write this condition in <igDP:fiedsettings />..
or else i have to write in c# code??
can u suggest some answer..
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.