Hello,
I need to display an array with a random amount of headers and lines.
I can have 2 to 20 columns and 10 to 200 lines.
So I need to be able to bind a list of headers and lines, all objects are in strings.
I already have another xamDatagrid with custom xaml style, so I would like to re-use it.
Thnaks for your help.
Regards
Thank you for your post.
I have been looking into it, but it seems like I am missing something about your scenario, so if this is still an issue for you, could you please send me, an isolated sample project, where this is reproduced, so I can investigate it further for you.
Looking forward to hearing from you.
The context of my project is :
I have two IEnumerables with string :
IEnumerable<string> Lines { get; } IEnumerable<string> Headers { get; }
In Headers, I have : "","Header1","Header2"
In Lines, I have : "10","Value1",Value2" // "15","Value3","Value4"
I want to display the grid with Headers as heards and Lines as rows with values.
To bind Headers only for columns title, and Lines for the content.
I can't give you a little solution.
I have been looking into it.
In order to be able to bind the Label of XamDataGrid to property in your view model, what I can suggest is to take a look at the following forum thread:
http://www.infragistics.com/community/forums/t/72692.aspx
where similar functionality was discussed. Basically you can create style for LabelPresenter for each field by using LabelPresenterStyle. You can set property ContentTemplate and create DataTemplate with TextBlock in it. Than you can bind Text property of TextBlock to element from your IEnumerable collection from your view model. Please let me know if I am missing something about your scenario.
The following code snippet illustrate this scenario:
<Style TargetType="{x:Type igWPF:LabelPresenter}">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock Text="{Binding Source={StaticResource viewModel},Path=Headers[2]}"/>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
Please let me know if you need any further assistance on the matter.
I am just checking if there is anything else I can do for you.
I'm able to do binding like this :
<igdp:XamDataGrid.FieldLayouts> <igdp:FieldLayout> <igdp:FieldLayout.Fields> <igdp:Field Name="Angle1" Width="50" Label="{Binding Headers[0]}"/> <igdp:Field Name="Angle2" Width="50" /> <igdp:Field Name="Angle3" Width="50" /> </igdp:FieldLayout.Fields> </igdp:FieldLayout> </igdp:XamDataGrid.FieldLayouts>
Headers is an IEnumerable of string.
Fields are in one object with 3 values : Angle1, Angle2, Angle3.
Now, I want one object with a list of Angle and Bind to the view.
Like for one field :
<igdp:Field Name="Angles[0]"Width="50"Label="{Binding Headers[0]}"/>
or
<igdp:Field Name="Angles"Width="50"Label="{Binding Headers[0]}"/>
I have a Lines property, with all angles so it's possible to use it in the Name property.
Thanks for your help
Thank you for your feedback.
I am very glad that you have managed to resolve your issue. Please let me know if you need any further assistance on the matter.
I manage to do a 1 to 1 binding.
In my object I have two properties, it's possible to setup two fields for each one.
Now I have a list of objects. I want to display enough columns for each objects.
I can have 10 to 100 items, I want to display all items.
I work with MVVM, so maybe some code-behind will help me to do what I want ?