Kamis, 05 September 2013

Uses of Label Control in WPF

The most usable control in any entry form, details form or any other forms in programming. The textbox is an input control but, on the running mode the label control will notify the user to which value is to be inserted in the relative textbox.

Look out the following entry form in WPF

Entry form showing use of labels: WPF

In the above image the three textboxes are used to input values, but in which order. The respective label will tell us to enter which values in which textbox. The label control which will show a name and some specified width and height is:
<Label>
<Label.Content>Name</Label.Content>
<Label.Height>40</Label.Height>
<Label.Width>100</Label.Width>
</Label>

The above code, when run, will show a text “Name” as in above image. Label control can easily be formatted using its properties like Border Brush, Background, Foreground and etc.

We can easily set an image in label control by using the following line of code:
<Label>
<Label.Background>
<ImageBrush ImageSource="source of image"></ImageBrush>
</Label.Background>
</Label>

That is how we use label control and set image as a background of that label control.

Tidak ada komentar:

Posting Komentar