Back to Devexpress

Customize the Spreadsheet Status Bar

wpf-401275-controls-and-libraries-spreadsheet-getting-started-customize-the-spreadsheet-status-bar.md

latest6.8 KB
Original Source

Customize the Spreadsheet Status Bar

  • May 14, 2021
  • 2 minutes to read

This topic describes how to customize the Spreadsheet control’s status bar.

Show or Hide Predefined Items

Use the following properties to control the visibility of the status bar’s elements:

PropertyDescription
SpreadsheetControl.StatusBarShowProgressSpecifies whether to display the progress bar.
SpreadsheetControl.StatusBarShowAverageSpecifies whether to display the average value of the selected cells.
SpreadsheetControl.StatusBarShowCountSpecifies whether to display the number of selected cells that contain data.
SpreadsheetControl.ShowNumericalCountSpecifies whether to display the number of selected cells that contain numerical data.
SpreadsheetControl.StatusBarShowMinSpecifies whether to display the minimum numerical value in the selected cells.
SpreadsheetControl.StatusBarShowMaxSpecifies whether to display the maximum numerical value in the selected cells.
SpreadsheetControl.StatusBarShowSumSpecifies whether to display the sum of numerical values in the selected cells.
SpreadsheetControl.StatusBarShowZoomSpecifies whether to display the current zoom level.
SpreadsheetControl.StatusBarShowZoomSliderSpecifies whether to display the zoom slider that allows users to zoom the worksheet.
SpreadsheetControl.StatusBarShowEndModeSpecifies whether to display the End Mode label used to indicate that End Mode is activated.
SpreadsheetControl.StatusBarShowPopupMenuSpecifies whether to display the context menu that allows users to show or hide status bar entries.

The following example shows how to hide the MIN and MAX items on the status bar:

xaml
<dxsps:SpreadsheetControl ShowStatusBar="True"
                          StatusBarShowMax="False"
                          StatusBarShowMin="False"/>

Use Bar Customization Actions

Add the InsertAction, RemoveAction or UpdateAction customization actions to the SpreadsheetControl.StatusBarActions collection to add or remove the status bar’s items. An action’s ElementName property specifies a modified element’s name. The DevExpress.Xpf.Spreadsheet.DefaultBarItemNames class fields define the available element names.

The status bar’s element namesThe Customize Status Bar context menu’s element names
DefaultBarItemNames.StatusBarControl
DefaultBarItemNames.StatusBarItem_ProgressDefaultBarItemNames.StatusBarItem_Average
DefaultBarItemNames.StatusBarItem_CountDefaultBarItemNames.StatusBarItem_NumericalCount
DefaultBarItemNames.StatusBarItem_MinDefaultBarItemNames.StatusBarItem_Max
DefaultBarItemNames.StatusBarItem_SumDefaultBarItemNames.StatusBarItem_Zoom
DefaultBarItemNames.StatusBarItem_ZoomSliderDefaultBarItemNames.StatusBarItem_EndModeDefaultBarItemNames.StatusBar_PopupMenu
DefaultBarItemNames.StatusBarItem_PopupMenu_HeaderDefaultBarItemNames.StatusBarItem_PopupMenu_Progress
DefaultBarItemNames.StatusBarItem_PopupMenu_AverageDefaultBarItemNames.StatusBarItem_PopupMenu_Count
DefaultBarItemNames.StatusBarItem_PopupMenu_NumericalCountDefaultBarItemNames.StatusBarItem_PopupMenu_Min
DefaultBarItemNames.StatusBarItem_PopupMenu_MaxDefaultBarItemNames.StatusBarItem_PopupMenu_Sum
DefaultBarItemNames.StatusBarItem_PopupMenu_ZoomDefaultBarItemNames.StatusBarItem_PopupMenu_ZoomSlider
DefaultBarItemNames.StatusBarItem_PopupMenu_EndMode

The example below shows how to add a custom File Name item to the status bar and remove the predefined Min and Max items.

xaml
<!--Add the following namespace declarations:
xmlns:dxsps="http://schemas.devexpress.com/winfx/2008/xaml/spreadsheet"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"-->

<dxsps:SpreadsheetControl x:Name="spreadsheetControl" 
                                  CommandBarStyle="Ribbon" 
                                  ShowFormulaBar="True" 
                                  ShowStatusBar="True" >
    <dxsps:SpreadsheetControl.StatusBarActions>
        <!--Remove the MIN and MAX items from the status bar.-->
        <dxb:RemoveAction ElementName="{x:Static dxsps:DefaultBarItemNames.StatusBarItem_Min}"/>
        <dxb:RemoveAction ElementName="{x:Static dxsps:DefaultBarItemNames.StatusBarItem_Max}"/>
        <!--Remove the MIN and MAX items from the Customize Status Bar context menu.-->
        <dxb:RemoveAction ElementName="{x:Static dxsps:DefaultBarItemNames.StatusBarItem_PopupMenu_Min}"/>
        <dxb:RemoveAction ElementName="{x:Static dxsps:DefaultBarItemNames.StatusBarItem_PopupMenu_Max}"/>
        <!--Add the File Name item to the status bar. This item displays a path to the current workbook.-->
        <dxb:InsertAction ContainerName="{x:Static dxsps:DefaultBarItemNames.StatusBarControl}" CollectionTag="LeftStatusBarItems">
            <dxb:BarStaticItem Content="{Binding ElementName=spreadsheetControl, Path=Options.Save.CurrentFileName, Mode=OneWay}" 
                               IsVisible="{Binding ElementName=showFileName, Path=IsChecked}"/>
        </dxb:InsertAction>
        <!--Add the File Name item to the Customize Status Bar context menu.
        This item allows users to control the File Name item's visibility on the status bar.-->
        <dxb:InsertAction ContainerName="{x:Static dxsps:DefaultBarItemNames.StatusBar_PopupMenu}">
            <dxb:BarCheckItem x:Name="showFileName" Content="File Name" IsChecked="True"/>
        </dxb:InsertAction>
    </dxsps:SpreadsheetControl.StatusBarActions>
</dxsps:SpreadsheetControl>