RichTextBlockExSample/RichTextBlockEx.cs
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text.RegularExpressions;
using Windows.ApplicationModel.Email;
using Windows.Foundation.Metadata;
using Windows.System;
using Windows.UI;
using Windows.UI.Text;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Documents;
using Windows.UI.Xaml.Media;
namespace RichTextBlockExSample
{
public enum RichTextType
{
Mention,
Email,
PhoneNumber,
Webite,
HtmlTag
}
public class MatchResult
{
public Match Match { get; set; }
public string Path { get; set; }
public RichTextType RichTextType { get; set; }
}
public class RichTextBlockEx
{
private const string PhoneRegex = @"[+]{0,1}(\d){1,3}[ ]?([-]?((\d)|[ ]){1,12})+";
private const string EmailRegex = @"[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+";
private static readonly Regex EmailAddressRegex = new Regex(EmailRegex, RegexOptions.IgnoreCase);
private static readonly Regex PhoneNumberRegex = new Regex(PhoneRegex, RegexOptions.IgnoreCase);
public static string GetRichText(DependencyObject obj)
{
return (string)obj.GetValue(RichTextProperty);
}
public static void SetRichText(DependencyObject obj, string value)
{
obj.SetValue(RichTextProperty, value);
}
// Using a DependencyProperty as the backing store for Text. This enables animation, styling, binding, etc...
public static readonly DependencyProperty RichTextProperty =
DependencyProperty.RegisterAttached("RichText", typeof(string), typeof(RichTextBlockEx), new PropertyMetadata(null, RichTextChanged));
后面还有 93 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
