From 3c1ce6394d267e1e65e75db71d609c3ca6fa011a Mon Sep 17 00:00:00 2001 From: Mahdi Hosseini Date: Sat, 11 May 2019 19:36:39 +0430 Subject: [PATCH] add poptip --- .../Data/MessageToken.cs | 2 + .../Data/MessageToken.tt | 3 +- .../HandyControlDemo_Shared.projitems | 10 + .../Properties/Langs/Lang.Designer.cs | 357 +++++----- .../Properties/Langs/Lang.en.resx | 3 + .../Properties/Langs/Lang.resx | 3 + .../UserControl/Controls/PoptipDemoCtl.xaml | 82 +++ .../Controls/PoptipDemoCtl.xaml.cs | 11 + .../UserControl/Main/LeftMainContent.xaml | 5 + .../Controls/PopTip/AngleBorder.cs | 664 ++++++++++++++++++ .../Controls/PopTip/Poptip.cs | 338 +++++++++ .../HandyControl_Shared.projitems | 2 + 12 files changed, 1305 insertions(+), 175 deletions(-) create mode 100644 src/Shared/HandyControlDemo_Shared/UserControl/Controls/PoptipDemoCtl.xaml create mode 100644 src/Shared/HandyControlDemo_Shared/UserControl/Controls/PoptipDemoCtl.xaml.cs create mode 100644 src/Shared/HandyControl_Shared/Controls/PopTip/AngleBorder.cs create mode 100644 src/Shared/HandyControl_Shared/Controls/PopTip/Poptip.cs diff --git a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs index d5fce6b2..3ba929dd 100644 --- a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs +++ b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs @@ -96,6 +96,8 @@ public static readonly string GridDemoCtl = nameof(GridDemoCtl); + public static readonly string PoptipDemoCtl = nameof(PoptipDemoCtl); + public static readonly string ButtonDemoCtl = nameof(ButtonDemoCtl); public static readonly string RepeatButtonDemoCtl = nameof(RepeatButtonDemoCtl); diff --git a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt index 5117bc00..e7cb38f9 100644 --- a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt +++ b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt @@ -50,7 +50,8 @@ var controlList = new List "GravatarDemoCtl", "DialogDemoCtl", "SideMenuDemoCtl", - "GridDemoCtl" + "GridDemoCtl", + "PoptipDemoCtl" }; var styleList = new List { diff --git a/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems b/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems index 7a9d0ef9..9dcb0d48 100644 --- a/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems +++ b/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems @@ -129,6 +129,7 @@ PasswordBoxDemoCtl.xaml + PreviewSliderDemoCtl.xaml @@ -496,6 +497,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -731,4 +736,9 @@ MSBuild:Compile + + + PoptipDemoCtl.xaml + + \ No newline at end of file diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs index 6247b2cb..57edd7fc 100644 --- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs +++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ // -// 此代码由工具生成。 -// 运行时版本:4.0.30319.42000 +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 // -// 对此文件的更改可能会导致不正确的行为,并且如果 -// 重新生成代码,这些更改将会丢失。 +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. // //------------------------------------------------------------------------------ @@ -13,13 +13,13 @@ namespace HandyControlDemo.Properties.Langs { /// - /// 一个强类型的资源类,用于查找本地化的字符串等。 + /// A strongly-typed resource class, for looking up localized strings, etc. /// - // 此类是由 StronglyTypedResourceBuilder - // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 - // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen - // (以 /str 作为命令选项),或重新生成 VS 项目。 - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class Lang { @@ -33,7 +33,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 返回此类使用的缓存的 ResourceManager 实例。 + /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] public static global::System.Resources.ResourceManager ResourceManager { @@ -47,8 +47,8 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 重写当前线程的 CurrentUICulture 属性 - /// 重写当前线程的 CurrentUICulture 属性。 + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] public static global::System.Globalization.CultureInfo Culture { @@ -61,7 +61,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 关于 的本地化字符串。 + /// Looks up a localized string similar to 关于. /// public static string About { get { @@ -70,7 +70,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 动画路径 的本地化字符串。 + /// Looks up a localized string similar to 动画路径. /// public static string AnimationPath { get { @@ -79,7 +79,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 托盘图标已打开,将隐藏窗口而不是关闭程序 的本地化字符串。 + /// Looks up a localized string similar to 托盘图标已打开,将隐藏窗口而不是关闭程序. /// public static string AppClosingTip { get { @@ -88,7 +88,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 询问 的本地化字符串。 + /// Looks up a localized string similar to 询问. /// public static string Ask { get { @@ -97,7 +97,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 标记 的本地化字符串。 + /// Looks up a localized string similar to 标记. /// public static string Badge { get { @@ -106,7 +106,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 填写基本信息 的本地化字符串。 + /// Looks up a localized string similar to 填写基本信息. /// public static string BasicInfo { get { @@ -115,7 +115,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 基础布局 的本地化字符串。 + /// Looks up a localized string similar to 基础布局. /// public static string BasicLayout { get { @@ -124,7 +124,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 闪烁 的本地化字符串。 + /// Looks up a localized string similar to 闪烁. /// public static string Blink { get { @@ -133,7 +133,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 博客 的本地化字符串。 + /// Looks up a localized string similar to 博客. /// public static string Blog { get { @@ -142,7 +142,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 边框 的本地化字符串。 + /// Looks up a localized string similar to 边框. /// public static string Border { get { @@ -151,7 +151,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 画刷 的本地化字符串。 + /// Looks up a localized string similar to 画刷. /// public static string Brush { get { @@ -160,7 +160,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 按钮 的本地化字符串。 + /// Looks up a localized string similar to 按钮. /// public static string Button { get { @@ -169,7 +169,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 自定义按钮 的本地化字符串。 + /// Looks up a localized string similar to 自定义按钮. /// public static string ButtonCustom { get { @@ -178,7 +178,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 日历 的本地化字符串。 + /// Looks up a localized string similar to 日历. /// public static string Calendar { get { @@ -187,7 +187,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 带时钟的日历 的本地化字符串。 + /// Looks up a localized string similar to 带时钟的日历. /// public static string CalendarWithClock { get { @@ -196,7 +196,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 轮播 的本地化字符串。 + /// Looks up a localized string similar to 轮播. /// public static string Carousel { get { @@ -205,7 +205,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 是否重启以更改语言? 的本地化字符串。 + /// Looks up a localized string similar to 是否重启以更改语言?. /// public static string ChangeLangAsk { get { @@ -214,7 +214,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 对话气泡 的本地化字符串。 + /// Looks up a localized string similar to 对话气泡. /// public static string ChatBubble { get { @@ -223,7 +223,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 讨论室 的本地化字符串。 + /// Looks up a localized string similar to 讨论室. /// public static string Chatroom { get { @@ -232,7 +232,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 复选框 的本地化字符串。 + /// Looks up a localized string similar to 复选框. /// public static string CheckBox { get { @@ -241,7 +241,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 圆形布局 的本地化字符串。 + /// Looks up a localized string similar to 圆形布局. /// public static string CirclePanel { get { @@ -250,7 +250,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 清空 的本地化字符串。 + /// Looks up a localized string similar to 清空. /// public static string Clear { get { @@ -259,7 +259,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 点击计数 的本地化字符串。 + /// Looks up a localized string similar to 点击计数. /// public static string Click2Count { get { @@ -268,7 +268,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 时钟 的本地化字符串。 + /// Looks up a localized string similar to 时钟. /// public static string Clock { get { @@ -277,7 +277,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 颜色拾取器 的本地化字符串。 + /// Looks up a localized string similar to 颜色拾取器. /// public static string ColorPicker { get { @@ -286,7 +286,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 分栏偏移 的本地化字符串。 + /// Looks up a localized string similar to 分栏偏移. /// public static string ColumnOffset { get { @@ -295,7 +295,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 分栏间隔 的本地化字符串。 + /// Looks up a localized string similar to 分栏间隔. /// public static string ColumnSpacing { get { @@ -304,7 +304,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 组合框 的本地化字符串。 + /// Looks up a localized string similar to 组合框. /// public static string ComboBox { get { @@ -313,7 +313,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 敬请期待 的本地化字符串。 + /// Looks up a localized string similar to 敬请期待. /// public static string ComingSoon { get { @@ -322,7 +322,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 评论 的本地化字符串。 + /// Looks up a localized string similar to 评论. /// public static string Comment { get { @@ -331,7 +331,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 一般 的本地化字符串。 + /// Looks up a localized string similar to 一般. /// public static string Common { get { @@ -340,7 +340,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 对比滑块 的本地化字符串。 + /// Looks up a localized string similar to 对比滑块. /// public static string CompareSlider { get { @@ -349,7 +349,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 完成 的本地化字符串。 + /// Looks up a localized string similar to 完成. /// public static string Complete { get { @@ -358,7 +358,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 这是内容 的本地化字符串。 + /// Looks up a localized string similar to 这是内容. /// public static string ContentDemoStr { get { @@ -367,7 +367,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 贡献者 的本地化字符串。 + /// Looks up a localized string similar to 贡献者. /// public static string Contributors { get { @@ -376,7 +376,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 控件 的本地化字符串。 + /// Looks up a localized string similar to 控件. /// public static string Controls { get { @@ -385,7 +385,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 封面流 的本地化字符串。 + /// Looks up a localized string similar to 封面流. /// public static string CoverFlow { get { @@ -394,7 +394,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 封面视图 的本地化字符串。 + /// Looks up a localized string similar to 封面视图. /// public static string CoverView { get { @@ -403,7 +403,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 危险 的本地化字符串。 + /// Looks up a localized string similar to 危险. /// public static string Danger { get { @@ -412,7 +412,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 数据表格 的本地化字符串。 + /// Looks up a localized string similar to 数据表格. /// public static string DataGrid { get { @@ -421,7 +421,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 日期选择器 的本地化字符串。 + /// Looks up a localized string similar to 日期选择器. /// public static string DatePicker { get { @@ -430,7 +430,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 日期时间选择器 的本地化字符串。 + /// Looks up a localized string similar to 日期时间选择器. /// public static string DateTimePicker { get { @@ -439,7 +439,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 默认 的本地化字符串。 + /// Looks up a localized string similar to 默认. /// public static string Default { get { @@ -448,7 +448,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 对话框 的本地化字符串。 + /// Looks up a localized string similar to 对话框. /// public static string Dialog { get { @@ -457,7 +457,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 对话框示例 的本地化字符串。 + /// Looks up a localized string similar to 对话框示例. /// public static string DialogDemo { get { @@ -466,7 +466,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 在这里拖拽 的本地化字符串。 + /// Looks up a localized string similar to 在这里拖拽. /// public static string DragHere { get { @@ -475,7 +475,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 邮箱 的本地化字符串。 + /// Looks up a localized string similar to 邮箱. /// public static string Email { get { @@ -484,7 +484,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 错误 的本地化字符串。 + /// Looks up a localized string similar to 错误. /// public static string Error { get { @@ -493,7 +493,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 退出 的本地化字符串。 + /// Looks up a localized string similar to 退出. /// public static string Exit { get { @@ -502,7 +502,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 展开框 的本地化字符串。 + /// Looks up a localized string similar to 展开框. /// public static string Expander { get { @@ -511,7 +511,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 严重 的本地化字符串。 + /// Looks up a localized string similar to 严重. /// public static string Fatal { get { @@ -520,7 +520,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 翻页时钟 的本地化字符串。 + /// Looks up a localized string similar to 翻页时钟. /// public static string FlipClock { get { @@ -529,7 +529,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 Gif图片 的本地化字符串。 + /// Looks up a localized string similar to Gif图片. /// public static string GifImage { get { @@ -538,7 +538,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 回到顶部 的本地化字符串。 + /// Looks up a localized string similar to 回到顶部. /// public static string GotoTop { get { @@ -547,7 +547,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 头像 的本地化字符串。 + /// Looks up a localized string similar to 头像. /// public static string Gravatar { get { @@ -556,7 +556,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 栅格 的本地化字符串。 + /// Looks up a localized string similar to 栅格. /// public static string Grid { get { @@ -565,7 +565,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 分组框 的本地化字符串。 + /// Looks up a localized string similar to 分组框. /// public static string GroupBox { get { @@ -574,7 +574,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 组数 的本地化字符串。 + /// Looks up a localized string similar to 组数. /// public static string Groups { get { @@ -583,7 +583,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 信息通知 的本地化字符串。 + /// Looks up a localized string similar to 信息通知. /// public static string Growl { get { @@ -592,7 +592,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 检测到有新版本!是否更新? 的本地化字符串。 + /// Looks up a localized string similar to 检测到有新版本!是否更新?. /// public static string GrowlAsk { get { @@ -601,7 +601,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 消息通知示例 的本地化字符串。 + /// Looks up a localized string similar to 消息通知示例. /// public static string GrowlDemo { get { @@ -610,7 +610,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 连接失败,请检查网络! 的本地化字符串。 + /// Looks up a localized string similar to 连接失败,请检查网络!. /// public static string GrowlError { get { @@ -619,7 +619,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 程序已崩溃~~~ 的本地化字符串。 + /// Looks up a localized string similar to 程序已崩溃~~~. /// public static string GrowlFatal { get { @@ -628,7 +628,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 今天的天气不错~~~ 的本地化字符串。 + /// Looks up a localized string similar to 今天的天气不错~~~. /// public static string GrowlInfo { get { @@ -637,7 +637,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 文件保存成功! 的本地化字符串。 + /// Looks up a localized string similar to 文件保存成功!. /// public static string GrowlSuccess { get { @@ -646,7 +646,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 磁盘空间快要满了! 的本地化字符串。 + /// Looks up a localized string similar to 磁盘空间快要满了!. /// public static string GrowlWarning { get { @@ -655,7 +655,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 混合布局 的本地化字符串。 + /// Looks up a localized string similar to 混合布局. /// public static string HybridLayout { get { @@ -664,7 +664,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 忽略 的本地化字符串。 + /// Looks up a localized string similar to 忽略. /// public static string Ignore { get { @@ -673,7 +673,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 图片浏览器 的本地化字符串。 + /// Looks up a localized string similar to 图片浏览器. /// public static string ImageBrowser { get { @@ -682,7 +682,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 索引 的本地化字符串。 + /// Looks up a localized string similar to 索引. /// public static string Index { get { @@ -691,7 +691,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 信息 的本地化字符串。 + /// Looks up a localized string similar to 信息. /// public static string Info { get { @@ -700,7 +700,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 可交互对话框 的本地化字符串。 + /// Looks up a localized string similar to 可交互对话框. /// public static string InteractiveDialog { get { @@ -709,7 +709,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 不是手机号码 的本地化字符串。 + /// Looks up a localized string similar to 不是手机号码. /// public static string IsNotPhone { get { @@ -718,7 +718,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 标签 的本地化字符串。 + /// Looks up a localized string similar to 标签. /// public static string Label { get { @@ -727,7 +727,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 列表框 的本地化字符串。 + /// Looks up a localized string similar to 列表框. /// public static string ListBox { get { @@ -736,7 +736,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 列表视图 的本地化字符串。 + /// Looks up a localized string similar to 列表视图. /// public static string ListView { get { @@ -745,7 +745,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 加载条 的本地化字符串。 + /// Looks up a localized string similar to 加载条. /// public static string Loading { get { @@ -754,7 +754,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 菜单 的本地化字符串。 + /// Looks up a localized string similar to 菜单. /// public static string Menu { get { @@ -763,7 +763,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 消息框 的本地化字符串。 + /// Looks up a localized string similar to 消息框. /// public static string MessageBox { get { @@ -772,7 +772,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 名称 的本地化字符串。 + /// Looks up a localized string similar to 名称. /// public static string Name { get { @@ -781,7 +781,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 新建窗口 的本地化字符串。 + /// Looks up a localized string similar to 新建窗口. /// public static string NewWindow { get { @@ -790,7 +790,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 下一步 的本地化字符串。 + /// Looks up a localized string similar to 下一步. /// public static string Next { get { @@ -799,7 +799,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 托盘图标 的本地化字符串。 + /// Looks up a localized string similar to 托盘图标. /// public static string NotifyIcon { get { @@ -808,7 +808,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 数值选择控件 的本地化字符串。 + /// Looks up a localized string similar to 数值选择控件. /// public static string NumericUpDown { get { @@ -817,7 +817,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 确定 的本地化字符串。 + /// Looks up a localized string similar to 确定. /// public static string Ok { get { @@ -826,7 +826,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 点击打开背景模糊窗口 的本地化字符串。 + /// Looks up a localized string similar to 点击打开背景模糊窗口. /// public static string OpenBlurWindow { get { @@ -835,7 +835,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 点击打开常规窗口 的本地化字符串。 + /// Looks up a localized string similar to 点击打开常规窗口. /// public static string OpenCommonWindow { get { @@ -844,7 +844,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 点击打开自定义内容窗口 的本地化字符串。 + /// Looks up a localized string similar to 点击打开自定义内容窗口. /// public static string OpenCustomContentWindow { get { @@ -853,7 +853,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 点击打开自定义消息窗口 的本地化字符串。 + /// Looks up a localized string similar to 点击打开自定义消息窗口. /// public static string OpenCustomMessageWindow { get { @@ -862,7 +862,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 点击打开自定义非客户端区域窗口 的本地化字符串。 + /// Looks up a localized string similar to 点击打开自定义非客户端区域窗口. /// public static string OpenCustomNonClientAreaWindow { get { @@ -871,7 +871,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 点击打开图片浏览器 的本地化字符串。 + /// Looks up a localized string similar to 点击打开图片浏览器. /// public static string OpenImageBrowser { get { @@ -880,7 +880,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 点击打开消息窗口 的本地化字符串。 + /// Looks up a localized string similar to 点击打开消息窗口. /// public static string OpenMessageWindow { get { @@ -889,7 +889,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 点击打开鼠标跟随窗口 的本地化字符串。 + /// Looks up a localized string similar to 点击打开鼠标跟随窗口. /// public static string OpenMouseFollowWindow { get { @@ -898,7 +898,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 打开无非客户端区域可拖拽窗口 的本地化字符串。 + /// Looks up a localized string similar to 打开无非客户端区域可拖拽窗口. /// public static string OpenNoNonClientAreaDragableWindow { get { @@ -907,7 +907,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 打开面板 的本地化字符串。 + /// Looks up a localized string similar to 打开面板. /// public static string OpenPanel { get { @@ -916,7 +916,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 轮廓文本 的本地化字符串。 + /// Looks up a localized string similar to 轮廓文本. /// public static string OutlineText { get { @@ -925,7 +925,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 概览 的本地化字符串。 + /// Looks up a localized string similar to 概览. /// public static string Overview { get { @@ -934,7 +934,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 页码条 的本地化字符串。 + /// Looks up a localized string similar to 页码条. /// public static string Pagination { get { @@ -943,7 +943,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 密码框 的本地化字符串。 + /// Looks up a localized string similar to 密码框. /// public static string PasswordBox { get { @@ -952,7 +952,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 请输入... 的本地化字符串。 + /// Looks up a localized string similar to 请输入.... /// public static string PleaseInput { get { @@ -961,7 +961,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 请稍后... 的本地化字符串。 + /// Looks up a localized string similar to 请稍后.... /// public static string PleaseWait { get { @@ -970,7 +970,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 请输入内容 的本地化字符串。 + /// Looks up a localized string similar to 请输入内容. /// public static string PlsEnterContent { get { @@ -979,7 +979,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 请输入邮箱 的本地化字符串。 + /// Looks up a localized string similar to 请输入邮箱. /// public static string PlsEnterEmail { get { @@ -988,7 +988,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 请输入关键字 的本地化字符串。 + /// Looks up a localized string similar to 请输入关键字. /// public static string PlsEnterKey { get { @@ -997,7 +997,16 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 上一步 的本地化字符串。 + /// Looks up a localized string similar to Poptip. + /// + public static string Poptip { + get { + return ResourceManager.GetString("Poptip", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 上一步. /// public static string Prev { get { @@ -1006,7 +1015,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 预览滑块 的本地化字符串。 + /// Looks up a localized string similar to 预览滑块. /// public static string PreviewSlider { get { @@ -1015,7 +1024,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 主要 的本地化字符串。 + /// Looks up a localized string similar to 主要. /// public static string Primary { get { @@ -1024,7 +1033,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 进度条 的本地化字符串。 + /// Looks up a localized string similar to 进度条. /// public static string ProgressBar { get { @@ -1033,7 +1042,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 进度按钮 的本地化字符串。 + /// Looks up a localized string similar to 进度按钮. /// public static string ProgressButton { get { @@ -1042,7 +1051,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 按住说话 的本地化字符串。 + /// Looks up a localized string similar to 按住说话. /// public static string PushToTalk { get { @@ -1051,7 +1060,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 QQ群 的本地化字符串。 + /// Looks up a localized string similar to QQ群. /// public static string QQGroup { get { @@ -1060,7 +1069,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 单选按钮 的本地化字符串。 + /// Looks up a localized string similar to 单选按钮. /// public static string RadioButton { get { @@ -1069,7 +1078,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 评分 的本地化字符串。 + /// Looks up a localized string similar to 评分. /// public static string Rate { get { @@ -1078,7 +1087,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 注册 的本地化字符串。 + /// Looks up a localized string similar to 注册. /// public static string Register { get { @@ -1087,7 +1096,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 备注 的本地化字符串。 + /// Looks up a localized string similar to 备注. /// public static string Remark { get { @@ -1096,7 +1105,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 重复按钮 的本地化字符串。 + /// Looks up a localized string similar to 重复按钮. /// public static string RepeatButton { get { @@ -1105,7 +1114,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 回复 的本地化字符串。 + /// Looks up a localized string similar to 回复. /// public static string Reply { get { @@ -1114,7 +1123,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 代码仓库 的本地化字符串。 + /// Looks up a localized string similar to 代码仓库. /// public static string Repository { get { @@ -1123,7 +1132,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 响应式布局 的本地化字符串。 + /// Looks up a localized string similar to 响应式布局. /// public static string ResponsiveLayout { get { @@ -1132,7 +1141,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 富文本框 的本地化字符串。 + /// Looks up a localized string similar to 富文本框. /// public static string RichTextBox { get { @@ -1141,7 +1150,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 在这里右击 的本地化字符串。 + /// Looks up a localized string similar to 在这里右击. /// public static string RightClickHere { get { @@ -1150,7 +1159,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 滚动视图 的本地化字符串。 + /// Looks up a localized string similar to 滚动视图. /// public static string ScrollViewer { get { @@ -1159,7 +1168,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 搜索栏 的本地化字符串。 + /// Looks up a localized string similar to 搜索栏. /// public static string SearchBar { get { @@ -1168,7 +1177,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 秒 的本地化字符串。 + /// Looks up a localized string similar to 秒. /// public static string Second { get { @@ -1177,7 +1186,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 选中 的本地化字符串。 + /// Looks up a localized string similar to 选中. /// public static string Selected { get { @@ -1186,7 +1195,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 徽章 的本地化字符串。 + /// Looks up a localized string similar to 徽章. /// public static string Shield { get { @@ -1195,7 +1204,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 在当前窗口显示 的本地化字符串。 + /// Looks up a localized string similar to 在当前窗口显示. /// public static string ShowInCurrentWindow { get { @@ -1204,7 +1213,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 在主窗口显示 的本地化字符串。 + /// Looks up a localized string similar to 在主窗口显示. /// public static string ShowInMainWindow { get { @@ -1213,7 +1222,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 显示行号 的本地化字符串。 + /// Looks up a localized string similar to 显示行号. /// public static string ShowRowNumber { get { @@ -1222,7 +1231,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 侧边菜单 的本地化字符串。 + /// Looks up a localized string similar to 侧边菜单. /// public static string SideMenu { get { @@ -1231,7 +1240,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 滑块 的本地化字符串。 + /// Looks up a localized string similar to 滑块. /// public static string Slider { get { @@ -1240,7 +1249,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 步骤 的本地化字符串。 + /// Looks up a localized string similar to 步骤. /// public static string Step { get { @@ -1249,7 +1258,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 步骤条 的本地化字符串。 + /// Looks up a localized string similar to 步骤条. /// public static string StepBar { get { @@ -1258,7 +1267,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 样式模板 的本地化字符串。 + /// Looks up a localized string similar to 样式模板. /// public static string Styles { get { @@ -1267,7 +1276,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 子标题 的本地化字符串。 + /// Looks up a localized string similar to 子标题. /// public static string SubTitle { get { @@ -1276,7 +1285,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 成功 的本地化字符串。 + /// Looks up a localized string similar to 成功. /// public static string Success { get { @@ -1285,7 +1294,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 选项卡控件 的本地化字符串。 + /// Looks up a localized string similar to 选项卡控件. /// public static string TabControl { get { @@ -1294,7 +1303,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 标签 的本地化字符串。 + /// Looks up a localized string similar to 标签. /// public static string Tag { get { @@ -1303,7 +1312,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 正文 的本地化字符串。 + /// Looks up a localized string similar to 正文. /// public static string Text { get { @@ -1312,7 +1321,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 文本块 的本地化字符串。 + /// Looks up a localized string similar to 文本块. /// public static string TextBlock { get { @@ -1321,7 +1330,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 文本框 的本地化字符串。 + /// Looks up a localized string similar to 文本框. /// public static string TextBox { get { @@ -1330,7 +1339,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 文本对话框 的本地化字符串。 + /// Looks up a localized string similar to 文本对话框. /// public static string TextDialog { get { @@ -1339,7 +1348,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 时间条 的本地化字符串。 + /// Looks up a localized string similar to 时间条. /// public static string TimeBar { get { @@ -1348,7 +1357,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 时间选择器 的本地化字符串。 + /// Looks up a localized string similar to 时间选择器. /// public static string TimePicker { get { @@ -1357,7 +1366,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 提示 的本地化字符串。 + /// Looks up a localized string similar to 提示. /// public static string Tip { get { @@ -1366,7 +1375,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 标题 的本地化字符串。 + /// Looks up a localized string similar to 标题. /// public static string Title { get { @@ -1375,7 +1384,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 这是标题 的本地化字符串。 + /// Looks up a localized string similar to 这是标题. /// public static string TitleDemoStr1 { get { @@ -1384,7 +1393,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 此项必填 的本地化字符串。 + /// Looks up a localized string similar to 此项必填. /// public static string TitleDemoStr2 { get { @@ -1393,7 +1402,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 标题在左侧 的本地化字符串。 + /// Looks up a localized string similar to 标题在左侧. /// public static string TitleDemoStr3 { get { @@ -1402,7 +1411,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 切换按钮 的本地化字符串。 + /// Looks up a localized string similar to 切换按钮. /// public static string ToggleButton { get { @@ -1411,7 +1420,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 工具条 的本地化字符串。 + /// Looks up a localized string similar to 工具条. /// public static string ToolBar { get { @@ -1420,7 +1429,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 穿梭框 的本地化字符串。 + /// Looks up a localized string similar to 穿梭框. /// public static string Transfer { get { @@ -1429,7 +1438,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 树视图 的本地化字符串。 + /// Looks up a localized string similar to 树视图. /// public static string TreeView { get { @@ -1438,7 +1447,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 试试关闭程序吧? 的本地化字符串。 + /// Looks up a localized string similar to 试试关闭程序吧?. /// public static string Try2CloseApp { get { @@ -1447,7 +1456,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 类型 的本地化字符串。 + /// Looks up a localized string similar to 类型. /// public static string Type { get { @@ -1456,7 +1465,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 上传文件 的本地化字符串。 + /// Looks up a localized string similar to 上传文件. /// public static string UploadFile { get { @@ -1465,7 +1474,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 上传;上传中 的本地化字符串。 + /// Looks up a localized string similar to 上传;上传中. /// public static string UploadStr { get { @@ -1474,7 +1483,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 可见性 的本地化字符串。 + /// Looks up a localized string similar to 可见性. /// public static string Visibility { get { @@ -1483,7 +1492,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 警告 的本地化字符串。 + /// Looks up a localized string similar to 警告. /// public static string Warning { get { @@ -1492,7 +1501,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 瀑布流 的本地化字符串。 + /// Looks up a localized string similar to 瀑布流. /// public static string WaterfallPanel { get { @@ -1501,7 +1510,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 查找类似 窗口 的本地化字符串。 + /// Looks up a localized string similar to 窗口. /// public static string Window { get { diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx index 2705cc41..9b452ed3 100644 --- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx +++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx @@ -600,4 +600,7 @@ Border + + Poptip + \ No newline at end of file diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx index d10f5ec2..ce8b7dd1 100644 --- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx +++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx @@ -600,4 +600,7 @@ 响应式布局 + + Poptip + \ No newline at end of file diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PoptipDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PoptipDemoCtl.xaml new file mode 100644 index 00000000..fcb2e69e --- /dev/null +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PoptipDemoCtl.xaml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PoptipDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PoptipDemoCtl.xaml.cs new file mode 100644 index 00000000..6a9eafcf --- /dev/null +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PoptipDemoCtl.xaml.cs @@ -0,0 +1,11 @@ + +namespace HandyControlDemo.UserControl +{ + public sealed partial class PoptipDemoCtl + { + public PoptipDemoCtl() + { + this.InitializeComponent(); + } + } +} diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml index 49b8368a..67091145 100644 --- a/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml @@ -420,6 +420,11 @@ + + + + + diff --git a/src/Shared/HandyControl_Shared/Controls/PopTip/AngleBorder.cs b/src/Shared/HandyControl_Shared/Controls/PopTip/AngleBorder.cs new file mode 100644 index 00000000..273e7fb4 --- /dev/null +++ b/src/Shared/HandyControl_Shared/Controls/PopTip/AngleBorder.cs @@ -0,0 +1,664 @@ +using HandyControl.Data; +using HandyControl.Tools; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Documents; +using System.Windows.Media; + +namespace HandyControl.Controls +{ + /// + /// 带三角形的气泡边框 + /// + public class AngleBorder : Decorator + { + #region 依赖属性 + public static readonly DependencyProperty PlacementProperty = + DependencyProperty.Register("Placement", typeof(EnumPlacement), typeof(AngleBorder), + new FrameworkPropertyMetadata(EnumPlacement.RightCenter, FrameworkPropertyMetadataOptions.AffectsRender, OnDirectionPropertyChangedCallback)); + + public EnumPlacement Placement + { + get { return (EnumPlacement)GetValue(PlacementProperty); } + set { SetValue(PlacementProperty, value); } + } + + public static readonly DependencyProperty TailWidthProperty = + DependencyProperty.Register("TailWidth", typeof(double), typeof(AngleBorder), new PropertyMetadata(10d)); + /// + /// 尾巴的宽度,默认值为7 + /// + public double TailWidth + { + get { return (double)GetValue(TailWidthProperty); } + set { SetValue(TailWidthProperty, value); } + } + public static readonly DependencyProperty TailHeightProperty = + DependencyProperty.Register("TailHeight", typeof(double), typeof(AngleBorder), new PropertyMetadata(10d)); + /// + /// 尾巴的高度,默认值为10 + /// + public double TailHeight + { + get { return (double)GetValue(TailHeightProperty); } + set { SetValue(TailHeightProperty, value); } + } + + public static readonly DependencyProperty TailVerticalOffsetProperty = + DependencyProperty.Register("TailVerticalOffset", typeof(double), typeof(AngleBorder), new PropertyMetadata(13d)); + /// + /// 尾巴距离顶部的距离,默认值为10 + /// + public double TailVerticalOffset + { + get { return (double)GetValue(TailVerticalOffsetProperty); } + set { SetValue(TailVerticalOffsetProperty, value); } + } + public static readonly DependencyProperty TailHorizontalOffsetProperty = + DependencyProperty.Register("TailHorizontalOffset", typeof(double), typeof(AngleBorder), + new PropertyMetadata(12d)); + /// + /// 尾巴距离顶部的距离,默认值为10 + /// + public double TailHorizontalOffset + { + get { return (double)GetValue(TailHorizontalOffsetProperty); } + set { SetValue(TailHorizontalOffsetProperty, value); } + } + public static readonly DependencyProperty BackgroundProperty = + DependencyProperty.Register("Background", typeof(Brush), typeof(AngleBorder) + , new PropertyMetadata(Brushes.White)); + /// + /// 背景色,默认值为#FFFFFF,白色 + /// + public Brush Background + { + get { return (Brush)GetValue(BackgroundProperty); } + set { SetValue(BackgroundProperty, value); } + } + + public static readonly DependencyProperty PaddingProperty = + DependencyProperty.Register("Padding", typeof(Thickness), typeof(AngleBorder) + , new PropertyMetadata(new Thickness(10, 5, 10, 5))); + /// + /// 内边距 + /// + public Thickness Padding + { + get { return (Thickness)GetValue(PaddingProperty); } + set { SetValue(PaddingProperty, value); } + } + + public static readonly DependencyProperty BorderBrushProperty = + DependencyProperty.Register("BorderBrush", typeof(Brush), typeof(AngleBorder) + , new PropertyMetadata(default(Brush))); + /// + /// 边框颜色 + /// + public Brush BorderBrush + { + get { return (Brush)GetValue(BorderBrushProperty); } + set { SetValue(BorderBrushProperty, value); } + } + + public static readonly DependencyProperty BorderThicknessProperty = + DependencyProperty.Register("BorderThickness", typeof(Thickness), typeof(AngleBorder), new PropertyMetadata(new Thickness(1d))); + /// + /// 边框大小 + /// + public Thickness BorderThickness + { + get { return (Thickness)GetValue(BorderThicknessProperty); } + set { SetValue(BorderThicknessProperty, value); } + } + + public static readonly DependencyProperty CornerRadiusProperty = + DependencyProperty.Register("CornerRadius", typeof(System.Windows.CornerRadius) + , typeof(AngleBorder), new PropertyMetadata(new CornerRadius(0))); + /// + /// 边框大小 + /// + public System.Windows.CornerRadius CornerRadius + { + get { return (System.Windows.CornerRadius)GetValue(CornerRadiusProperty); } + set { SetValue(CornerRadiusProperty, value); } + } + #endregion + + #region 方法重写 + /// + /// 该方法用于测量整个控件的大小 + /// + /// + /// 控件的大小 + protected override Size MeasureOverride(Size constraint) + { + Thickness padding = this.Padding; + + Size result = new Size(); + if (Child != null) + { + //测量子控件的大小 + Child.Measure(constraint); + + //三角形在左边与右边的,整个容器的宽度则为:里面子控件的宽度 + 设置的padding + 三角形的宽度 + //三角形在上面与下面的,整个容器的高度则为:里面子控件的高度 + 设置的padding + 三角形的高度 + switch (Placement) + { + case EnumPlacement.LeftTop: + case EnumPlacement.LeftBottom: + case EnumPlacement.LeftCenter: + case EnumPlacement.RightTop: + case EnumPlacement.RightBottom: + case EnumPlacement.RightCenter: + result.Width = Child.DesiredSize.Width + padding.Left + padding.Right + this.TailWidth; + result.Height = Child.DesiredSize.Height + padding.Top + padding.Bottom; + break; + case EnumPlacement.TopLeft: + case EnumPlacement.TopCenter: + case EnumPlacement.TopRight: + case EnumPlacement.BottomLeft: + case EnumPlacement.BottomCenter: + case EnumPlacement.BottomRight: + result.Width = Child.DesiredSize.Width + padding.Left + padding.Right; + result.Height = Child.DesiredSize.Height + padding.Top + padding.Bottom + this.TailHeight; + break; + default: + break; + } + } + return result; + } + + /// + /// 设置子控件的大小与位置 + /// + /// + /// + protected override Size ArrangeOverride(Size arrangeSize) + { + Thickness padding = this.Padding; + if (Child != null) + { + switch (Placement) + { + case EnumPlacement.LeftTop: + case EnumPlacement.LeftBottom: + case EnumPlacement.LeftCenter: + this.TailWidth = 6; + Child.Arrange(new Rect(new Point(padding.Left + this.TailWidth, padding.Top), Child.DesiredSize)); + //ArrangeChildLeft(); + break; + case EnumPlacement.RightTop: + case EnumPlacement.RightBottom: + case EnumPlacement.RightCenter: + ArrangeChildRight(padding); + break; + case EnumPlacement.TopLeft: + case EnumPlacement.TopRight: + case EnumPlacement.TopCenter: + Child.Arrange(new Rect(new Point(padding.Left, this.TailHeight + padding.Top), Child.DesiredSize)); + break; + case EnumPlacement.BottomLeft: + case EnumPlacement.BottomRight: + case EnumPlacement.BottomCenter: + Child.Arrange(new Rect(new Point(padding.Left, padding.Top), Child.DesiredSize)); + break; + default: + break; + } + } + return arrangeSize; + } + + private void ArrangeChildRight(Thickness padding) + { + double x = padding.Left; + double y = padding.Top; + + if (!Double.IsNaN(this.Height) && this.Height != 0) + { + y = (this.Height - (Child.DesiredSize.Height)) / 2; + } + + Child.Arrange(new Rect(new Point(x, y), Child.DesiredSize)); + } + + /// + /// 绘制控件 + /// + /// + protected override void OnRender(DrawingContext drawingContext) + { + if (Child != null) + { + Geometry cg = null; + Brush brush = null; + //DpiScale dpi = base.getd(); + Pen pen = new Pen(); + + pen.Brush = this.BorderBrush; + //pen.Thickness = BorderThickness * 0.5; + pen.Thickness = RoundLayoutValue(BorderThickness.Left, DoubleUtil.DpiScaleX); + + switch (Placement) + { + case EnumPlacement.LeftTop: + case EnumPlacement.LeftBottom: + case EnumPlacement.LeftCenter: + //生成小尾巴在左侧的图形和底色 + cg = CreateGeometryTailAtLeft(); + brush = Background; + break; + case EnumPlacement.RightTop: + case EnumPlacement.RightCenter: + case EnumPlacement.RightBottom: + //生成小尾巴在右侧的图形和底色 + cg = CreateGeometryTailAtRight(); + brush = Background; + break; + case EnumPlacement.TopLeft: + case EnumPlacement.TopCenter: + case EnumPlacement.TopRight: + //生成小尾巴在右侧的图形和底色 + cg = CreateGeometryTailAtTop(); + brush = Background; + break; + case EnumPlacement.BottomLeft: + case EnumPlacement.BottomCenter: + case EnumPlacement.BottomRight: + //生成小尾巴在右侧的图形和底色 + cg = CreateGeometryTailAtBottom(); + brush = Background; + break; + default: + break; + } + + GuidelineSet guideLines = new GuidelineSet(); + drawingContext.PushGuidelineSet(guideLines); + drawingContext.DrawGeometry(brush, pen, cg); + } + } + + + + + public double RoundLayoutValue(double value, double dpiScale) + { + double num; + if (!DoubleUtil.AreClose(dpiScale, 1.0)) + { + num = Math.Round(value * dpiScale) / dpiScale; + if (DoubleUtil.IsNaN(num) || double.IsInfinity(num) || DoubleUtil.AreClose(num, 1.7976931348623157E+308)) + { + num = value; + } + } + else + { + num = Math.Round(value); + } + return num; + } + + public T GetAdorner(DependencyObject d) where T : class + { + var element = d as FrameworkElement; + + if (element != null) + { + var adornerLayer = AdornerLayer.GetAdornerLayer(element); + if (adornerLayer != null) + { + //能够获取装饰层,说明已经load过了,直接生成装饰件 + var adorners = adornerLayer.GetAdorners(element); + if (adorners != null && adorners.Count() != 0) + { + var adorner = adorners.FirstOrDefault() as T; + + return adorner; + } + } + } + + return null; + } + #endregion + + #region 私有方法 + private Geometry CreateGeometryTailAtRight() + { + CombinedGeometry result = new CombinedGeometry(); + + this.TailHeight = 12; + this.TailWidth = 6; + + switch (this.Placement) + { + case EnumPlacement.RightTop: + //不做任何处理 + break; + case EnumPlacement.RightBottom: + this.TailVerticalOffset = this.ActualHeight - this.TailHeight - this.TailVerticalOffset; + break; + case EnumPlacement.RightCenter: + this.TailVerticalOffset = (this.ActualHeight - this.TailHeight) / 2; + break; + } + + #region 绘制三角形 + Point arcPoint1 = new Point(this.ActualWidth - TailWidth, TailVerticalOffset); + Point arcPoint2 = new Point(this.ActualWidth, TailVerticalOffset + TailHeight / 2); + Point arcPoint3 = new Point(this.ActualWidth - TailWidth, TailVerticalOffset + TailHeight); + + LineSegment as1_2 = new LineSegment(arcPoint2, false); + LineSegment as2_3 = new LineSegment(arcPoint3, false); + + PathFigure pf1 = new PathFigure(); + pf1.IsClosed = false; + pf1.StartPoint = arcPoint1; + pf1.Segments.Add(as1_2); + pf1.Segments.Add(as2_3); + + PathGeometry pg1 = new PathGeometry(); + pg1.Figures.Add(pf1); + #endregion + + #region 绘制矩形边框 + RectangleGeometry rg2 = new RectangleGeometry(new Rect(0, 0, this.ActualWidth - TailWidth, this.ActualHeight) + , CornerRadius.TopLeft, CornerRadius.BottomRight, new TranslateTransform(0.5, 0.5)); + #endregion + + #region 合并两个图形 + result.Geometry1 = pg1; + result.Geometry2 = rg2; + result.GeometryCombineMode = GeometryCombineMode.Union; + #endregion + + return result; + } + + private Geometry CreateGeometryTailAtLeft() + { + CombinedGeometry result = new CombinedGeometry(); + + this.TailHeight = 12; + this.TailWidth = 6; + + switch (this.Placement) + { + case EnumPlacement.LeftTop: + //不做任何处理 + break; + case EnumPlacement.LeftBottom: + this.TailVerticalOffset = this.ActualHeight - this.TailHeight - this.TailVerticalOffset; + break; + case EnumPlacement.LeftCenter: + this.TailVerticalOffset = (this.ActualHeight - this.TailHeight) / 2; + break; + } + + #region 绘制三角形 + Point arcPoint1 = new Point(TailWidth, TailVerticalOffset); + Point arcPoint2 = new Point(0, TailVerticalOffset + TailHeight / 2); + Point arcPoint3 = new Point(TailWidth, TailVerticalOffset + TailHeight); + + LineSegment as1_2 = new LineSegment(arcPoint2, false); + LineSegment as2_3 = new LineSegment(arcPoint3, false); + + PathFigure pf = new PathFigure(); + pf.IsClosed = false; + pf.StartPoint = arcPoint1; + pf.Segments.Add(as1_2); + pf.Segments.Add(as2_3); + + PathGeometry g1 = new PathGeometry(); + g1.Figures.Add(pf); + #endregion + + #region 绘制矩形边框 + RectangleGeometry g2 = new RectangleGeometry(new Rect(TailWidth, 0, this.ActualWidth - this.TailWidth, this.ActualHeight) + , CornerRadius.TopLeft, CornerRadius.BottomRight); + #endregion + + #region 合并两个图形 + result.Geometry1 = g1; + result.Geometry2 = g2; + result.GeometryCombineMode = GeometryCombineMode.Union; + #endregion + + return result; + } + + private Geometry CreateGeometryTailAtTop() + { + CombinedGeometry result = new CombinedGeometry(); + + switch (this.Placement) + { + case EnumPlacement.TopLeft: + break; + case EnumPlacement.TopCenter: + this.TailHorizontalOffset = (this.ActualWidth - this.TailWidth) / 2; + break; + case EnumPlacement.TopRight: + this.TailHorizontalOffset = this.ActualWidth - this.TailWidth - this.TailHorizontalOffset; + break; + } + + #region 绘制三角形 + Point anglePoint1 = new Point(this.TailHorizontalOffset, this.TailHeight); + Point anglePoint2 = new Point(this.TailHorizontalOffset + (this.TailWidth / 2), 0); + Point anglePoint3 = new Point(this.TailHorizontalOffset + this.TailWidth, this.TailHeight); + + LineSegment as1_2 = new LineSegment(anglePoint2, true); + LineSegment as2_3 = new LineSegment(anglePoint3, true); + + PathFigure pf = new PathFigure(); + pf.IsClosed = false; + pf.StartPoint = anglePoint1; + pf.Segments.Add(as1_2); + pf.Segments.Add(as2_3); + + PathGeometry g1 = new PathGeometry(); + g1.Figures.Add(pf); + #endregion + + #region 绘制矩形边框 + RectangleGeometry g2 = new RectangleGeometry(new Rect(0, this.TailHeight, this.ActualWidth, this.ActualHeight - this.TailHeight) + , CornerRadius.TopLeft, CornerRadius.BottomRight); + #endregion + + #region 合并 + result.Geometry1 = g1; + result.Geometry2 = g2; + result.GeometryCombineMode = GeometryCombineMode.Union; + #endregion + + return result; + } + + private Geometry CreateGeometryTailAtBottom() + { + CombinedGeometry result = new CombinedGeometry(); + + switch (this.Placement) + { + case EnumPlacement.BottomLeft: + break; + case EnumPlacement.BottomCenter: + this.TailHorizontalOffset = (this.ActualWidth - this.TailWidth) / 2; + break; + case EnumPlacement.BottomRight: + this.TailHorizontalOffset = this.ActualWidth - this.TailWidth - this.TailHorizontalOffset; + break; + } + + + #region 绘制三角形 + Point anglePoint1 = new Point(this.TailHorizontalOffset, this.ActualHeight - this.TailHeight); + Point anglePoint2 = new Point(this.TailHorizontalOffset + this.TailWidth / 2, this.ActualHeight); + Point anglePoint3 = new Point(this.TailHorizontalOffset + this.TailWidth, this.ActualHeight - this.TailHeight); + + LineSegment as1_2 = new LineSegment(anglePoint2, true); + LineSegment as2_3 = new LineSegment(anglePoint3, true); + + PathFigure pf = new PathFigure(); + pf.IsClosed = false; + pf.StartPoint = anglePoint1; + pf.Segments.Add(as1_2); + pf.Segments.Add(as2_3); + + PathGeometry g1 = new PathGeometry(); + g1.Figures.Add(pf); + #endregion + + #region 绘制矩形边框 + RectangleGeometry g2 = new RectangleGeometry(new Rect(0, 0, this.ActualWidth, this.ActualHeight - this.TailHeight) + , CornerRadius.TopLeft, CornerRadius.BottomRight); + #endregion + + #region 合并 + result.Geometry1 = g1; + result.Geometry2 = g2; + result.GeometryCombineMode = GeometryCombineMode.Union; + #endregion + + return result; + } + + /// + /// 根据三角形方向设置消息框的水平位置,偏左还是偏右 + /// + /// + /// + public static void OnDirectionPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + AngleBorder angleBorder = d as AngleBorder; + if (angleBorder != null) + { + switch ((EnumPlacement)e.NewValue) + { + case EnumPlacement.LeftTop: + case EnumPlacement.LeftBottom: + case EnumPlacement.LeftCenter: + case EnumPlacement.RightTop: + case EnumPlacement.RightBottom: + case EnumPlacement.RightCenter: + angleBorder.TailWidth = 6; + angleBorder.TailHeight = 12; + break; + case EnumPlacement.TopLeft: + case EnumPlacement.TopCenter: + case EnumPlacement.TopRight: + case EnumPlacement.BottomLeft: + case EnumPlacement.BottomCenter: + case EnumPlacement.BottomRight: + angleBorder.TailWidth = 12; + angleBorder.TailHeight = 6; + break; + default: + break; + } + } + } + #endregion + } + + public class DoubleUtil + { + public static double DpiScaleX + { + get + { + int dx = 0; + int dy = 0; + GetDPI(out dx, out dy); + if (dx != 96) + { + return (double)dx / 96.0; + } + return 1.0; + } + } + + public static double DpiScaleY + { + get + { + int dx = 0; + int dy = 0; + GetDPI(out dx, out dy); + if (dy != 96) + { + return (double)dy / 96.0; + } + return 1.0; + } + } + + public static void GetDPI(out int dpix, out int dpiy) + { + dpix = 0; + dpiy = 0; + //using (System.Management.ManagementClass mc = new System.Management.ManagementClass("Win32_DesktopMonitor")) + //{ + // using (System.Management.ManagementObjectCollection moc = mc.GetInstances()) + // { + // foreach (System.Management.ManagementObject each in moc) + // { + // dpix = int.Parse((each.Properties["PixelsPerXLogicalInch"].Value.ToString())); + // dpiy = int.Parse((each.Properties["PixelsPerYLogicalInch"].Value.ToString())); + // } + // } + //} + } + public static bool GreaterThan(double value1, double value2) + { + return value1 > value2 && !DoubleUtil.AreClose(value1, value2); + } + + public static bool AreClose(double value1, double value2) + { + if (value1 == value2) + { + return true; + } + double num = (Math.Abs(value1) + Math.Abs(value2) + 10.0) * 2.2204460492503131E-16; + double num2 = value1 - value2; + return -num < num2 && num > num2; + } + + public static bool IsZero(double value) + { + return Math.Abs(value) < 2.2204460492503131E-15; + } + + [StructLayout(LayoutKind.Explicit)] + private struct NanUnion + { + [FieldOffset(0)] + internal double DoubleValue; + [FieldOffset(0)] + internal ulong UintValue; + } + + public static bool IsNaN(double value) + { + DoubleUtil.NanUnion nanUnion = default(DoubleUtil.NanUnion); + nanUnion.DoubleValue = value; + ulong num = nanUnion.UintValue & 18442240474082181120uL; + ulong num2 = nanUnion.UintValue & 4503599627370495uL; + return (num == 9218868437227405312uL || num == 18442240474082181120uL) && num2 != 0uL; + } + + + } +} \ No newline at end of file diff --git a/src/Shared/HandyControl_Shared/Controls/PopTip/Poptip.cs b/src/Shared/HandyControl_Shared/Controls/PopTip/Poptip.cs new file mode 100644 index 00000000..d50e625b --- /dev/null +++ b/src/Shared/HandyControl_Shared/Controls/PopTip/Poptip.cs @@ -0,0 +1,338 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Media; +using System.Windows.Media.Effects; + +namespace HandyControl.Controls +{ + public enum EnumPlacement + { + /// + /// 左上 + /// + LeftTop, + /// + /// 左中 + /// + LeftCenter, + /// + /// 左下 + /// + LeftBottom, + /// + /// 右上 + /// + RightTop, + /// + /// 右中 + /// + RightCenter, + /// + /// 右下 + /// + RightBottom, + /// + /// 上左 + /// + TopLeft, + /// + /// 上中 + /// + TopCenter, + /// + /// 上右 + /// + TopRight, + /// + /// 下左 + /// + BottomLeft, + /// + /// 下中 + /// + BottomCenter, + /// + /// 下右 + /// + BottomRight, + } + /// + /// 气泡提示控件 + /// + public class Poptip : Popup + { + #region private fields + + private bool mIsLoaded = false; + private AngleBorder angleBorder; + + #endregion + + #region DependencyProperty + + #region PlacementEx + + public EnumPlacement PlacementEx + { + get { return (EnumPlacement)GetValue(PlacementExProperty); } + set { SetValue(PlacementExProperty, value); } + } + + public static readonly DependencyProperty PlacementExProperty = + DependencyProperty.Register("PlacementEx", typeof(EnumPlacement), typeof(Poptip) + , new PropertyMetadata(EnumPlacement.TopLeft, PlacementExChangedCallback)); + + private static void PlacementExChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + Poptip poptip = d as Poptip; + if (poptip != null) + { + EnumPlacement placement = (EnumPlacement)e.NewValue; + switch (placement) + { + case EnumPlacement.LeftTop: + break; + case EnumPlacement.LeftBottom: + break; + case EnumPlacement.LeftCenter: + break; + case EnumPlacement.RightTop: + break; + case EnumPlacement.RightBottom: + break; + case EnumPlacement.RightCenter: + break; + case EnumPlacement.TopLeft: + break; + case EnumPlacement.TopCenter: + poptip.Placement = PlacementMode.Top; + break; + case EnumPlacement.TopRight: + break; + case EnumPlacement.BottomLeft: + break; + case EnumPlacement.BottomCenter: + break; + case EnumPlacement.BottomRight: + break; + default: + break; + } + } + } + + #endregion + + #region Background + + public Brush Background + { + get { return (Brush)GetValue(BackgroundProperty); } + set { SetValue(BackgroundProperty, value); } + } + + public static readonly DependencyProperty BackgroundProperty = + DependencyProperty.Register("Background", typeof(Brush), typeof(Poptip), new PropertyMetadata(Brushes.White)); + + #endregion + + #region BorderThickness + + public Thickness BorderThickness + { + get { return (Thickness)GetValue(BorderThicknessProperty); } + set { SetValue(BorderThicknessProperty, value); } + } + + public static readonly DependencyProperty BorderThicknessProperty = + DependencyProperty.Register("BorderThickness", typeof(Thickness), typeof(Poptip), new PropertyMetadata(new Thickness(1))); + + #endregion + + #region BorderBrush + + public Brush BorderBrush + { + get { return (Brush)GetValue(BorderBrushProperty); } + set { SetValue(BorderBrushProperty, value); } + } + + public static readonly DependencyProperty BorderBrushProperty = + DependencyProperty.Register("BorderBrush", typeof(Brush), typeof(Poptip), new PropertyMetadata(new SolidColorBrush(Color.FromRgb(204, 206, 219)))); + + #endregion + + #region CornerRadius + + public CornerRadius CornerRadius + { + get { return (CornerRadius)GetValue(CornerRadiusProperty); } + set { SetValue(CornerRadiusProperty, value); } + } + + public static readonly DependencyProperty CornerRadiusProperty = + DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(Poptip), new PropertyMetadata(new CornerRadius(5))); + + #endregion + + #endregion + + #region Override + + protected override void OnInitialized(EventArgs e) + { + base.OnInitialized(e); + + this.AllowsTransparency = true; + //this.StaysOpen = false; + + UIElement element = this.Child; + this.Child = null; + + Grid root = new Grid() + { + Margin = new Thickness(10), + }; + + angleBorder = new AngleBorder() + { + Background = this.Background, + CornerRadius = this.CornerRadius, + BorderThickness = this.BorderThickness, + BorderBrush = this.BorderBrush, + }; + switch (this.PlacementEx) + { + case EnumPlacement.LeftTop: + angleBorder.Placement = EnumPlacement.RightTop; + break; + case EnumPlacement.LeftBottom: + angleBorder.Placement = EnumPlacement.RightBottom; + break; + case EnumPlacement.LeftCenter: + angleBorder.Placement = EnumPlacement.RightCenter; + break; + case EnumPlacement.RightTop: + angleBorder.Placement = EnumPlacement.LeftTop; + break; + case EnumPlacement.RightBottom: + angleBorder.Placement = EnumPlacement.LeftBottom; + break; + case EnumPlacement.RightCenter: + angleBorder.Placement = EnumPlacement.LeftCenter; + break; + case EnumPlacement.TopLeft: + angleBorder.Placement = EnumPlacement.BottomLeft; + break; + case EnumPlacement.TopCenter: + angleBorder.Placement = EnumPlacement.BottomCenter; + break; + case EnumPlacement.TopRight: + angleBorder.Placement = EnumPlacement.BottomRight; + break; + case EnumPlacement.BottomLeft: + angleBorder.Placement = EnumPlacement.TopLeft; + break; + case EnumPlacement.BottomCenter: + angleBorder.Placement = EnumPlacement.TopCenter; + break; + case EnumPlacement.BottomRight: + angleBorder.Placement = EnumPlacement.TopRight; + break; + default: + break; + } + + //在原有控件基础上,最外层套一个AngleBorder + angleBorder.Child = element; + + root.Children.Add(angleBorder); + + this.Child = root; + } + + protected override void OnOpened(EventArgs e) + { + base.OnOpened(e); + + if (this.mIsLoaded) + { + return; + } + + FrameworkElement targetElement = this.PlacementTarget as FrameworkElement; + FrameworkElement child = this.Child as FrameworkElement; + + if (targetElement == null || child == null) return; + + switch (this.PlacementEx) + { + case EnumPlacement.LeftTop: + this.Placement = PlacementMode.Left; + break; + case EnumPlacement.LeftBottom: + this.Placement = PlacementMode.Left; + this.VerticalOffset = targetElement.ActualHeight - child.ActualHeight; + break; + case EnumPlacement.LeftCenter: + this.Placement = PlacementMode.Left; + this.VerticalOffset = this.GetOffset(targetElement.ActualHeight, child.ActualHeight); + break; + case EnumPlacement.RightTop: + this.Placement = PlacementMode.Right; + break; + case EnumPlacement.RightBottom: + this.Placement = PlacementMode.Right; + this.VerticalOffset = targetElement.ActualHeight - child.ActualHeight; + break; + case EnumPlacement.RightCenter: + this.Placement = PlacementMode.Right; + this.VerticalOffset = this.GetOffset(targetElement.ActualHeight, child.ActualHeight); + break; + case EnumPlacement.TopLeft: + this.Placement = PlacementMode.Top; + break; + case EnumPlacement.TopCenter: + this.Placement = PlacementMode.Top; + this.HorizontalOffset = this.GetOffset(targetElement.ActualWidth, child.ActualWidth); + break; + case EnumPlacement.TopRight: + this.Placement = PlacementMode.Top; + this.HorizontalOffset = targetElement.ActualWidth - child.ActualWidth; + break; + case EnumPlacement.BottomLeft: + this.Placement = PlacementMode.Bottom; + break; + case EnumPlacement.BottomCenter: + this.Placement = PlacementMode.Bottom; + this.HorizontalOffset = this.GetOffset(targetElement.ActualWidth, child.ActualWidth); + break; + case EnumPlacement.BottomRight: + this.Placement = PlacementMode.Bottom; + this.HorizontalOffset = targetElement.ActualWidth - child.ActualWidth; + break; + } + this.mIsLoaded = true; + } + + #endregion + + #region private function + + private double GetOffset(double targetSize, double poptipSize) + { + if (double.IsNaN(targetSize) || double.IsNaN(poptipSize)) + { + return 0; + } + return (targetSize / 2.0) - (poptipSize / 2.0); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems index 7006f532..177ddfed 100644 --- a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems +++ b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems @@ -76,6 +76,8 @@ + +