Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
XAML RepeatButton Code Example
WhatsApp
Mahesh Chand
6y
25.1k
0
4
100
Article
The following XAML code creates a RepeatButton control.
<
RepeatButton
Margin
=
"10,10,0,0"
VerticalAlignment
=
"Top"
HorizontalAlignment
=
"Left"
Name
=
"GrowButton"
Width
=
"80"
Height
=
"30"
>
</
RepeatButton
>
Listing 1
Note:
This article has moved here:
Working with a RepeatButton control using XAML and C#
The default property of a RepeatButton is Content. The code snippet in Listing 2 creates the same button as created by Listing 1.
<
RepeatButton
Margin
=
"10,10,0,0"
VerticalAlignment
=
"Top"
HorizontalAlignment
=
"Left"
Name
=
"GrowButton"
Width
=
"80"
Height
=
"30"
>
Grow
</
RepeatButton
>
Listing 2
The output looks as in Figure 1.
Figure 1
The RepeatButton control has two important properties, Delay and Interval, that separate it from a normal button.
A RepeatButton is a button that fires Click events repeatedly when it is pressed and held. The rate and aspects of repeating are determined by the Delay and Interval properties that the control exposes.
The code snippet in Listing 3 sets the Delay and Interval properties.
<
RepeatButton
Margin
=
"10,10,0,0"
VerticalAlignment
=
"Top"
HorizontalAlignment
=
"Left"
Name
=
"GrowButton"
Width
=
"80"
Height
=
"30"
Delay
=
"500"
Interval
=
"100"
>
Grow
</
RepeatButton
>
Listing 3
The Click attribute of a RepeatButton element adds the click event handler and it keeps firing the event for the given Interval and delay values. The code in Listing 4 adds the click event handler for a Button.
<
Button
x:Name
=
"DrawCircleButton"
Height
=
"40"
Width
=
"120"
Canvas.Left
=
"10"
Canvas.Top
=
"10"
Content
=
"Draw Circle"
VerticalAlignment
=
"Top"
HorizontalAlignment
=
"Left"
>
Click
=
"DrawCircleButton_Click"
</
Button
>
Listing 4
The code for the click event handler looks as in following.
private
void
GrowButton_Click(
object
sender, RoutedEventArgs e)
{
}
Visit this complete tutorial here:
Working with a RepeatButton control using XAML and C#
XAML Repeat Button
RepeatButton
XAML
Up Next
Ebook Download
View all
Programming XAML
Read by 12.3k people
Download Now!
Learn
View all
Mindcracker
Founded in 2003, Mindcracker is the authority in custom software development and innovation. We put best practices into action. We deliver solutions based on consumer and industry analysis.
Membership not found