Hello
I have currently coded based on sample http://labs.infragistics.com/silverlight/lobsamples/2010.3/#/Samples/Grid/ColumnSettings/GridTemplateColumnLayout
Is it possible to have a grid in the DataTemplate?
Can I use Grid within to show the details
How would i refer to that grid
Hi,
Yes, it would be possible to put a nested xamGrid inside the TemplateColumnLayout.
Although you might have some performance issues as the objects in the TemplateColumnLayout are virtualized, and since we don't know about the objects in there, no state is kept. So each time you scroll one into view, it'll be re-loaded.
As for accessing the controls in the TemplateColumLayout. It's not really recommended, as they are virtualized/recycled. So any changes you make would potentially be displayed in another cell when it's scroll into view.
Is there a reason you don't want to use a normal columnLayout to display your data?
-SteveZ
The reason not to use normal layout is due to formatting
I need it to be formatted as grid
There are almost 20-30 columns that we have and not all need to be edited so non editable can be kept as Template columns
IfI use template column layout it does not recognise nested grid
Can you provide how that would look?
The xaml would look something like this:
<ig:XamGrid.Columns>
<ig:TemplateColumnLayout Key="Authors">
<ig:TemplateColumnLayout.Template>
<DataTemplate>
<ig:XamGrid Height="200" ItemsSource="{Binding Authors}"/>
</DataTemplate>
</ig:TemplateColumnLayout.Template>
</ig:TemplateColumnLayout>
</ig:XamGrid.Columns>
Note: the DataContext is the row's Data.
So can I give
In original grid
<ig:TemplateColumnLayout Key="ID" Template="{StaticResource DataRowTemplate}" />
In expansion as
<DataTemplate x:Key="DataRowTemplate"> <ig:XamGrid ItemsSource="{Binding ID}"/>
And can I give set of columns in the nested xamgrid that I need?
Ah,
Ok, i understand now.
However, the xamGrid needs an ItemsSource. so you won't be able to to bind it to a single row that doesn't belong to a collection.Unless you exposed another property on your data object, that would be a collection that contains 1 item, which would be itself.
Or, depending on how you want to display your data, you could simply use a horizontal ListBox, Grid panel, or event a StackPanel to display your other properties and have the bindings hard coded in the DataTemplate.
I have multiple column and ColumnLayout is showing it one below the other
I just want extra columns of same row to be displayed in the expansion
Is that doable?
Yes, you can specify the Columns in the nested xamGrid.
But you can also do the same with ColumnLayouts. Is there a reason you're not just using a ColumnLayouts? The xamGrid does support hiearchy.