RepeatButton RepeatButton RepeatButton RepeatButton 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// This API is not available in Javascript.
<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

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;
    }
}

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.

Constructors

RepeatButton() RepeatButton() RepeatButton() RepeatButton()

Initializes a new instance of the RepeatButton class.

public : RepeatButton()public RepeatButton()Public Sub New()// This API is not available in Javascript.

Properties

Delay 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// This API is not available in Javascript.
<RepeatButton Delay="int"/>
Value
int 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.

DelayProperty 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// This API is not available in Javascript.
Value
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

The identifier for the Delay dependency property.

Interval 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// This API is not available in Javascript.
<RepeatButton Interval="int"/>
Value
int int int int

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

IntervalProperty 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// This API is not available in Javascript.
Value
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

The identifier for the Interval dependency property.

See Also