Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6730647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:26:00+00:00 2026-05-26T10:26:00+00:00

In XAML I have the following code: <Label Width=120 Height=20 Name=label1 SnapsToDevicePixels=True HorizontalAlignment=Left VerticalAlignment=Bottom>

  • 0

In XAML I have the following code:

    <Label Width="120" Height="20" Name="label1" SnapsToDevicePixels="True" HorizontalAlignment="Left" VerticalAlignment="Bottom">
        <TextBlock VerticalAlignment="Center" HorizontalAlignment="Left">
            click
            <Hyperlink RequestNavigate="Hyperlink_RequestNavigate" NavigateUri="foo">here</Hyperlink>
            please
        </TextBlock>
    </Label>

Now I’d like to get rid of the whole TextBlock XAML and add that bit programmatically. I have no trouble creating the TextBlock, setting the Text property to ‘click please’ and adding a Hyperlink to TextBlock.Content. But how do I position the Hyperlink in between ‘click’ and ‘please’? And how do I set the text of the hyperlink to ‘here’?

I haven’t got much going, so far all I got is this:

    label2.Content = new TextBlock() { Text = "click please" };
    //(label2.Content as TextBlock).Content does not exist?
    //and even if it does.. how do I squeeze the hyperlink in between the text?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:26:01+00:00Added an answer on May 26, 2026 at 10:26 am

    Here’s the code to add a TextBlock with a clickable link in the middle :

    Run run1 = new Run("click ");
    Run run2 = new Run(" Please");
    Run run3 = new Run("here.");
    
    Hyperlink hyperlink = new Hyperlink(run3)
                           {
                               NavigateUri = new Uri("http://stackoverflow.com")
                           };
    hyperlink.RequestNavigate += new System.Windows.Navigation.RequestNavigateEventHandler(hyperlink_RequestNavigate); //to be implemented
    textBlock1.Inlines.Clear();
    textBlock1.Inlines.Add(run1);
    textBlock1.Inlines.Add(hyperlink);
    textBlock1.Inlines.Add(run2);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I have following XAML code which is the output from XamlWriter.Save(): <StackPanel Name=itemStack
I have in xaml as following: <StackPanel Orientation=Horizontal Margin=0 5 0 0 HorizontalAlignment=Center VerticalAlignment=Bottom>
I have the following code: <TabItem Name=tabItemGeneral> <TabItem.Triggers> <Trigger Property=IsSelected Value=True> <Setter TargetName=tabGeneralImg Property=Source
I have the following XAML Code: <sdk:DataGrid Margin=58,8,52,18 Name=dataGridTickets> <sdk:DataGrid.Columns> <sdk:DataGridTextColumn x:Name=ticketNoColumn Header=Ticket No.
I have the following XAML code as part of a custom control: <telerik:RadTreeView x:Name=treeModules>
I have the following XAML code, which displays a picture (image inside borders) and
Let's pretend I have the following xaml... <UserControl.Resources> <local:ViewModel x:Name=viewModel /> <local:LoadChildrenValueConverter x:Name=valueConverter />
The following code: <TextBlock Name=foo></TextBlock> <Label Target=foo>_Delta pressure</Label> Generates the following design time error:
In App.xaml I have the following code: <Application xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml x:Class=FJW.App> <Application.Resources> <!-- Resources
I have the following XAML code: <Window x:Class=RichText_Wrapping.Window1 xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml Title=Window1> <Grid> <RichTextBox Height=100

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.