本文整理汇总了C#中System.Windows.Documents.Hyperlink.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Hyperlink.SetValue方法的具体用法?C# Hyperlink.SetValue怎么用?C# Hyperlink.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Documents.Hyperlink
的用法示例。
在下文中一共展示了Hyperlink.SetValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetLaunchHyperlink
public static void SetLaunchHyperlink(Hyperlink element, bool Value)
{
element.SetValue(LaunchHyperlinkProperty, Value);
}
示例2: SetIsEnabled
public static void SetIsEnabled(Hyperlink element, bool value)
{
element.SetValue(IsEnabledProperty, value);
}
示例3: SetNavigateExternally
/// <summary>
/// Sets whether the target <see cref="Hyperlink"/>'s RequestNavigation event should open the URI in the
/// default web browser.
/// </summary>
public static void SetNavigateExternally(Hyperlink element, bool value)
{
element.SetValue(NavigateExternallyProperty, value);
}
示例4: SetWebUrl
public static void SetWebUrl(Hyperlink element, string value)
{
element.SetValue(WebUrlProperty, value);
}
示例5: AddInlines
public void AddInlines(InlineCollection inlineCollection, IEnumerable<ColorTextPair> pairs, bool allowHyperlinks)
{
Run run;
foreach (ColorTextPair pair in pairs)
{
bool hasHyperlinks = false;
if (allowHyperlinks)
{
if (!string.IsNullOrEmpty(pair.Text))
{
MatchCollection matches = new Regex(ZChat.Options.HyperlinkPattern).Matches(pair.Text);
if (matches.Count > 0)
{
hasHyperlinks = true;
string linkText;
int linkStart = 0, linkLength = 0;
int curPos = 0;
foreach (Match match in matches)
{
if (match.Value.StartsWith(" "))
{
linkStart = match.Index + 1;
linkLength = match.Length - 1;
}
else
{
linkStart = match.Index;
linkLength = match.Length;
}
linkText = pair.Text.Substring(linkStart, linkLength);
Hyperlink link = new Hyperlink(new Run(linkText));
link.Foreground = ZChat.Options.LinkFore;
link.SetValue(KeyboardNavigation.IsTabStopProperty, false);
//if (link.FontStyle) link.TextDecorations.Add(TextDecorations.Underline);
link.Click += new RoutedEventHandler(link_Click);
link.Tag = linkText;
run = new Run(pair.Text.Substring(curPos, linkStart - curPos));
run.Foreground = pair.Color;
if (linkStart > 0) inlineCollection.Add(run);
curPos = linkStart + linkLength;
inlineCollection.Add(link);
}
if (curPos < pair.Text.Length)
{
run = new Run(pair.Text.Substring(curPos, pair.Text.Length - curPos));
run.Foreground = pair.Color;
inlineCollection.Add(run);
}
}
}
}
if (hasHyperlinks == false)
{
AddNonHyperlinkText(inlineCollection, pair.Text, pair.Color);
//run = new Run(pair.Text);
//run.Foreground = pair.Color;
//inlineCollection.Add(run);
}
}
}