Answers for "wpf hyperlink textblock"

C#
1

wpf hyperlink textblock

<TextBlock>           
    <Hyperlink NavigateUri="http://www.google.com" RequestNavigate="Hyperlink_RequestNavigate">
        Click here
    </Hyperlink>
</TextBlock>

---------------------------------------------------------------------------------

using System.Diagnostics;
using System.Windows.Navigation;

private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
{
    // for .NET Core you need to add UseShellExecute = true
    // see https://docs.microsoft.com/dotnet/api/system.diagnostics.processstartinfo.useshellexecute#property-value
    Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri){ UseShellExecute = true });
    e.Handled = true;
}
Posted by: Guest on June-22-2021

C# Answers by Framework

Browse Popular Code Answers by Language