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>