We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Work with PivotGridControl

Good morning,


I have a few problems with PivotGridControl.

1. How can I edit the MultiFunctionalSortFilter. I need to allow the user to stretch it, because the data in the filters is long (proper names of products). Additionally, I need to change the color of the Ok and Cancel buttons

2. I added options using syncfusion:PivotSchemaDesigner. When the user uses the PART_DeferLayoutUpdate option, the data in PivotGrid disappears. How can I prevent this?

I will be very grateful for any help.

Kind regards


5 Replies

SJ Sathiyathanam Jeyakumar Syncfusion Team March 20, 2023 04:30 PM UTC

Hi Piotr,

Query

Comments

How can I edit the MultiFunctionalSortFilter. I need to allow the user to stretch it, because the data in the filters is long (proper names of products). 

We are a little unclear about the details provided. Specifically, we are unsure if you want to increase the size of the content in FilterPopup or if there is another item you mentioned. Could you please provide a detailed explanation, along with an image illustration? This information would be helpful for further investigation.

Additionally, I need to change the color of the Ok and Cancel buttons

You can change the background of the Ok Cancel button in a FilterPopup by using the GroupingBar.MultiFunctionalSortFilterPopup.Opened event. Refer to the code snippets below for more information.

public MainWindow()

{

    InitializeComponent();

    this.pivotGrid.Loaded += PivotGrid_Loaded;

           

}

 

private void PivotGrid_Loaded(object sender, RoutedEventArgs e)

{

    pivotGrid.GroupingBar.Loaded += GroupingBar_Loaded;

}

 

private void GroupingBar_Loaded(object sender, RoutedEventArgs e)

{

    pivotGrid.GroupingBar.AllowMultiFunctionalSortFilter = true;

    pivotGrid.GroupingBar.MultiFunctionalSortFilterPopup.Opened += MultiFunctionalSortFilterPopup_Opened;

}

 

private void MultiFunctionalSortFilterPopup_Opened(object sender, EventArgs e)

{

    LoadPopupContent(pivotGrid);

}

private static void LoadPopupContent(PivotGridControl control)

{

    var multiFilterPopup = control.GroupingBar.MultiFunctionalSortFilterPopup;

    var applyButton = multiFilterPopup.GetType().GetProperty("ApplyButton", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(multiFilterPopup) as Button;

    var cancelButton = multiFilterPopup.GetType().GetProperty("CancelButton", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(multiFilterPopup) as Button;

    applyButton.Background = new SolidColorBrush(Colors.Red);

    cancelButton.Background = new SolidColorBrush(Colors.Aqua);

}

I added options using syncfusion:PivotSchemaDesigner. When the user uses the PART_DeferLayoutUpdate option, the data in PivotGrid disappears. How can I prevent this?

We have also used DeferLayoutUpdate as true, but unfortunately, we haven't received any data disappearance issue. Could you please share the code snippets or an issue reproducible sample? It will be helpful to investigate further.

Suggestions: You can try and calling the method 'pivotGrid.InternalGrid.Refresh(true);' to populate the data again.


Regards,

Sathiyathanam


Attachment: PivotGridControl_Demo_dad87934.zip


PI Piotr replied to Sathiyathanam Jeyakumar March 20, 2023 10:28 PM UTC

I would like to add textWrap to PARTExcel_FilterPopupListBox ListBox item template (textBlock). - in my case values can be pretty long and they don't fit in popup.

2. It would be perfect if user could stretch MultiFunctionalSortFilterPopup



PI Piotr replied to Piotr March 21, 2023 07:51 AM UTC

One more problem :)

How to make PivotGrid more responsive? PivotGrid is displayed at different resolutions from 1360x768 to 4K...



SJ Sathiyathanam Jeyakumar Syncfusion Team March 21, 2023 02:49 PM UTC

Piotr,

We are currently checking the feasibility to achieve your requirement. We will update the details on March 23,2023.



SJ Sathiyathanam Jeyakumar Syncfusion Team March 22, 2023 01:49 PM UTC

Piotr,

Query

Comments

I would like to add textWrap to PARTExcel_FilterPopupListBox ListBox item template (textBlock). - in my case values can be pretty long and they don't fit in popup.

2. It would be perfect if user could stretch MultiFunctionalSortFilterPopup

 

There is no direct way to achieve your requirement. However, your requirement can be achieved by changing the ItemTemplate of the FilterListBox. Refer to the below code snippets for more information.

XAML

<Application.Resources>

    <DataTemplate x:Key="itemTemplate">

        <CheckBox IsChecked="{Binding IsSelected, Mode=TwoWay}" Foreground="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type syncfusion:PivotGridControl}}, Path=GroupingBarItemForeground}">

            <TextBlock Text="{Binding Key}" TextWrapping="Wrap" />

        </CheckBox> 

    </DataTemplate>

    <Style x:Key="listBoxStyle" TargetType="ListBox">

        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>

    </Style>

</Application.Resources>

C#

private void GroupingBar_Loaded(object sender, RoutedEventArgs e)

{

    pivotGrid.GroupingBar.AllowMultiFunctionalSortFilter = true;

    pivotGrid.GroupingBar.MultiFunctionalSortFilterPopup.Opened += MultiFunctionalSortFilterPopup_Opened;

}

 

private void MultiFunctionalSortFilterPopup_Opened(object sender, EventArgs e)

{

    LoadPopupContent(pivotGrid);

}

private void LoadPopupContent(PivotGridControl control)

{

    var multiFilterPopup = control.GroupingBar.MultiFunctionalSortFilterPopup;

    control.GroupingBar.MultiFunctionalSortFilterPopup.FilterListBox.ItemTemplate = App.Current.Resources["itemTemplate"] as DataTemplate;

    control.GroupingBar.MultiFunctionalSortFilterPopup.FilterListBox.Style = App.Current.Resources["listBoxStyle"] as Style;

    var applyButton = multiFilterPopup.GetType().GetProperty("ApplyButton", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(multiFilterPopup) as Button;

    var cancelButton = multiFilterPopup.GetType().GetProperty("CancelButton", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(multiFilterPopup) as Button;

    applyButton.Background = new SolidColorBrush(Colors.Red);

    cancelButton.Background = new SolidColorBrush(Colors.Aqua);

           

}

How to make PivotGrid more responsive? PivotGrid is displayed at different resolutions from 1360x768 to 4K...

 

Refer to the below KB to improve the performance of PivotGrid.

https://www.syncfusion.com/kb/2882/how-to-increase-the-pivot-grid-performance





Attachment: PivotGridControl_Demo_(2)_aba1a47f.zip

Loader.
Up arrow icon