Generate Click Events Repeatedly While a Button Is Clicked : Event « Windows Presentation Foundation « C# / C Sharp






Generate Click Events Repeatedly While a Button Is Clicked

Generate Click Events Repeatedly While a Button Is Clicked
   

<Window x:Class="WpfApplication1.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="WPF" Height="100" Width="200">
    <StackPanel>
        <Slider Name="slider" Maximum="100" Minimum="0" Value="50" />
        <StackPanel Orientation="Horizontal">
            <RepeatButton Click="SliderLeft_Click" Content="Click Me" 
                          Height="23" Margin="10" Width="70" 
                          ToolTip="Click to move slider left" />
            <RepeatButton Click="SliderRight_Click" ClickMode="Hover" 
                          Content="Touch Me" Height="23" Margin="10" 
                          ToolTip="Hover to move slider right" Width="70" />
        </StackPanel>
    </StackPanel>
</Window>
//File:Window.xaml.cs
using System.Windows;

namespace WpfApplication1
{
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
        }
        private void SliderLeft_Click(object sender, RoutedEventArgs e)
        {
            slider.Value -= 1;
        }

        private void SliderRight_Click(object sender, RoutedEventArgs e)
        {
            slider.Value += 1;
        }
    }
}

   
    
    
  








Related examples in the same category

1.Cast event sender to a controlCast event sender to a control
2.Press F1 to get helpPress F1 to get help
3.Raise the PropertyChanged eventRaise the PropertyChanged event
4.Get the event sender nameGet the event sender name
5.Use Ellipse event delegateUse Ellipse event delegate
6.Halting event routing with HandledHalting event routing with Handled
7.Use Ellipse.AddHandler to add handler to Ellipse objectsUse Ellipse.AddHandler to add handler to Ellipse objects
8.Get event sender from eventGet event sender from event
9.Handle the ContentRendered eventHandle the ContentRendered event
10.Find source element of an element in event handler by casintFind source element of an element in event handler by casint
11.Add an event handler to an element using codeAdd an event handler to an element using code
12.Handles the Click event on the UniformGridHandles the Click event on the UniformGrid
13.Mark the text control as being changed to prevent any text content or selection changed eventsMark the text control as being changed to prevent any text content or selection changed events
14.Check handler event senderCheck handler event sender
15.Raise the ScrollChanged event of a ScrollViewerRaise the ScrollChanged event of a ScrollViewer
16.Event firing sequenceEvent firing sequence
17.ToolBar and event handlerToolBar and event handler
18.Cancel event by setting CanExecute and Handled to falseCancel event by setting CanExecute and Handled to false
19.Activated and Deactivated events monitors the activation status of an application.
20.Event sender, event source and event original sourceEvent sender, event source and event original source
21.Attach a double click to an object