Article
    C#
    ADO.Net
    .NET
    ASP.Net & Web Forms
    Custom Controls
    Web Development
    Exception Handling
    XML
    Database
    Security in .Net
    Testing
    Web Services
    Windows Services
    Windows Controls
    WCF
    AJAX
    WPF
    XAML
    Reporting
    Setup
    VB.Net
    LINQ
    JQuery
    SilverLight
    JavaScript
    HTML5
    Crystal Report
    Cloud Computing
    Share Point
    Visual C++
    MVC
    Android
    PHP
    Java
    HTML
    WordPress
    Joomla
    Products
    Drupal
    Windows Phone
    JSON
    LightSwitch
    iPhone/iPad
    Ruby on Rails
    IIS 7
    Windows 8
    CSS/CSS3
    Excel
    MS Access
    Shortcut Keys
    Visual SourceSafe
    Team Foundation Server
    API(s)
    Sencha-Touch
Follow Us
Follow _MindStick_ on Twitter View MindStick Software's LinkedIn profile View MindStick Software's Facebook profile
Top Contributor
Advertisement
Advertise with Us
Mindstick
Article Article  Forum Forum  Blog Blog  Quiz Quiz  Beginner Beginner  Careers Careers  Contact Contact  Login Login  
Home | Product | Services | About Us | Interview | DeveloperSection | Submit an Article | Submit Blog

Home >> WPF >> Label control in WPF
Label control in WPF
Label control in WPF


by Awadhendra Tiwari on 4/6/2011 4:41:48 PM

Views: 2827       Comments: 0

Label control in WPF

In WPF we can use Label control to show some messages to user such as result of calculation price of certain things, to show caption etc. We can use XAML <Label /> element to create a Label control in WPF. In this demonstration I will show you how to use Label control in WPF.

The following code snippets represent use of Label control in WPF

<Label x:Name="lblMessage" Content="Hello Dear! Welcome to the demonstration of Label control" VerticalAlignment="Center" HorizontalAlignment="Center" />

Output of the following code snippet is as follows

Label control in WPF

Changing Foreground and Background of a Label control

The following code snippet changes the foreground and background of label control.

<Label x:Name="lblMessage" Content="Hello Dear! Welcome to the demonstration of Label control" VerticalAlignment="Center" HorizontalAlignment="Center" Background="Aquamarine" Foreground="Blue" />

Out of the following code snippet is as follows

Label control in WPF

Applying style to a label control

<Label x:Name="lblMessage" Content="Hello Dear! Welcome to the demonstration of Label control" VerticalAlignment="Center" HorizontalAlignment="Center">

            <Label.Foreground>

                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">

                    <GradientStop Color="Black" Offset="0.325" />

                    <GradientStop Color="#A0C30030" Offset="0.52" />

                </LinearGradientBrush>

            </Label.Foreground>

            <Label.Background>

                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">

                    <GradientStop Color="Black" Offset="1" />

                    <GradientStop Color="#9B52A03D" Offset="0.455" />

                </LinearGradientBrush>

            </Label.Background>

 </Label>

The output of the following code snippet is as follows

Label control in WPF

Report Abuse Form
Reason:    
 

Title :
Comment :
Text ColorBackground Color
BoldItalicUnderline
LeftCenterRightJustify
Ordered ListBulleted List
IndentOutdent
Horizontal Rule
SubscriptSuperscript
HyperlinkImage
Design ModeDesign
View HtmlHtml
     
 
Latest Article by Awadhendra TiwariRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Latest BlogsRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Top Viewed ArticlesRSS Feed
    
    
    
    
    
    
    
    
    
    
Top Viewed BlogsRSS Feed
    
    
    
    
    
    
    
    
    
    
Latest Interview QuestionsRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Total Online Users: 2787
Advertisement
MindStick SurveyManager
Advertise with Us
  
Copyright © 2013MindStick. All Rights Reserved.