Browse Source

Fix to handled same command being added more than once

pull/522/head
tbulle 12 years ago
parent
commit
08f46b2be9
  1. 15
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/ExtensionMethods.cs

15
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/ExtensionMethods.cs

@ -80,7 +80,20 @@ namespace ICSharpCode.WpfDesign.Designer @@ -80,7 +80,20 @@ namespace ICSharpCode.WpfDesign.Designer
execute();
e.Handled = true;
};
element.CommandBindings.Add(cb);
bool replace = false;
for (int i = 0; i < element.CommandBindings.Count; i++)
{
if (element.CommandBindings[i].Command.Equals(cb.Command))
{
element.CommandBindings[i] = cb;
replace = true;
}
}
if (!replace)
element.CommandBindings.Add(cb);
}
}
}

Loading…
Cancel
Save