Murali R

Murali R

  • NA
  • 41
  • 7.6k

Visible and collapse not working

Oct 9 2015 7:31 AM

I designed a simple design and in that, in passwordChangeTbx tapped event i made a grid to get visible.But it is not working.can anyone help me in finding bug in this basic code.

My Code:

<Grid>
<TextBox x:Name="passwordChangeTbx" Background="White" BorderBrush="Red" BorderThickness="1,1,1,1" Height="34" IsReadOnly="True"
RenderTransformOrigin="0.5,0.5" PlaceholderText="**********" HorizontalAlignment="Left" VerticalAlignment="Center" Width="327" Margin="18,43,0,563" Tapped="passwordChangeTbx_Tapped" />
<Grid Background="Gray" Visibility="Collapsed" x:Name="changePasswordGrid" Margin="26,108,44,153" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock TextWrapping="Wrap" Text="Change Password" Grid.ColumnSpan="2" Grid.Row="0" Foreground="Black" FontSize="20" TextAlignment="Center" Height="28" Width="295" />
<TextBox x:Name="oldPasswordTbx" PlaceholderText="Old Password" Grid.ColumnSpan="2" Grid.Row="1" TextWrapping="Wrap" Width="315" BorderThickness="1,1,1,1" BorderBrush="Black"/>
<TextBox x:Name="newPasswordTbx" PlaceholderText="New Password" Grid.ColumnSpan="2" Grid.Row="2" TextWrapping="Wrap" Width="315" BorderThickness="1,1,1,1" BorderBrush="Black"/>
<TextBox x:Name="confirmPasswordTbx" PlaceholderText="Confirm Password" Grid.ColumnSpan="2" Grid.Row="3" TextWrapping="Wrap" Width="315" BorderThickness="1,1,1,1" BorderBrush="Black"/>

<Button x:Name="saveBtnInCanvas" Content="SAVE" Grid.Column="0" Grid.Row="4" Background="Black" Foreground="Yellow" Width="157.5" BorderThickness="1,1,1,1" BorderBrush="Black" HorizontalAlignment="Right"/>
<Button x:Name="cancelBtnInCanvas" Content="CANCEL" Grid.Column="1" Grid.Row="4" Background="Black" Foreground="Yellow" Width="157.5" BorderThickness="1,1,1,1" BorderBrush="Black" />
</Grid>

</Grid>

Code Behind:

private void passwordChangeTbx_Tapped(object sender, TappedRoutedEventArgs e)
{
changePasswordGrid.Visibility = Visibility.Visible;
}

Answers (3)