Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
470
Failure to use XamDataGrid as part of DataTemplate.
posted

 

I bound standard ListBox to ObservableCollection<XmlDataProvider>, then set:

 

<ListBox ItemTemplate="{StaticResource SimpleDataTemplate}">

 

"SimpleDataTemplate" is defined as follows:

 

<DataTemplate x:Key="SimpleDataTemplate" DataType="XmlDataProvider">

<DockPanel Name="mdockElementHolder">

                <igDP:XamDataGrid DataSource="{Binding XPath=//Elements/Element}"

                                        AutoFit="True"

                                        GroupByAreaLocation="None"

                                        ScrollingMode="Immediate"

                                        RecordLoadMode="PreloadRecords"

                                        RecordContainerGenerationMode="PreLoad"

                                        CellContainerGenerationMode="PreLoad">

 

...

 

I also implemented manual field layout of XamDataGrid:

<igDP:XamDataGrid.FieldLayouts>

                        <igDP:FieldLayout Key="Key_Elements" >

                            <igDP:FieldLayout.Settings>

                                <igDP:FieldLayoutSettings DataRecordCellAreaStyle="{StaticResource TopItemRecordCellAreaStyle}">

                                    <igDP:FieldLayoutSettings.DataRecordCellAreaGridTemplate>

                                        <ItemsPanelTemplate>

                                            <Grid>

                                                <Grid.ColumnDefinitions>

                                                    <ColumnDefinition Width="200" />

                                                    <ColumnDefinition Width="50" />

                                                    <ColumnDefinition Width="250" />

                                                </Grid.ColumnDefinitions>

                                                <Grid.RowDefinitions>

                                                    <RowDefinition />

                                                    <RowDefinition />

                                                    <RowDefinition />

                                                </Grid.RowDefinitions>

                                            </Grid>

                                        </ItemsPanelTemplate>

                                    </igDP:FieldLayoutSettings.DataRecordCellAreaGridTemplate>

                                </igDP:FieldLayoutSettings>

                            </igDP:FieldLayout.Settings>

                            <igDP:FieldLayout.Fields>

                                <igDP:Field Name="Name" Label="NAME" Column="0" Row="0" DataType="{x:Type sys:String}">

                                </igDP:Field>

 

                                <igDP:Field Name="DataType" Label="TYPE" Column="1" Row="0" DataType="{x:Type sys:String}">

                                </igDP:Field>

 

                                <igDP:Field Name="IsSelected" Label="Is Selected" Column="1" Row="1" DataType="{x:Type sys:String}" Visibility="Hidden">

                                </igDP:Field>

 

                                <igDP:Field Name="IsSortBy" Label="Is Sort By" Column="0" Row="1" DataType="{x:Type sys:String}">

                                </igDP:Field>

 

                                <igDP:Field Name="Description" Label="DESCRIPTION" Column="0" Row="3" ColumnSpan="2" DataType="{x:Type sys:String}">

                                </igDP:Field>

 

                                <igDP:Field Name="Condition" Label="Condition" Column="2" Row="0" RowSpan="3" DataType="{x:Type sys:String}">

                                </igDP:Field>

                            </igDP:FieldLayout.Fields>

 

                        </igDP:FieldLayout>

                    </igDP:XamDataGrid.FieldLayouts>

 

Form constructor instantiates ObservableCollection and adds few XmlDataProviders.

 

Problem arises when this form is shown. Only first ListBoxItem contains properly formatted XamDataGrid. All other ListBoxItems show blank XamDataGrid.

 

What am I doing wrong?

 

Thank you