Search This Blog

Wednesday, January 16, 2013

WPF Btutton (C#)

This control is designed to be clicked to enable the user to make a choice, to close a dialog box, or to perform another action.

XAML

<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="10,10,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" />
    </Grid>
</Window>

// c# code behind 

private void button1_Click(object sender, RoutedEventArgs e)
{
   MessageBox.Show("Button1 Click"); 
}


Runtime:




Home Next: CheckBox Control