Two repeat buttons that increase and decrease a numerical value. : Button « Windows Presentation Foundation « VB.Net Tutorial






<DockPanel xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Class="RepeatButtons.Pane1">
  <StackPanel>
      <RepeatButton Width="100" DockPanel.Dock="Top" 
                    Delay="500" Interval="100" 
                    Click="Increase">
        Increase
      </RepeatButton>
      <TextBlock Name="valueText" 
                 Width="100" DockPanel.Dock="Top" 
                 TextAlignment="Center" FontSize="16">
        0
      </TextBlock>

      <RepeatButton Width="100" DockPanel.Dock="Top" 
                    Delay="500" Interval="100" 
                    Click="Decrease">
        Decrease
      </RepeatButton>
    </StackPanel>
</DockPanel>
//File:Window.xaml.vb


Imports System
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Documents
Imports System.Windows.Navigation
Imports System.Windows.Shapes
Imports System.Windows.Data

Namespace RepeatButtons
  Public Partial Class Pane1
    Inherits DockPanel
    Private Sub Increase(sender As Object, e As RoutedEventArgs)
      Dim Num As Int32 = Convert.ToInt32(valueText.Text)

      valueText.Text = ((Num + 1).ToString())
    End Sub

    Private Sub Decrease(sender As Object, e As RoutedEventArgs)
      Dim Num As Int32 = Convert.ToInt32(valueText.Text)

      valueText.Text = ((Num - 1).ToString())
    End Sub
  End Class
End Namespace
WPF Two Repeat Buttons That Increase And Decrease A Numerical Value








16.6.Button
16.6.1.Rotated ButtonsRotated Buttons
16.6.2.Pendulum ButtonPendulum Button
16.6.3.Set Button Content with element valueSet Button Content with element value
16.6.4.Set Button Width,Height and Content String by using AttributesSet Button Width,Height and Content String by using Attributes
16.6.5.Use Button.Content to set the content for a ButtonUse Button.Content to set the content for a Button
16.6.6.Adding image to a ButtonAdding image to a Button
16.6.7.Button with no position and sizeButton with no position and size
16.6.8.Button with Property AttributesButton with Property Attributes
16.6.9.Button with Property ElementsButton with Property Elements
16.6.10.Button with default Xml namespaceButton with default Xml namespace
16.6.11.Button with named NamespaceButton with named Namespace
16.6.12.Button Based On StyleButton Based On Style
16.6.13.Property Trigger for ButtonProperty Trigger for Button
16.6.14.Layout TranformLayout Tranform
16.6.15.Using alternate elements as the content of a ButtonUsing alternate elements as the content of a Button
16.6.16.Button's Background = ImageBrush. The resulting button has an image as its backgroundButton's Background = ImageBrush. The resulting button has an image as its background
16.6.17.A rotated ButtonA rotated Button
16.6.18.Using Button.Content to set content for ButtonUsing Button.Content to set content for Button
16.6.19.A button that has been skewed and rotatedA button that has been skewed and rotated
16.6.20.Button PreviewMouseDown action and MouseDown actionButton PreviewMouseDown action and MouseDown action
16.6.21.Add CommandTarget for ButtonAdd CommandTarget for Button
16.6.22.Adding graphics to a ButtonAdding graphics to a Button
16.6.23.Button with image and text, use grid to layout Button contentButton with image and text, use grid to layout Button content
16.6.24.Canvas with Button onCanvas with Button on
16.6.25.Resizing ButtonsResizing Buttons
16.6.26.To add a button control and a text block to the canvasTo add a button control and a text block to the canvas
16.6.27.A simple template for a round buttonA simple template for a round button
16.6.28.Load style defined in Xaml and apply to the ButtonLoad style defined in Xaml and apply to the Button
16.6.29.Nested Button contentNested Button content
16.6.30.Two repeat buttons that increase and decrease a numerical value.Two repeat buttons that increase and decrease a numerical value.
16.6.31.Set button properties with Linq styleSet button properties with Linq style
16.6.32.Simple Custom ButtonSimple Custom Button
16.6.33.Button VerticalAlignment=Top HorizontalAlignment=LeftButton VerticalAlignment=Top  HorizontalAlignment=Left