Repeat Button - 마우스를 누른 후 마우스를 떼기 전까지 Click 이벤트가 반복하여 발생하는 컨트롤 |
Repeat Button 사용 방법 <UserControl x:Class="RiaContent.FrmRepeatButton" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"> <Grid x:Name="LayoutRoot" Background="White"> <Border Background="Green" CornerRadius="15,15,15,15"> <Border.Child> <Canvas> <RepeatButton x:Name="btnMinusSec" Width="30" Height="30" Canvas.Left="5" Canvas.Top="10" Content="-" Click="btnMinusSec_Click"></RepeatButton> <TextBlock x:Name="txtBlkSec" Width="30" Height="30" Canvas.Left="40" Canvas.Top="15" Text="3초E" <RepeatButton x:Name="btnPlusSec" Width="30" Height="30" Canvas.Left="70" Canvas.Top="10" Content="+" </Canvas> </Border.Child> </Border> </Grid> </UserControl> |
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; namespace RiaContent { public partial class FrmRepeatButton : UserControl { public FrmRepeatButton() { InitializeComponent(); } private Int32 playTime = 3; private void btnMinusSec_Click(object sender, RoutedEventArgs e) { playTime = Math.Max(1, --playTime); txtBlkSec.Text = String.Format("{0}sec", playTime); } private void btnPlusSec_Click(object sender, RoutedEventArgs e) { playTime = Math.Min(60, ++playTime); txtBlkSec.Text = string.Format("{0}sec", playTime); } } } |
'.Net Project > SilverLight 3.0' 카테고리의 다른 글
38장) CheckBox 컨트롤(IsThreeStater, IsThreeState) (0) | 2009.11.27 |
---|---|
37장) HyperLink Button 컨트롤(_blank, _parent, Window Name) (0) | 2009.11.27 |
35장) Button 컨트롤(Hover, Press, Release) (0) | 2009.11.27 |
34장) 단일항목을 표시하는 컨트롤 (ContentControl) (0) | 2009.11.27 |
33장) 실버라이트 텍스트 컨트롤(TextBlock, TextBox, PasswordBox) (0) | 2009.11.27 |