|
@@ -12,6 +12,7 @@ using static PDF_Office.CustomControl.ColorDropBox;
|
|
|
|
|
|
namespace PDF_Office.Helper
|
|
|
{
|
|
|
+ #region 悬浮窗口
|
|
|
public class AdornerPresenter : Adorner
|
|
|
{
|
|
|
private VisualCollection VisualChildren;
|
|
@@ -212,4 +213,61 @@ namespace PDF_Office.Helper
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 自定义菜单
|
|
|
+ //自定义菜单:事件绑定、内容等
|
|
|
+
|
|
|
+ public class CustomPopMenu
|
|
|
+ {
|
|
|
+ public ContextMenu PopMenu { get; private set; }
|
|
|
+ public CustomPopMenu(ContextMenu popMenu)
|
|
|
+ {
|
|
|
+ PopMenu = popMenu;
|
|
|
+ }
|
|
|
+
|
|
|
+ private MenuItem ContainterOfIndex(int index)
|
|
|
+ {
|
|
|
+ if (PopMenu == null || PopMenu.Items.Count < index || index < 0)
|
|
|
+ return null;
|
|
|
+
|
|
|
+ MenuItem menuItem = PopMenu.Items[index] as MenuItem;
|
|
|
+ return menuItem;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void SetVisibilityProperty(int index, bool isVisual)
|
|
|
+ {
|
|
|
+ var menuItem = ContainterOfIndex(index);
|
|
|
+ if (menuItem != null)
|
|
|
+ {
|
|
|
+ menuItem.Visibility = (isVisual?Visibility.Visible:Visibility.Collapsed);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public void SetHeaderProperty(int index, string header)
|
|
|
+ {
|
|
|
+ var menuItem = ContainterOfIndex(index);
|
|
|
+
|
|
|
+ if (menuItem != null)
|
|
|
+ {
|
|
|
+ menuItem.Header = header;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void SetMenuBinding(int index, object commandTarget, ICommand command)
|
|
|
+ {
|
|
|
+ var menuItem = ContainterOfIndex(index);
|
|
|
+
|
|
|
+ if (menuItem != null)
|
|
|
+ {
|
|
|
+ menuItem.CommandTarget = (UIElement)commandTarget;
|
|
|
+ menuItem.Command = command;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
}
|