WP – 如何以编程方式删除hyperlinkButton中的下划线?
我在C#中开发了一个hyperlinkButton。 的超链接下划线让我很恼火。 我不知道如何删除它。 帮我删除下划线,我需要在C#中回答。 [这是WP8应用程序]
HyperlinkButton hyperlinkButton = new HyperlinkButton() { Content = "Click me", HorizontalAlignment = HorizontalAlignment.Left, NavigateUri = new Uri("http://my-link-com", UriKind.Absolute) };
我不知道另一种方法,但在XAML中设置ControlTemplate。 但是你可以在C#中使用它:
var str = "" + " " + " "; var template = (ControlTemplate)XamlReader.Load(str); HyperlinkButton hyperlinkButton = new HyperlinkButton() { Content = "Click me", HorizontalAlignment = HorizontalAlignment.Left, NavigateUri = new Uri("http://my-link-com", UriKind.Absolute), Template = template };
希望这可以帮助
引用道格拉斯斯托克韦尔
您可以直接设置属性,也可以使用样式: