Floating FB sharing byReview Results

Floating FB sharing byReview Results

  • WPF Tutorial

    • # Read in Your Language

    WPF Controls

    Tutorial Home | Layouts | Containers| Button | CheckBox and CheckedListBox | ComboBox| DateTimePicker and MonthCalendar | DataGrid | Label and LinkLabel| ListBox | ListView | TextBox and MaskedTextBox| PictureBox and ProgressBar | TreeView | WebBrowser| Menus,Status and Toolbar | RadioButton | RichTextBox| ToolTip and Scrolling | Custom Controls

    Label and LinkLabel controls in WPF

    Label And TextBlock:

    For Label control in you can use Label or Textblock in WPF.
    TextBlock is lighter, so use it if you don’t need the Accelerator feature of the Label control.
    The labels have an automatic margin so all controls and spacing is done automatically by the parent control.

    Namespace : System.Windows.Controls.Label
    Namespace : System.Windows.Controls.TextBlock

    Designer Code:

                <Label Name="lbl1">one from label</Label>
                <TextBlock Name="txtblo1"> one from textblock</TextBlock>

    Code Behind:

    To retive the text from the Label and TextBlock:

            // Window1.xaml.cs
    private void Window_Loaded(object sender, RoutedEventArgs e) { MessageBox.Show(lbl1.Content.ToString()); MessageBox.Show(txtblo1.Text.ToString()); }

    Label with formatting:

             <Label Name="Lbl1"
             Width="150" Height="30"
             Canvas.Left="10" Canvas.Top="10" 
             FontSize="14" FontFamily="Arial"

    Image as Background of a Label:

                 <ImageBrush  ImageSource="\Images\win2wpf.JPG" />

    LinkLabel (or) Hyperlink:

    Namespace : System.Windows.Documents.Hyperlink

    Designer Code:

            <TextBlock> Check out this site 
                <Hyperlink NavigateUri="http://www.Win2wpf.com">
                    for convesion

    Code Behind:

    To Set the navigateUri from code:

            // Window1.xaml.cs
    Run run1 = new Run("Win2wpf"); // Create a Hyperlink and setting NavigateUri Hyperlink hlink = new Hyperlink(run1); hlink.NavigateUri = new Uri("http://www.Win2wpf.com");

    << Previous >> | << Next >>