Represents a control that raises its Click event repeatedly from the time it is pressed until it is released.
Namespace:
System.Windows.Controls.Primitives
Assembly:
System.Windows (in System.Windows.dll)
Visual Basic (Declaration)
<TemplateVisualStateAttribute(Name := "Normal", GroupName := "CommonStates")> _
<TemplateVisualStateAttribute(Name := "Focused", GroupName := "FocusStates")> _
<TemplateVisualStateAttribute(Name := "MouseOver", GroupName := "CommonStates")> _
<TemplateVisualStateAttribute(Name := "Pressed", GroupName := "CommonStates")> _
<TemplateVisualStateAttribute(Name := "Disabled", GroupName := "CommonStates")> _
<TemplateVisualStateAttribute(Name := "Unfocused", GroupName := "FocusStates")> _
Public NotInheritable Class RepeatButton _
Inherits ButtonBase
Dim instance As RepeatButton
[TemplateVisualStateAttribute(Name = "Normal", GroupName = "CommonStates")]
[TemplateVisualStateAttribute(Name = "Focused", GroupName = "FocusStates")]
[TemplateVisualStateAttribute(Name = "MouseOver", GroupName = "CommonStates")]
[TemplateVisualStateAttribute(Name = "Pressed", GroupName = "CommonStates")]
[TemplateVisualStateAttribute(Name = "Disabled", GroupName = "CommonStates")]
[TemplateVisualStateAttribute(Name = "Unfocused", GroupName = "FocusStates")]
public sealed class RepeatButton : ButtonBase
XAML Object Element Usage
<RepeatButton .../>
-or-
<RepeatButton>
singleObject
</RepeatButton>
XAML Values
- singleObject
A single object element that declares the content.
The RepeatButton class represents a control that resembles a Button. However, repeat buttons give you control over when and how the Click event occurs. The RepeatButton raises the Click event repeatedly from the time it is pressed until it is released. The Delay property determines when the event starts. You can also control the interval of repetitions with the Interval property.
Content Model: RepeatButton is a ContentControl. Its content property is Content.
The following example demonstrates how to use a RepeatButton.
Run this sample
static int Clicks = 0;
private void RepeatButton_Click(object sender, RoutedEventArgs e)
{
Clicks += 1;
clickTextBlock.Text = "Number of Clicks: " + Clicks;
}
<UserControl x:Class="RepeatButtonEx.Page"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="350" Height="300">
<StackPanel Margin="10">
<RepeatButton Content="click and hold for multiple Click events"
Click="RepeatButton_Click" Width="250" Margin="5"
HorizontalAlignment="Left"/>
<TextBlock x:Name="clickTextBlock" Text="Number of Clicks:" />
</StackPanel>
</UserControl>
System..::.Object
System.Windows..::.DependencyObject
System.Windows..::.UIElement
System.Windows..::.FrameworkElement
System.Windows.Controls..::.Control
System.Windows.Controls..::.ContentControl
System.Windows.Controls.Primitives..::.ButtonBase
System.Windows.Controls.Primitives..::.RepeatButton
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Reference
Other Resources