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
665
UnhandledException when InitializeRecordEvent set record visibility to collapsed
posted

If I set the DataRecord to Collasped in a InitializeRecordEvent handler I will get intermittent hidden records and  UnhandledExceptions at the application level when scrolling the window. Has anyone seen this?

I am using 9.1.

/*****************Handler**************/

   private void PlanGridRecordInit(object sender, InitializeRecordEventArgs e)
        {
            DataRecord rec = e.Record as DataRecord;
            Infragistics.Windows.DataPresenter.CellCollection cells = rec.Cells;
            double RelNo = double.Parse(cells["RelNo"].Value.ToString());
           
            if (currentRelease != 0&& RelNo != currentRelease)
                rec.Visibility = Visibility.Collapsed;
            else
                rec.Visibility = Visibility.Visible;

        }

/******************XAML*********************************/

                <igDP:XamDataGrid  Grid.Row="3" Drop="PlanListDrop" PreviewKeyUp="PlanListXFind" Name="PlanListX" EditModeEnded="PlanChanged" 
                                  SelectedItemsChanged="PlanListXSelectionChanged" Theme="Aero" AllowDrop="True"  Background="LightGoldenrodYellow"
                                  RecordsDeleted="DeletedRecord" RecordsDeleting="DeletingRecord"
                                  GroupByAreaLocation="None" FontSize="9" InitializeRecord="PlanGridRecordInit" Loaded="PlanXLoaded">
                    <igDP:XamDataGrid.FieldSettings>
                        <igDP:FieldSettings  CellHeight="19"  LabelHeight="18"  LabelClickAction="Nothing"/>
                    </igDP:XamDataGrid.FieldSettings>
                    <igDP:XamDataGrid.Resources>

                        <Style TargetType="{x:Type igDP:DataRecordCellArea}">
                            <Setter Property="BackgroundActive">
                                <Setter.Value>
                                    <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                        <GradientStop Color="LightSalmon" Offset="0"/>
                                        <GradientStop Color="White" Offset="1"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="BorderActiveBrush" Value="#FF000000"/>
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Record.DataItem.Operation}" Value="{x:Null}">
                                    <Setter Property="Background" Value="LightSteelBlue" />
                                </DataTrigger>
                                <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Record.DataItem.Operation}" Value="100">
                                    <Setter Property="Background" Value="LightSteelBlue" />
                                </DataTrigger>
                                <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Record.DataItem.InUse}" Value="True">
                                    <Setter Property="Background" Value="Red" />
                                    <Setter Property="Foreground" Value="White" />
                                </DataTrigger>
                                <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Record.DataItem.Status}" Value="D">
                                    <Setter Property="Background" Value="Black" />
                                    <Setter Property="Foreground" Value="White" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>

                        <Style TargetType="{x:Type igEditors:XamNumericEditor}" BasedOn="{StaticResource XamNumericEditor}" >
                            <Setter Property="HorizontalContentAlignment" Value="Left" />
                        </Style>
                        <ContextMenu x:Key="RecordContextMenu">
                            <MenuItem Header="Request Preq" Click="RequestPreqClick" />
                            <MenuItem Header="Copy OD and Wall Down" Click="CopyODWallDown" />
                            <MenuItem Header="Clear OD and Wall Down" Click="ClearODWallDown" />
                            <MenuItem Header="Copy QtyPln and QtyU Down" Click="CopyPlnDown" />
                            <MenuItem Header="Clear QtyPln and QtyU Down" Click="ClearPlnDown" />
                            <MenuItem Header="Copy Length Down" Click="CopyLengthDown" />
                            <MenuItem Header="Clear Length Down" Click="ClearLengthDown" />
                            <MenuItem Header="Create New Product" Click="newProduct_Click" />
                            <MenuItem Header="Compare Product Revs" Click="ProductCompare_Click" />
                        </ContextMenu>
                        <ContextMenu x:Key="OrdNumMenu">
                            <MenuItem Header="Show Schedule" Click="ShowSchedClick" />
                        </ContextMenu>
                        <Style TargetType="{x:Type igDP:CellValuePresenter}">
                            <Setter Property="ContextMenu" Value="{StaticResource RecordContextMenu}" />
                            <Setter Property="BackgroundSelected" Value="LightGray"/>
     
                        </Style>


                    </igDP:XamDataGrid.Resources>
                    <igDP:XamDataGrid.FieldLayoutSettings>
                        <igDP:FieldLayoutSettings AllowAddNew="False" AddNewRecordLocation="OnBottom" 
                                              HighlightAlternateRecords="True" />
                    </igDP:XamDataGrid.FieldLayoutSettings>
                  
                </igDP:XamDataGrid>