FlexGrid indexed properties null exception

Posted by: info on 23 April 2021, 10:19 pm EST

  • Posted 23 April 2021, 10:19 pm EST

    Hello.
    I have 2 issues.

    C1.WPF.Grid.Ja 5.0.20203.37
    .NET5

    1. Sort of DataGrid is OK. FlexGrid sort throws null exception.

    DataGrid
                    <DataGridTemplateColumn
    Width="140"
    CanUserSort="True"
    Header="MembersB[2] 2"
    SortMemberPath="MembersB[2].Name">
    <DataGridTemplateColumn.CellTemplate>
    <DataTemplate>
    <TextBox Text="{Binding Path=MembersB[2].Name, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}">
    <TextBox.Style>
    <Style TargetType="{x:Type TextBox}">
    <Style.Triggers>
    <!-- https://stackoverflow.com/a/15567948/9924249 -->
    <DataTrigger Binding="{Binding Path=MembersB[2].Name.Length, FallbackValue=0, TargetNullValue=0}" Value="0">
    <Setter Property="Foreground" Value="Red" />
    </DataTrigger>
    </Style.Triggers>
    </Style>
    </TextBox.Style>
    </TextBox>
    </DataTemplate>
    </DataGridTemplateColumn.CellTemplate>


    FlexGrid

                    <c1:GridColumn
    Width="140"
    AllowSorting="True"
    Header="MembersB[2] 2"
    SortMemberPath="MembersB[2].Name">
    <c1:GridColumn.CellTemplate>
    <DataTemplate>
    <TextBox Text="{Binding Path=MembersB[2].Name, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}">
    <TextBox.Style>
    <Style TargetType="{x:Type TextBox}">
    <Style.Triggers>
    <DataTrigger Binding="{Binding Path=MembersB[2].Name.Length, FallbackValue=0, TargetNullValue=0}" Value="0">
    <Setter Property="Foreground" Value="Red" />
    </DataTrigger>
    </Style.Triggers>
    </Style>
    </TextBox.Style>
    </TextBox>
    </DataTemplate>
    </c1:GridColumn.CellTemplate>
    </c1:GridColumn>


    fig1.

    2.
    When one of indexed properties is null for FlexGrid, null exception is thrown.
    DataGird is OK.

    ex:
    Row1: MembersB[1] = p1;
    Row2: MembersB[1] = p2;
    Row3: MembersB[1] is null

    fig2.

    Could you fix these exceptions?
    IndexedBindingStudy.zip
  • Replied 25 April 2021, 11:08 pm EST

    Hi Mikihiro,

    Thank you for reporting.

    These behaviors seems like a bug in our control so I have escalated them to the devs. I'll get back to you once there is any update regarding the same. (Internal Tracking Id - C1XAML-27384)

    Best Regards,
    Kartik
  • Replied 26 April 2021, 6:31 pm EST

    Thank you for your reply. I will wait for fix.
  • Replied 12 May 2021, 2:43 pm EST

    Hi Mikihiro,

    I apologize for the delay.

    This was a bug with the FlexGrid's dependency i.e C1DataCollection which has been fixed with the latest build (1.0.20211.35).

    So, I would request you to install the latest NuGet package for C1.WPF.DataCollection and C1.DataCollection.BindingList. Please refer to the same from the attached modified sample. (see IndexedBindingStudy_Mod.zip)

    However, the exception is still thrown with the latest build but it is catch internally. JFYI, it will also be fixed in the upcoming release (2021v2) where no exception will be thrown.

    Best Regards,
    Kartik

    IndexedBindingStudy_Mod.zip
  • Replied 17 May 2021, 11:35 am EST

    Thank you very much. I will wait for the fix.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels