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
305
Hide N/A Columns from the Xampivot Grid & Row Names Style
posted

Hi Team,

Expected Result : XamPivot Grid should not display N/A columns & required row names should be bold 

Actual Scenario : 

I have created a dynamic data with help of datatable 

1. The DataTable has rows with spaces (row with spaces are used to create a separation )  observe the rows below row - Nissan

the N/A column is shown in such a way with 0 Values.

Price N/A
Cars 5
    Ford 10
    Ferrari 25
    Nissan 20
0
0
0
Bikes 5
    Honda 6
    Yamaha 4

Is there anyway to eliminate this column. i dont want to make the PivotDataColumn's IsVisible=false

I want it to eliminate if permanently from getting displayed.

Additionally i want to apply style to the row cell making it bold.

I tried this code on LayoutLoaded()

------------------------------------------------------------------------------------

Style s = new Style(typeof(PivotRowHeaderCellControl));
s.Setters.Add(new Setter(FontWeightProperty, FontWeights.Bold));

------------------------------------------------------------------------------------

but cell background looses its default black color

I want to make the name bold and white in color.

oh hover the cell becomes completely white. 

please help me over the styling part too.

Sincerely,

Pratik 

  • 29105
    Suggested Answer
    Offline posted

    Hello Pratik,

    The pivot grid supports hiding columns by setting the IsVisible property as you mentioned but removing it entirely would require you to refactor your backing data model to include another property to be inserted between Cars and Bikes so that your not adding extra rows to Cars. This will ultimately eliminate the issue altogether.

    Here are a couple topics with walkthroughs on how to format and apply custom DataTemplates to the cells:

    http://help.infragistics.com/doc/WPF/2015.2/CLR4.0/?page=xamPivotGrid_Customizing_Cells_with_Templates_Overview.html

    http://help.infragistics.com/doc/WPF/2015.2/CLR4.0/?page=xamPivotGrid_Customizing_Cells_with_Templates.html

    Let me know if you have any questions regarding this matter.