best

best

  • NA
  • 11
  • 0

Hiding and showing textbox using MVVM pattern in silverlight

Jun 23 2010 5:39 AM
I take one grid in silverlight. Initially textbox2 is invisible. When I click on textbox1 we have to  visible  textbox2. I try it as belows:
 <TextBox x:Name="textbox1" SelectionChanged="txt1_SelectionChanged"/>
 <TextBox x:Name="textbox2 "  Visibility="Collapsed"/>

 private void txt1_SelectionChanged(object sender, RoutedEventArgs e)
        {            
            textbox2 .Visibility = Visibility.Visible;
       }

It works fine.

But I want to use MVVM pattern. So there I don't want to use eventHandler.
So how to do that using MVVM pattern?