Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
595
Have XamDataGrid like group by (with pointed arrow) headers in PivotGrid row headers/column headers/ measure headers.
posted

I wanted to have the data grid group by like (fish with pointed arrows) in XamPivotGrid row headers/column/headers. Attached below is the code that is part of the trigger that does the job in terms of ResourceSets/DataPresenter/DataPresenterAero_express.xaml How can we have something similar in the pivot grid. We don't have HasOffsetY or the first listin property. Can you guys please provide a sample if possible. Thanks so much for the help.

    <MultiDataTrigger.Conditions>
                                                                <Condition Binding="{Binding Path=(Field).(igDP:GroupByAreaMulti.HasOffsetY), RelativeSource={RelativeSource Self}}" Value="False"/>
                                                                <Condition Binding="{Binding Path=IsInGroupByArea, RelativeSource={RelativeSource Self}}" Value="True"/>
                                                        </MultiDataTrigger.Conditions>
                                                        <Setter TargetName="labelCntr" Property="Margin" Value="-24,0,0,0"/>
                                                </MultiDataTrigger>

                                                <MultiDataTrigger>
                                                        <MultiDataTrigger.Conditions>
                                                                <Condition Binding="{Binding Path=(Field).(igDP:GroupByAreaMulti.HasOffsetY), RelativeSource={RelativeSource Self}}" Value="False"/>
                                                                <Condition Binding="{Binding Path=IsInGroupByArea, RelativeSource={RelativeSource Self}}" Value="True"/>
                                                                <Condition Binding="{Binding Path=(Field).(igDP:GroupByAreaMulti.IsFirstInList), RelativeSource={RelativeSource Self}}" Value="False"/>
                                                        </MultiDataTrigger.Conditions>
                                                        <Setter TargetName="sortIndicatorAndLabel" Property="Margin" Value="20,0,0,0"/>
                                                </MultiDataTrigger>

                                                <DataTrigger Binding="{Binding Path=(Field).(igDP:GroupByAreaMulti.IsFirstInList), RelativeSource={RelativeSource Self}}" Value="True">
                                                        <Setter TargetName="labelCntr" Property="Margin" Value="0"/>
                                                </DataTrigger>

  • 34510
    Verified Answer
    Offline posted

    Hi Anand,

    I don't think you need to worry too much about those properties.  In the XamDataGrid, it's just overlapping the LabelPresenters in the groupby area so you can probably mimic something like that in the pivot grid.  The tricky part is going to be with the StackPanel that is uses.  Currently the rows/column/measure areas in the pivot grid use a StackPanel to horizontally align the FilterFieldItemControls.  This makes overlapping the FilterFieldItemControls difficult because the order that the items appear in the panel is determined by their order in the StackPanel, so items added first will appear on the left side and newly added items will appear after it to the right.  This order means that if you try to overlap the items, the item to the right will render on top of the item to the left.  In the XamDataGrid it uses a custom panel to place the items in the correct position but also the correct rendering order so that items to the left will overlap items to the right and create that fish look.

    I'm not really sure how you would go about changing how the StackPanel in the pivot grid behaves (you will probably need to create your own custom panel) but I can show you where the StackPanel is.  Inside the pivot grid default styles, there is a style for "igPivotPrim:RowsFieldDropAreaControl".  This style has a setter for ItemsPanel and inside this setter it is creating the StackPanel.  You would have to replace this StackPanel with your own custom panel.  Make sure to keep the DragDropManager code as well as the igPivot:XamPivotGrid.PivotPartType="Rows" attached property so you don't lose the drag drop functionality.

    Once you have the panel setup and rendering the items correctly you can retemplate the FilterFieldItemControl and add a arrow/fish head to the front of it.  Then apply a margin to the FilterFieldItemControl in order to force the overlap to occur.  That's what that XamDataGrid trigger you showed is doing.