Treeview BindingMode.TwoWay

Posted by: kbj on 30 December 2023, 6:09 pm EST

  • Posted 30 December 2023, 6:09 pm EST - Updated 30 December 2023, 6:16 pm EST

    In the following form with a treeview named tv and a button Button1:

    Imports System.ComponentModel
    Imports C1.Win.TreeView
    Public Class Form1
        Private root As New classData
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            tv.SuspendLayout()
            root.children.Add(New classData)
            Text = root.children.Count
        End Sub
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            tv.BindingInfo.DataSource = root.children
            tv.BindingInfo.DataMember = "children"
            tv.BindingInfo.BindingMode = BindingMode.TwoWay
        End Sub
    End Class
    Public Class classData
        Public Property children As New BindingList(Of classData)
    End Class

    When adding the second record.

  • Posted 1 January 2024, 12:39 pm EST

    Note: this only happens when

    tv.BindingInfo.BindingMode = BindingMode.TwoWay

  • Posted 2 January 2024, 7:50 am EST

    Hi Kingman,

    Thank you for providing the sample code. We could see the behavior you mentioned on our end. We have shared the observations with the development team to get their insights on it and will let you know the updates as soon as possible.

    In the meantime, as a workaround, you can wrap the code to add the new node between the BeginUpdate and EndUpdate method calls. It resolved the behavior on our end. Please refer to the attached sample project for reference.

    Attachment: TreeView.TwoWayBinding.zip

    [Internal Tracking ID: C1WIN-31518]

    Best Regards,

    Kartik

  • Posted 10 September 2024, 7:17 am EST

    Hi Kingman,

    We are glad to let you know that this issue has been fixed in the latest 2024v1 (672) HF2 release.

    Best Regards,

    Kartik

Need extra support?

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

Learn More

Forum Channels