Showing posts with label padding in wpf. Show all posts
Showing posts with label padding in wpf. Show all posts

Friday, 29 March 2013

Some Important Properties of Controls in WPF


Some Important Properties of Controls in WPF

In this article I am specifying some properties for controls. These properties are necessary to understand for any WPF application. These are as follows:-
1. Background

If you want to set any background color to your layout then we use background property.
For Example:-

In this example I first give background to grid. After that I set background of label control and textbox too.
<Grid Background="Red">

        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>

        <Label Grid.Row="0" Grid.Column="0" Background="Yellow" >Enter your Name</Label>
        <Label Grid.Row="1" Grid.Column="0" >Enter your Password</Label>
        <Label Grid.Row="2" Grid.Column="0" >Re-Type your Password</Label>
        <TextBox Grid.Row="0" Grid.Column="1" Background="Pink" />
        <TextBox Grid.Row="1" Grid.Column="1" />
        <TextBox Grid.Row="2" Grid.Column="1" />
        <Button Grid.Row="3" Grid.Column="1">Submit your DATA</Button>

    </Grid>

The output of this code as follows:-



Figure 1