Add a hyperlink to the WPF textblock and wpftextblock

Source: Internet
Author: User

Add a hyperlink to the WPF textblock and wpftextblock

<TextBlock Grid.Row="2" Margin="75,0,0,0">     <Hyperlink Name="BlogHl" Click="BlogHl_Click" NavigateUri="http://www.cnblogs.com/ZXdeveloper/">http://www.cnblogs.com/ZXdeveloper/</Hyperlink></TextBlock>     
        private void BlogHl_Click(object sender, RoutedEventArgs e)        {            System.Diagnostics.Process.Start("http://www.cnblogs.com/ZXdeveloper/");        }


How to add buttons and set hyperlinks in WPF

<TextBlock>
<Hyperlink NavigateUri = codeproject.com> CodeProject </Hyperlink>
</TextBlock>
Isn't that what you want? Or you can understand it again.

How can I use textblock or label to vertically mix letters in WPF? Code required,

I wrote a class for you:
Public class ScrollingTextControl: TextBlock
{
/// <Summary>
/// Timer
/// </Summary>
Timer MarqueeTimer = new Timer ();

/// <Summary>
/// Scroll content
/// </Summary>
String _ TextSource = string. Empty;

/// <Summary>
/// Output text
/// </Summary>
String OutText = string. Empty;

/// <Summary>
/// Speed of text scrolling
/// </Summary>
Double _ RunSpeed = 500;

Public ScrollingTextControl ()
{
MarqueeTimer. Interval = _ RunSpeed;
MarqueeTimer. Enabled = true;
MarqueeTimer. Elapsed + = new ElapsedEventHandler (MarqueeTimer_Elapsed );
This. Loaded + = new System. Windows. RoutedEventHandler (ScrollingTextControl_Loaded );
}

Void ScrollingTextControl_Loaded (object sender, System. Windows. RoutedEventArgs e)
{
_ TextSource = SetContent;
OutText = TextSource + "";
}

Void MarqueeTimer_Elapsed (object sender, ElapsedEventArgs e)
{
If (string. IsNullOrEmpty (OutText) return;
OutText = OutText. Substring (1) + OutText [0];
Dispatcher. BeginInvoke (new Action () => {
SetContent = OutText;
}));
}

Public double RunSpeed
... The remaining full text>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.