Home Forums WPF controls Xceed DataGrid for WPF Expand or collapse Groups programmatically

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • User (Old forums)
    Post count: 23064
    #23104 |


    After struggling i finally found how to do a couple of things programmatically,
    There is however, a thing i didn’t manage to find any info about.

    Is it possible to expand/collapse the groups, not with the mouse but by code ?

    They always start by being expanded, not collapsed,

    I would like them to start collapsed so the user doesn’t have to use mouse wheel,
    but rather expand them as needed.

    (You can past this code to have a small grid filled up already)

    Dim DataTableTest As System.Data.DataTable = New DataTable(“zzz”)

    Dim DataRowTest As System.Data.DataRow
    Dim DataColumn1 As DataColumn = New DataColumn(“ezez”)
    Dim DataColumn2 As DataColumn = New DataColumn(“zez”)
    Dim DataColumn3 As DataColumn = New DataColumn(“ez”)


    Dim i = 10
    Dim con = 1

    Do Until con = i
    DataRowTest = DataTableTest.NewRow()

    DataRowTest(“ezez”) = “ezaz”
    DataRowTest(“zez”) = “ezaz”
    DataRowTest(“ez”) = “ezaz”

    con += 1


    Dim ds As DataSet = New DataSet()

    OrdersGrid.ItemsSource = ds.Tables(“zzz”).DefaultView

    Dim s As New PropertyGroupDescription(“ez”)

    s.StringComparison = StringComparison.OrdinalIgnoreCase
    Dim s1 As New PropertyGroupDescription(“ezez”)

    s1.StringComparison = StringComparison.OrdinalIgnoreCase


    I haven’t found method ot property related to expand or collapse …

    Thanks for your help 😀

    Imported from legacy forums. Posted by Aybe (had 2465 views)

    Xceed Support
    Post count: 5658

    It is not possible at the moment to systematically collapse a group programatically…

    If you know the GroupHeaderControl for the Group has been realized… you can call DataGridControl.GetContainerFromItem( myGroup) and from there, access the Group.IsExpanded property… But that would only work if the GroupHeaderControl is realized (not scrolled out of view).

    Imported from legacy forums. Posted by Marcus [Xceed] (had 305 views)

    User (Old forums)
    Post count: 23064

    hello Marcus,

    I have been trying what you said but i can’t access nor modify this property.

    Referring to the help, it is as follows :

    Dim instance As Group
    Dim value As Boolean

    instance.IsExpanded = value
    value = instance.IsExpanded

    This works but produces nothing because it’s not assigned to anything.
    I have been looking at the doc a few hours but did not understand
    how to assign the examples to Control in my app…

    I want to be able to control the behavior not thru XAML but VB.

    How do you assign that Group to one of the GroupDescriptions ??

    Thank you, 😀

    Imported from legacy forums. Posted by Aybe (had 4010 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.