-
Notifications
You must be signed in to change notification settings - Fork 1
Spinner
A Spinner control is a control that represents a decimal value (like double, only with higher resolution). The control is composed of an edit box and two buttons, for increment and decrement. Let’s try the thing with the 1000 words:

Spinner Properties Every ribbon control has properties that defines the way it looks and behaves. Here is a quick review of spinner properties, divided into logical groups:
Spinner Value Related Properties (with internal details)
-
DecimalValue – The actual decimal value of the spinner. Property Identifier: UI_PKEY_DecimalValue
-
Increment – The size of the step when pressing on increment / decrement buttons. Property Identifier: UI_PKEY_Increment
-
MaxValue – Maximum value that can be set using the spinner control. Property Identifier: UI_PKEY_MaxValue
-
MinValue – Minimum value that can be set using the spinner control. Property Identifier: UI_PKEY_MinValue
Spinner Appearance Related Properties
-
DecimalPlaces – The number of digits to show after the point. Property Identifier: UI_PKEY_DecimalPlaces
-
FormatString – The units of the value. In the previous image, it is “m”, for meters. Property Identifier: UI_PKEY_FormatString
-
RepresentativeString – A string that represents the common value for the spinner. This is used to calculate the width of the spinner, so you should set here the longest string you forecast. Note that it doesn’t have to be an actual value, it can be also: “XXXXXXXX”. Property Identifier: UI_PKEY_RepresentativeString
Common Appearance Properties
-
Keytip – The keyboard accelerator for this command in the ribbon framework (view it by pressing ALT in a ribbon application). Property Identifier: UI_PKEY_Keytip
-
Label – The label for this command. Usually appears next to the attached control. Property Identifier: UI_PKEY_Label
-
TooltipTitle – The title of the tooltip for this command. Property Identifier: UI_PKEY_TooltipTitle
-
TooltipDescription – The description of the tooltip for this command. Property Identifier: UI_PKEY_TooltipDescription
-
Enabled – Flag that indicates whether this control is enabled or not. Property Identifier: UI_PKEY_Enabled
Image Properties
-
LargeImage – The large image for this command. Property Identifier: UI_PKEY_LargeImage
-
SmallImage – The small image for this command. Property Identifier: UI_PKEY_SmallImage
-
LargeHighContrastImage – The large high contrast image for this command. Property Identifier: UI_PKEY_LargeHighContrastImage
-
SmallHighContrastImage – The small high contrast image for this command. Property Identifier: UI_PKEY_SmallHighContrastImage
Using Spinner – Ribbon Markup As always, a command should be defined:
<Command Name="cmdSpinner"
Id="1018"
LabelTitle="My Spinner">
</Command>
The views section is also simple:
<Application.Views>
<Ribbon>
<Ribbon.Tabs>
<Tab>
<Group>
<Spinner CommandName="cmdSpinner" />
</Group>
</Tab>
</Ribbon.Tabs>
</Ribbon>
</Application.Views>
Using Spinner – Code Behind To help us manipulate the spinner I’ve created a helper class that encapsulates all the work regarding the ribbon framework. To use it, create a RibbonSpinner instance, passing to the constructor the RibbonStrip instance and command ID of the spinner:
partial class RibbonItems
{
public void Init()
{
ButtonDropA.Click += new EventHandler<EventArgs>(_buttonDropA_Click);
Spinner.RepresentativeString = "2.50 m";
}
void _buttonDropA_Click(object sender, EventArgs e)
{
InitSpinner();
}
}Now you can manipulate the spinner properties easily, by setting them on the _spinner instance, for example:
private void InitSpinner()
{
Spinner.DecimalPlaces = 2;
Spinner.DecimalValue = 1.8M;
Spinner.TooltipTitle = "Height";
Spinner.TooltipDescription = "Enter height in meters.";
Spinner.MaxValue = 2.5M;
Spinner.MinValue = 0;
Spinner.Increment = 0.01M;
Spinner.FormatString = " m";
Spinner.Label = "Height:";
}Where can we get it? You can find a working sample that demonstrates using a spinner control under sample “05-Spinner”.
-
Basics
- Introduction, Background on the windows ribbon framework
- Basic Ribbon Wrapper ; Basic .NET wrappers for windows ribbon framework.
- Quickstart Tutorial
- First WinForms Ribbon Application ; How to create an empty WinForms application with ribbon support.
-
RibbonFramework Controls
- RibbonStrip ; Main class, derived from System.Windows.Forms.Control
- RibbonApplicationMenu
- RibbonButton
- RibbonCheckBox
- RibbonComboBox
- RibbonDropDownButton
- RibbonDropDownColorPicker
- RibbonDropDownGallery
- RibbonFontControl
- RibbonGroup
- RibbonHelpButton
- RibbonInRibbonGallery
- RibbonMenuGroup
- RibbonQuickAccessToolbar
- RibbonRecentItems
- RibbonSpinner
- RibbonSplitButton
- RibbonSplitButtonGallery
- RibbonTab
- RibbonTabGroup
- RibbonToggleButton
-
RibbonFramework EventArgs classes
-
RibbonFramework PropertySet classes
-
RibbonFramework classes, interfaces, enums
-
RibbonFramework features
-
RibbonFramework Samples
- ApplicationMenu with Buttons ; How to use the ribbon application menu.
- ApplicationMenu with SplitButton and DropDownButton ; How to use the ribbon application menu with ribbon split button and ribbon dropdown button controls.
- Tabs, Groups and HelpButton ; How to use ribbon tabs, groups and the ribbon help button control.
- Spinner ; How to use the ribbon spinner control.
- ComboBox ; How to use the ribbon combo box control.
- Changing Ribbon Colors ; How to change the ribbon colors.
- Working with Images ; How to work with images in the ribbon.
- DropDownGallery, SplitButtonGallery and InRibbonGallery ; How to use the ribbon drop down gallery, split button gallery and in ribbon gallery controls.
- CheckBox and ToggleButton ; How to use the ribbon check box and toggle button controls.
- DropDownColorPicker ; How to use the ribbon drop down color picker control.
- FontControl ; How to use the ribbon font control.
- ApplicationModes ; How to work with ribbon application modes.
- ContextualTabs ; How to work with ribbon contextual tabs.
- ContextPopup ; How to work with ribbon context popup.
- RecentItems ; How to work with ribbon recent items control.
- QuickAccessToolbar ; How to work with the ribbon quick access toolbar.
- SizeDefinition ; How to define custom size definitions for ribbon group elements.
- Localization ; How to localize a ribbon.
-
RibbonTools
- RibbonTools64 ; Development support for creating markup files for the Ribbon framework.
- Create a new project ; Create a WordPad sample project
- Specifying Ribbon Commands
- Designing Ribbon Views
- Preview the Ribbon
- Wrapper class RibbonItems ; An auto generated wrapper class from the ribbon markup.
- Convert Image to ARGB Bitmap
-
How to ...