ComponentOne FlexPivot for WinForms
C1.Win.FlexPivot.Slicer.4.5.2 Assembly / C1.Win.FlexPivot Namespace / C1FlexPivotSlicer Class
Members

In This Topic
    C1FlexPivotSlicer Class
    In This Topic
    Provides simple interface to filter a C1.PivotEngine.PivotField.
    Object Model
    C1FlexPivotSlicer Class
    Syntax
    'Declaration
     
    Public Class C1FlexPivotSlicer 
       Inherits C1.Framework.XViewHost
       Implements C1.Win.FlexPivot.Design.IFlexPivotDataSource 
    public class C1FlexPivotSlicer : C1.Framework.XViewHost, C1.Win.FlexPivot.Design.IFlexPivotDataSource  
    Remarks

    The C1FlexPivotSlicer class help you initialize an instance of the FlexPivotSlicer control and define its behavior using the following properties:

    • Bind the FlexPivotSlicer control to the FlexPivotPanel that provides data for the control, using the DataSource property. 
    • Specify the field in the data source which is to be filtered using the Field property. The Field property is of the type C1FlexPivotField class. The C1FlexPivotField class provides properties, which can be used to specify additional settings for the C1FlexPivotField object such as the formatting for the field values, custom text that should be displayed in the UI corresponding to the field name etc.
    • Hide or show checkboxes next to each item in the list using the ShowCheckBoxes property.
    • Set the sort order for the list items through code using the SortOrder property. 
    • Enable/disable the multiple selection from the list using the MultiSelect property. 
    • When multiple selection is enabled, the Select All/Unselect All checkbox is displayed at the top of the list, the visibility of this option can be altered using the ShowSelectAll property. 
    • Toggle the visibility of the complete header area or the multi-select, clear filter and sort buttons displayed in the header using the ShowHeaderShowMultiSelectShowClear and ShowSort properties respectively.
    • Customize the appearance of the FlexPivotSlicer control and the different visual elements it is composed of such as the header and the list with the help of the Styles property. This property is of the type SlicerStyles class.
    Example
    C#
    Copy Code
    private void Form1_Load(object sender, EventArgs e)
            {
                OleDbConnection con = new OleDbConnection("Provider=microsoft.jet.oledb.4.0;Data source=" + Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\ComponentOne Samples\\Common\\C1NWind.mdb");
                DataTable dt = new DataTable();
                new OleDbDataAdapter("Select * from Invoices", con).Fill(dt);
    
                //Configure the FlexPivotPage control
                c1FlexPivotPage = new C1FlexPivotPage();
                c1FlexPivotPage.Dock = DockStyle.Fill;
                c1FlexPivotPage.DataSource = dt;
               c1FlexPivotPage.FlexPivotEngine.RowFields.Add("Country");
               c1FlexPivotPage.FlexPivotEngine.ValueFields.Add("ExtendedPrice");
                splitContainer1.Panel1.Controls.Add(c1FlexPivotPage);
     IntializeFlexPivotSlicer();
            }
    private void IntializeFlexPivotSlicer()
            {
                //Initialize the FlexPivotSlicer control
                C1FlexPivotSlicer c1FlexPivotSlicer = new C1FlexPivotSlicer();
                c1FlexPivotSlicer.Dock = DockStyle.Fill;
                splitContainer1.Panel2.Controls.Add(c1FlexPivotSlicer);
    
                c1FlexPivotSlicer.DataSource = c1FlexPivotPage.FlexPivotPanel; //Sets the data source of the FlexPivotSlicer
                c1FlexPivotSlicer.Field = c1FlexPivotPage.FlexPivotEngine.Fields["Country"]; //Sets the field which should be filtered by the FlexPivotSlicer 
                c1FlexPivotSlicer.Field.Caption = "Country Name"; //Customizes the field caption   
    
                c1FlexPivotSlicer.ShowCheckBoxes = true; //Displays checkboxes next to each item in the list                    
                c1FlexPivotSlicer.MultiSelect = true; //Allows users to select multiple items from the list
                c1FlexPivotSlicer.ShowSelectAll = true; //Displays the Select All checkbox at the top of the list           
                c1FlexPivotSlicer.SortOrder = System.Data.SqlClient.SortOrder.Descending; //Sorts the checklist in descending order
                c1FlexPivotSlicer.ShowSort = true; //Displays the Sort button in the header
    
                //Styling the FlexPivotSlicer
                c1FlexPivotSlicer.Styles.Common.Padding = new C1.Framework.Thickness(10);
                c1FlexPivotSlicer.Styles.Header.Font = new Font("Calibri", 10, FontStyle.Bold);
                c1FlexPivotSlicer.Styles.CheckList.Hot.BackColor = Color.LightCyan;
                c1FlexPivotSlicer.Styles.CheckList.HotSelected.BackColor = Color.LightPink;
            }
    

    The example instantiates the object of C1FlexPivotSlicer and shows the basic implementation with various options mentioned above.

     

    Inheritance Hierarchy

    System.Object
       System.MarshalByRefObject
          System.ComponentModel.Component
             System.Windows.Forms.Control
                C1.Framework.XViewHost
                   C1.Win.FlexPivot.C1FlexPivotSlicer

    See Also