I want to capture the open event when a user clicks on the "+" button for a child layout in a grid's field layout
I have a xamdatagrid with multiple layouts simulating a hierarchical layout. I want to implement lazy load on data that contribute to the child layout, since it will be an expensive operation to generate that data. Inorder to accomplish this I want to know when the user clicks on the "+" button to open the child layout. To start with i will bind some dummy data that says "Loading Please wait.." so that the "+" button appears initially. Once i receive the event when the user clicks on the "+" button i can then go ahead and construct the data set that will bind to the child layout.
I am attaching my xaml and also an image of the view as it appears now with some overlay showing what i am trying to accomplish.
<igDP:XamDataGrid Name="ApprovalsGrid" Theme="Office2k7Black" Background="Transparent" InitializeRecord="ApprovalGrid_InitializeRecord" Style="{DynamicResource PerformantGrid}" DataSource="{Binding StagingChanges}"> <igDP:XamDataGrid.Resources>
<ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="pack://application:,,,/GLM.Infrastructure.View;component/Themes/XamDataGrid.xaml" /> </ResourceDictionary.MergedDictionaries>
<Style x:Key="DetailsCellValuePresenter" TargetType="{x:Type igDP:CellValuePresenter}" BasedOn="{x:Static Themes:DataPresenterGeneric.CellValuePresenter}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}"> <Button Content="View Details" HorizontalAlignment="Center" VerticalAlignment="Center" Command="{Binding DataItem.ShowDetailsCommand}" CommandParameter="{Binding DataItem}"/> </ControlTemplate> </Setter.Value> </Setter> </Style>
<Style x:Key="CheckBoxPresenter" TargetType="{x:Type igDP:CellValuePresenter}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}"> <CheckBox HorizontalAlignment="Center" IsChecked="{Binding DataItem.IsSelected, Mode=TwoWay}" VerticalAlignment="Center"/> </ControlTemplate> </Setter.Value> </Setter> </Style>
</ResourceDictionary> </igDP:XamDataGrid.Resources>
<igDP:XamDataGrid.FieldLayoutSettings> <igDP:FieldLayoutSettings HeaderPrefixAreaDisplayMode="FieldChooserButton" AllowAddNew="False" SelectionTypeRecord="None" AllowDelete="False" AutoGenerateFields="False" RecordSelectorLocation="None" HighlightAlternateRecords="True" ReevaluateFiltersOnDataChange="True" SupportDataErrorInfo="RecordsAndCells" DataErrorDisplayMode="ErrorIconAndHighlight" DataRecordCellAreaStyle="{StaticResource HighlightedDataRecordCellAreaStyle}" ExpansionIndicatorDisplayMode="CheckOnDisplay" HeaderPlacement="OnTopOnly" HeaderPlacementInGroupBy="OnTopOnly" CopyFieldLabelsToClipboard="True" AllowClipboardOperations="All"> </igDP:FieldLayoutSettings> </igDP:XamDataGrid.FieldLayoutSettings>
<igDP:XamDataGrid.FieldSettings> <igDP:FieldSettings ExpandableFieldRecordExpansionMode="ExpandAlways" ExpandableFieldRecordHeaderDisplayMode="NeverDisplayHeader" LabelTextWrapping="NoWrap" AllowEdit="False" AllowRecordFiltering="False" LabelClickAction="SortByMultipleFields" CellValuePresenterStyle="{StaticResource CellValuePresenterStyle}"/> </igDP:XamDataGrid.FieldSettings>
<igDP:XamDataGrid.FieldLayouts>
<igDP:FieldLayout IsDefault="True">
<igDP:FieldLayout.SortedFields> <igDP:FieldSortDescription FieldName="LocalRequestTime" Direction="Ascending" /> </igDP:FieldLayout.SortedFields>
<igDP:FieldLayout.Fields>
<igDP:UnboundField Name="SelectBox" Label=""> <igDP:UnboundField.Settings> <igDP:FieldSettings CellMaxWidth="40" LabelMaxWidth="40" CellValuePresenterStyle="{StaticResource CheckBoxPresenter}"/> </igDP:UnboundField.Settings> </igDP:UnboundField>
<igDP:Field Name="ChangeId" Label="Change Id" Visibility="Collapsed"> <igDP:Field.Settings> <igDP:FieldSettings CellWidth="61" LabelWidth="61"> </igDP:FieldSettings> </igDP:Field.Settings> </igDP:Field>
<igDP:Field Name="Requester" Label="Requester"> <igDP:Field.Settings> <igDP:FieldSettings CellWidth="80" LabelWidth="80"/> </igDP:Field.Settings> </igDP:Field>
<igDP:Field Name="LocalRequestTime" Label="Request Time"> <igDP:Field.Settings> <igDP:FieldSettings CellWidth="130" LabelWidth="130" AllowEdit="False"> <igDP:FieldSettings.EditorStyle> <Style TargetType="{x:Type Editors:XamTextEditor}"> <Setter Property="Format" Value="yyyy-MM-dd HH:mm:ss" /> </Style> </igDP:FieldSettings.EditorStyle> </igDP:FieldSettings> </igDP:Field.Settings> </igDP:Field>
<igDP:Field Name="Region" Label="Region(s)"> <igDP:Field.Settings> <igDP:FieldSettings CellWidth="80" LabelWidth="80"> </igDP:FieldSettings> </igDP:Field.Settings> </igDP:Field> <igDP:Field Name="ClientSummary" Label="Client Summary"> <igDP:Field.Settings> <igDP:FieldSettings CellWidth="220" LabelWidth="220"> </igDP:FieldSettings> </igDP:Field.Settings> </igDP:Field>
<igDP:Field Name="Comment" Label="Comment"> <igDP:Field.Settings> <igDP:FieldSettings CellWidth="240" LabelWidth="240"> </igDP:FieldSettings> </igDP:Field.Settings> </igDP:Field>
<igDP:UnboundField Name="Details" Label="Details"> <igDP:Field.Settings> <igDP:FieldSettings CellWidth="70" LabelWidth="70" CellValuePresenterStyle="{StaticResource DetailsCellValuePresenter}"> </igDP:FieldSettings> </igDP:Field.Settings> </igDP:UnboundField>
<igDP:Field Name="ImpactedLimits" />
</igDP:FieldLayout.Fields> </igDP:FieldLayout>
<igDP:FieldLayout ParentFieldName="ImpactedLimits">
<igDP:FieldLayout.FieldSettings> <igDP:FieldSettings AllowRecordFiltering="False"/> </igDP:FieldLayout.FieldSettings>
<igDP:FieldLayout.Settings> <igDP:FieldLayoutSettings> <igDP:FieldLayoutSettings.DataRecordPresenterStyle> <Style TargetType="{x:Type igDP:DataRecordPresenter}" BasedOn="{x:Null}"> <Setter Property="Margin" Value="20,0,0,0"/> </Style> </igDP:FieldLayoutSettings.DataRecordPresenterStyle> </igDP:FieldLayoutSettings> </igDP:FieldLayout.Settings>
<igDP:FieldLayout.SortedFields> <igDP:FieldSortDescription FieldName="Schema" Direction="Ascending" /> </igDP:FieldLayout.SortedFields>
<igDP:Field Name="Schema" Label="Schema"> <igDP:Field.Settings> <igDP:FieldSettings CellWidth="200" LabelWidth="200"/> </igDP:Field.Settings> </igDP:Field>
<igDP:Field Name="LimitId" Label="Limit"> <igDP:Field.Settings> <igDP:FieldSettings CellWidth="90" LabelWidth="90"/> </igDP:Field.Settings> </igDP:Field>
<igDP:Field Name="Region" Label="Region"> <igDP:Field.Settings> <igDP:FieldSettings CellWidth="200" LabelWidth="200"/> </igDP:Field.Settings> </igDP:Field>
<igDP:Field Name="Clients" />
</igDP:FieldLayout.Fields> </igDP:FieldLayout> <igDP:FieldLayout ParentFieldName="Clients">
<igDP:FieldLayout.SortedFields> <igDP:FieldSortDescription FieldName="Name" Direction="Ascending" /> </igDP:FieldLayout.SortedFields>
<igDP:Field Name="Name" Label="Client"> <igDP:Field.Settings> <igDP:FieldSettings CellWidth="240" LabelWidth="240"/> </igDP:Field.Settings> </igDP:Field>
<igDP:Field Name="TNL" Label="TNL"> <igDP:Field.Settings> <igDP:FieldSettings CellWidth="90" LabelWidth="90"/> </igDP:Field.Settings> </igDP:Field>
</igDP:XamDataGrid.FieldLayouts>
</igDP:XamDataGrid>
Thanks in advance
Shahin
Hello Shahin,
Thank you for your post!
I have been looking into your issue and have created a small sample application for you. I can suggest to use the RecordExpanding and RecordExpanded events. Here is a link where you can find more information about these events: http://help.infragistics.com/Help/Doc/WPF/2013.2/CLR4.0/html/InfragisticsWPF4.DataPresenter.v13.2~Infragistics.Windows.DataPresenter.XamDataGrid_members.html.
Then a check can be made if the record that is being expanded is DataRecord or not.
In the sample application I have handled the RecordExpanding event for you to see the above mentioned functionality.
Please find the attached sample application and feel free to let me know if you have any further questions on this matter.
Hi Gergana
Thanks for the reply. It worked just fine.
Thanks