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 Chandra,
I am just checking if you require any further assistance on the matter.
Thank you for your feedback. I have been looking into your last post and in order to set the ‘FieldSettings’ of your fields in code-behind I can suggest you do it by handling the ‘FieldLayoutInitialized’ event of the XamDataGrid as it is shown in the link below :
http://help.infragistics.com/NetAdvantage/WPF/2012.2/CLR4.0/?page=xamDataPresenter_Embedding_a_xamEditor_in_a_Field.html
If you need any further assistance on this matter, feel free to ask.
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,
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.