Repeat​Button Repeat​Button Repeat​Button Class

Definition

Represents a control that raises its Click event repeatedly when it is pressed and held.

public sealed class RepeatButton : ButtonBase, IRepeatButtonpublic sealed class RepeatButton : ButtonBase, IRepeatButtonPublic NotInheritable Class RepeatButton Inherits ButtonBase Implements IRepeatButton
<RepeatButton .../>
-or-
<RepeatButton>
    singleObject
</RepeatButton>
-or-
<RepeatButton ...>stringContent</RepeatButton>
Inheritance
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Inherited Members

Inherited properties

Inherited events

Inherited methods

Remarks

A RepeatButton is a button that raises Click events repeatedly from the time it is pressed until it is released. Set the Delay property to specify the time that the RepeatButton waits after it is pressed before it starts repeating the click action. Set the Interval property to specify the time between repetitions of the click action. Times for both properties are specified in milliseconds.

Examples

The following example shows two RepeatButton controls whose respective Click events are used to increase and decrease the value shown in a TextBlock.

<StackPanel>
    <RepeatButton Width="100" Delay="500" Interval="100" Click="Increase_Click">Increase</RepeatButton>
    <RepeatButton Width="100" Delay="500" Interval="100" Click="Decrease_Click">Decrease</RepeatButton>
    <TextBlock x:Name="clickTextBlock" Text="Number of Clicks:"/>
</StackPanel>
private static int _clicks = 0;
private void Increase_Click(object sender, RoutedEventArgs e)
{
    _clicks += 1;
    clickTextBlock.Text = "Number of Clicks: " + _clicks;
}

private void Decrease_Click(object sender, RoutedEventArgs e)
{
    if(_clicks > 0)
    {
        _clicks -= 1;
        clickTextBlock.Text = "Number of Clicks: " + _clicks;
    }
}

Constructors

RepeatButton() RepeatButton() RepeatButton()

Initializes a new instance of the RepeatButton class.

public RepeatButton()public RepeatButton()Public Sub New()
Attributes

Properties

Delay Delay Delay

Gets or sets the time, in milliseconds, that the RepeatButton waits when it is pressed before it starts repeating the click action.

public int Delay { get; set; }public int Delay { get; set; }Public ReadWrite Property Delay As int
<RepeatButton Delay="int"/>
Value
int int int

The time, in milliseconds, that the RepeatButton waits when it is pressed before it starts repeating the click action. The default is 250.

Attributes

DelayProperty DelayProperty DelayProperty

Identifies the Delay dependency property.

public static DependencyProperty DelayProperty { get; }public static DependencyProperty DelayProperty { get; }Public Static ReadOnly Property DelayProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the Delay dependency property.

Attributes

Interval Interval Interval

Gets or sets the time, in milliseconds, between repetitions of the click action, as soon as repeating starts.

public int Interval { get; set; }public int Interval { get; set; }Public ReadWrite Property Interval As int
<RepeatButton Interval="int"/>
Value
int int int

The time, in milliseconds, between repetitions of the click action, as soon as repeating starts. The default is 250.

Attributes

IntervalProperty IntervalProperty IntervalProperty

Identifies the Interval dependency property.

public static DependencyProperty IntervalProperty { get; }public static DependencyProperty IntervalProperty { get; }Public Static ReadOnly Property IntervalProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the Interval dependency property.

Attributes