CheckBox Checked event in silverlight
CheckBox is a silverlight control. checkbox control allow users to select (check) or deselect (unchecked) a check box
by clicking itself. checkbox control inherits from ToggleButton and can have three states checked, unchecked and indeterminate.
checkbox Checked event is occurs when a ToogleButton (checkbox) is checked. we can write an event handle for checkbox Checked event to perform any action when a checkbox control is checked. in this example code we changed the checkbox content when the checkbox is checked (selected).
the following silverlight c# example code demonstrate us how can we use checkbox Checked event in a silverlight application.
checkbox Checked event is occurs when a ToogleButton (checkbox) is checked. we can write an event handle for checkbox Checked event to perform any action when a checkbox control is checked. in this example code we changed the checkbox content when the checkbox is checked (selected).
the following silverlight c# example code demonstrate us how can we use checkbox Checked event in a silverlight application.
MainPage.xaml
<UserControl x:Class="SilverlightApps.MainPage"
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="600"
d:DesignWidth="800"
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">
<Grid x:Name="LayoutRoot" Background="White">
<sdk:Label
HorizontalAlignment="Left"
Margin="12,21,0,0"
Name="label1"
VerticalAlignment="Top"
Width="750"
Content="Silverlight - how to use CheckBox Checked event"
FontSize="25"
FontStyle="Italic"
Foreground="MidnightBlue"
/>
<CheckBox
Content="CheckBox"
HorizontalAlignment="Left"
Margin="239,152,0,431"
Name="checkBox1"
VerticalAlignment="Center"
Checked="checkBox1_Checked"
/>
</Grid>
</UserControl>
MainPage.xaml.cs
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 SilverlightApps
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
}
private void checkBox1_Checked(object sender, RoutedEventArgs e)
{
checkBox1.Content = "CheckBox Checked.";
}
}
}

