|
@@ -310,6 +310,14 @@ namespace PDF_Office.Helper
|
|
|
menuItem.Header = header;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ //设置UI内容
|
|
|
+ public void SetMenuUI(int index, UIElement controls)
|
|
|
+ {
|
|
|
+ PopMenu.Items.Insert(index, controls);
|
|
|
+ GetMenuItems();
|
|
|
+ }
|
|
|
+
|
|
|
//按索引号设置菜单
|
|
|
public void SetMenuBinding(int index, ICommand command,object comTarget = null)
|
|
|
{
|
|
@@ -318,10 +326,24 @@ namespace PDF_Office.Helper
|
|
|
if (menuItem != null)
|
|
|
{
|
|
|
if (comTarget == null)
|
|
|
- menuItem.CommandTarget = (UIElement)CommandTarget;
|
|
|
- else
|
|
|
- menuItem.CommandTarget = (UIElement)comTarget;
|
|
|
+ {
|
|
|
+ if (CommandTarget is UIElement)
|
|
|
+ {
|
|
|
+ menuItem.CommandTarget = (UIElement)CommandTarget;
|
|
|
+ }
|
|
|
|
|
|
+ menuItem.CommandParameter = CommandTarget;
|
|
|
+ }
|
|
|
+
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if(comTarget is UIElement)
|
|
|
+ {
|
|
|
+ menuItem.CommandTarget = (UIElement)comTarget;
|
|
|
+ }
|
|
|
+ menuItem.CommandParameter = comTarget;
|
|
|
+ }
|
|
|
+
|
|
|
menuItem.Command = command;
|
|
|
}
|
|
|
|