Hi,
I want to create XamDataGrid,FieldLayout and Fields in code behind instead of Xaml.
In my Xaml file should be like this:
=========================
<Grid Name="grid"> </Grid>
Code behind :
public void Load() { x1 = new XamDataGrid();
FieldLayout fl = new FieldLayout();
//FieldLayout F1 = new FieldLayout();
//Field fieldA = new Field(); //Field fieldB = new Field();
//fieldA.Label = "FieldA"; //fieldB.Label = "FieldB";
Infragistics.Windows.DataPresenter.Field field = new Infragistics.Windows.DataPresenter.Field();
//RowDefinition row = new RowDefinition();
field.Name = "CSP"; field.Label = "Chandra";
fl.Fields.Add(field);
x1.FieldLayouts.Add(fl);
// x1.FieldLayoutInitialized += new EventHandler<Infragistics.Windows.DataPresenter.Events.FieldLayoutInitializedEventArgs>(x1_FieldLayoutInitialized);
this.grid.Children.Add(x1); }
I am calling load method from Constructor..
In my case, xamDatagrid with Column "Chandra" should come..but it is not coming..
Please let me know, where i did mistake..
Please help me..
Hello,
Thank you for your post. I have created a sample application(DataGridFieldsCodeBehind.zip) here I am adding the fields in the XamDataGrid in code-behind. If this is not your scenario, please modify my sample application in order to provide you with more accurate assistance.
Looking forward to hearing from you.
I am just checking if you require any further assistance on the matter.
Thanks for your reply.. and i used your code as reference and created Fields from code behind.
But in my case, I need to created FieldSettings for the Field which was created in Code behind.
New property need to assign for the FielSetting as FieldType= FieldType.ComboBox;
FieldType= FieldType.TextBox;
FieldType= FieldType.HyperLink;
;FieldType= FieldType.Button;
I need to do this one from code behind.
i.e need to assign new fieldSetting to the Field.
Please help to achieve this.
Everything Should done from code behind.
Thanks'
Chandra
Hello Chandra,
Hi Adogg,
I have been looking into your questions and it seems that you are discussing it with Gergana into the following forum thread:
http://ko.infragistics.com/community/forums/p/96231/475519.aspx#475519
Please create a separate forum thread for each of your new questions.
Thank you for understanding.
Anyone?
Is it required for XamDataGrid to be rendered to initialize layout? I've checked provided example and if you comment out this line
this.grid.Children.Add(xamDataGrid1);
then FieldLayoutInitialized event isn't fired.
I have a class that does loading/saving grid customizations and I want to cover it with unit tests. But when I'm creating XamDataGrid in code and try to do some saving/loading customizations, they're basically do nothing.
I have been looking through the forum thread and it seems that Stefan is working on your issue.
Please continue the discusstion with him.
Hi Yanko,
Thanks for your help.. I have raised one more question related to it.
"How to apply different types editors for dynamic fields" which is related to same.
If you have any thoughts on it ..please let me know.
Thanks in advance,
Regards,