Xceed Toolkit Plus for WPF v4.6 Documentation
ButtonSpinner Class
Members  Example 


Xceed.Wpf.Toolkit Assembly > Xceed.Wpf.Toolkit Namespace : ButtonSpinner Class
Represents a two-button spinner control that can be added to any element, which raises Spin events when the element is manipulated.
Syntax
'Declaration
 
<TemplatePartAttribute(Name="PART_IncreaseButton", Type=System.Windows.Controls.Primitives.ButtonBase)>

<ContentPropertyAttribute("Content")>

<StyleTypedPropertyAttribute(Property="FocusVisualStyle", StyleTargetType=System.Windows.Controls.Control)>

<XmlLangPropertyAttribute("Language")>

<UsableDuringInitializationAttribute(True)>

<RuntimeNamePropertyAttribute("Name")>

<UidPropertyAttribute("Uid")>

<TypeDescriptionProviderAttribute(MS.Internal.ComponentModel.DependencyObjectProvider)>

<NameScopePropertyAttribute("NameScope", System.Windows.NameScope)>

Public Class ButtonSpinner 

   Inherits Spinner
'Usage
 
Dim instance As ButtonSpinner
[TemplatePart(Name="PART_IncreaseButton", Type=System.Windows.Controls.Primitives.ButtonBase)]

[ContentProperty("Content")]

[StyleTypedProperty(Property="FocusVisualStyle", StyleTargetType=System.Windows.Controls.Control)]

[XmlLangProperty("Language")]

[UsableDuringInitialization(true)]

[RuntimeNameProperty("Name")]

[UidProperty("Uid")]

[TypeDescriptionProvider(MS.Internal.ComponentModel.DependencyObjectProvider)]

[NameScopeProperty("NameScope", System.Windows.NameScope)]

public class ButtonSpinner : Spinner 
Remarks

You can wrap any element by placing it inside the content area of the ButtonSpinner control.

The Spin event lets the developer know which direction the buttons are spinning: SpinDirection.Increase indicates an increment; SpinDirection.Decrease indicates a decrement.

Example
The following example creates a simple numeric up/down control by wrapping a TextBox.
<xctk:ButtonSpinner Spin="ButtonSpinner_Spin">

            <TextBox Text="0" HorizontalContentAlignment="Right" />

</xctk:ButtonSpinner>
The following example shows an implementation of a Spin event handler.
private void ButtonSpinner_Spin(object sender, Microsoft.Windows.Controls.SpinEventArgs e)

{

    ButtonSpinner spinner = (ButtonSpinner)sender;

    TextBox txtBox = (TextBox)spinner.Content;



    int value = String.IsNullOrEmpty(txtBox.Text) ? 0 : Convert.ToInt32(txtBox.Text);

    if (e.Direction == Microsoft.Windows.Controls.SpinDirection.Increase)

        value++;

    else

        value--;

    txtBox.Text = value.ToString();

}
Inheritance Hierarchy

System.Object
   System.Windows.Threading.DispatcherObject
      System.Windows.DependencyObject
         System.Windows.Media.Visual
            System.Windows.UIElement
               System.Windows.FrameworkElement
                  System.Windows.Controls.Control
                     Xceed.Wpf.Toolkit.Spinner
                        Xceed.Wpf.Toolkit.ButtonSpinner

Requirements

See Also

Reference

ButtonSpinner Members
Xceed.Wpf.Toolkit Namespace