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.
Need extra support?

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

Learn More

Forum Channels