Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

  • Azetoth

    Azetoth

    0 Points

    8 Posts

    Re: Succesive IsEnable true/false on textbox breaks its behaviors.

    Jan 28, 2009 11:58 AM | LINK

     Even with a cleaner code like that. the problem still persist...

    I fogot to mention you have to insert some text in textbox between each clic to repoduce the problem (one of the textbox must have the focus when you clic on the button

     

    public partial class Page : UserControl
        {
            DispatcherTimer _timer = new DispatcherTimer();

            public Page()
            {
                InitializeComponent();

                _timer.Interval = new TimeSpan(0, 0, 1);
                _timer.Tick += new EventHandler(_timer_Tick);
            }

            private void Button_Click(object sender, RoutedEventArgs e)
            {
                this.IsEnabled = false;
                _timer.Start();
            }

            void _timer_Tick(object sender, EventArgs e)
            {
                this.IsEnabled = true;
                ((DispatcherTimer)sender).Stop();
            }
        }