Hi,
I want to set the Grid using Code behind. (nothing to use Grid Designer, *.cs file).
Setting operations like blow function.
1. Setting Column
1.1 Set the Column Head to Multi-Lines (2~3 Level)
1.1 Set the Column (Title/Width/Datatype/Fixed Columns)
2. Data Binding to Grid
2.1 if i set Multi-Columns Head, How can i set Data to Grid Cells.
Would you Help me the example or sample?
Thanks
Hello,
I need to implement Drag-drop in hierarchical XamDataGrid with multiple Fieldlayouts and I was trying to refer this post.
I can't make attached sample work on my machine for some reason.
Can you please modify it and upload again?
Thanks,
Priya
I am very glad that the approach I have suggested was helpful for you. Please let me know if you need any further assistance on the matter.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support
Hello. Krasimir
your assistance is very helpful for me.
I solved questions.
thank you for your help.
Thank you for your reply. I have been looking into the scenario that you have described and you can create the DataTemplate and the style using the FrameworkElementFactory object instead of parsing a sting. Here is an example of changing the method that creates the style for the LabelPresenter, the same way you can change the method for creating the data template for the XamGrid’s headers:
C#:
public Style CreateDataGridHeaderStyle(List<string> strings) { Style style = new Style(typeof(LabelPresenter)); DataTemplate dataTemplate = new DataTemplate(); FrameworkElementFactory fef = new FrameworkElementFactory(typeof(StackPanel)); foreach(string item in strings) { FrameworkElementFactory text = new FrameworkElementFactory(typeof(TextBlock)); text.SetValue(TextBlock.TextProperty, item); fef.AppendChild(text); } dataTemplate.VisualTree = fef; style.Setters.Add( new Setter(LabelPresenter.ContentTemplateProperty, dataTemplate)); return style; }
Please let me know if you need any further assistance on the matter.
Hello, thanks for your help.
I think your understanding is right.
I see your sample code, but I do not want to use xaml syntactics.
If I expand my intention, I get the xamgrid column setting variables at another place(?).
In this environment,
at the run-time, I load the xamgrid column setting variables
and then dynamically set the xamgrid column (column count, column header text(header template apply), column setting(textcolumn, checkboxcolumn...))
Please let me know the way ....