Перейти к основному содержимому
Версия: 11.0.0

Repeat Button

The repeat button is a control that has the added feature of regularly generating click events while the button is being pressed down.

Useful Properties

You will probably use these properties most often:

PropertyDescription
DelayThe time (milliseconds) to wait before repeated click generation begins. Default is 300.
IntervalThe time (milliseconds) between clicks being generated. Default is 100.

Example

This example shows a repeat button generating click events with the default interval and delay.

<Grid Margin="20" RowDefinitions="50,*">
<RepeatButton Grid.Row="0" Click="ClickHandler">Press and hold down</RepeatButton>
<ScrollViewer Grid.Row="1">
<TextBlock Margin="0 10" x:Name="message">Ready...</TextBlock>
</ScrollViewer>
</Grid>
C#
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}

public void ClickHandler(object sender, RoutedEventArgs args)
{
message.Text += "\rButton clicked!";
}
}

More Information

к сведению

For the complete API documentation about this control, see here.

к сведению

View the source code on GitHub RepeatButton.cs