Home Forums WPF controls Xceed DataGrid for WPF Auto-hide/show GroupByControl

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #24706 |

    I am trying to style the grid to my needs, with of course a nice compact data grid with lots of options. The grouping feature is fantastic but it requires the bulky interface element to sit on top all the time. I can style the GroupByControl of course, but it would be even better if the GroupByControl would be invisible, unless the user wants to use it.

    In terms of user interface, the GroupByControl should be visible if there is an active grouping (this.GroupLevelDescriptions.Count > 0) or if the user is dragging a column header. It should be invisible otherwise. The nicest would be if it would appear with a smooth animation and all, but that’s not the issue I am having.

    I can easily detect if there is a grouping or not, and detecting when that changes is also doable, but I can’t find a way to detect column header dragging (ColumnManagerCell dragging).

    Can anyone give me some pointers? (or a full-fledged solution 🙂 )

    Thanks a bundle in advance

    Imported from legacy forums. Posted by Frans (had 657 views)

    User (Old forums)
    Member
    Post count: 23064

    check for ColumnManagerCell.IsBeingDragged

    Imported from legacy forums. Posted by nat (had 340 views)

    User (Old forums)
    Member
    Post count: 23064

    I would like to, but I don’t know how I can access these objects. (They seem to be ‘hidden’ away behind a data template in the grid.view.headers property.. unsure how to go about this.)

    I could get events from the property using DependencyTypeDescriptor functionality, once I can enumerate the ColumnManagerCells. (like http://serialseb.blogspot.com/2007/08/wpf-tips-5-receive-notifications-for.html )

    Of course, for a really clean solution then, I would also need to find out when ColumnManagerCells are added to and removed from the ColumnManagerRow.

    Imported from legacy forums. Posted by Frans (had 371 views)

    User (Old forums)
    Member
    Post count: 23064

    What you can do is to hook up a trigger of this property to set GroupByControl’s visibility

    Imported from legacy forums. Posted by nat (had 367 views)

    User (Old forums)
    Member
    Post count: 23064

    Ah right, I am left wondering how I can communicate this state back to the datagrid. I would come this far:

    <Style TargetType=”{x:Type xceed:ColumnManagerCell}”>
    <Style.Triggers>
    <Trigger Property=”IsBeingDragged” Value=”True”>
    <Setter …. />
    </Trigger>
    </Style.Triggers>
    </Style>

    I have no idea how to propagate the state back to the datagrid. (Maybe I am blind to some function of xaml, I’ve been out of the game for a bit due to project switching.)

    oh and I typoed in a previous post, DependencyTypeDescriptor should be DependencyPropertyDescriptor.

    Thanks for your help (-:

    Imported from legacy forums. Posted by Frans (had 377 views)

    User (Old forums)
    Member
    Post count: 23064

    You can set some of your own property. You can even try to set TagProperty at DataGridControl level. Then set another trigger at GroupByControl to be triggered by TagProperty of DataGridControl.

    Imported from legacy forums. Posted by nat (had 256 views)

    User (Old forums)
    Member
    Post count: 23064

    I know what you mean, but then either one of the following scenario’s must be doable and I don’t know how to implement it:

    <style TargetType=”{x:Type xcdg:DataGridControl}”>
    <trigger …..>
    <setter …/>
    </trigger>
    </style>

    Above scenario: how do I trigger on any ColumnManagerCell’s properties? how can I reach them? The setter is no problem, I already have some plumbing in place for that.

    <Style TargetType=”{x:Type xceed:ColumnManagerCell}”>
    <Style.Triggers>
    <Trigger Property=”IsBeingDragged” Value=”True”>
    <Setter …. />
    </Trigger>
    </Style.Triggers>
    </Style>

    Above scenario: how do I set a property on the greatgrandparent? I can still look further for this answer in general xaml books and blogs…

    Alternatively, I can get notifications via the DependencyPropertyDescriptor, if only I could enumerate the ColumnManagerCells.

    Another option is to override quite some classes or overriding the control template altogether, but I would very much prefer a less involving solution.

    Imported from legacy forums. Posted by Frans (had 397 views)

    User (Old forums)
    Member
    Post count: 23064

    If it’s really difficult, just set up property change event handler on ColumnManagerCell.

    Imported from legacy forums. Posted by nat (had 5729 views)

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