Browse Source

Allow changing the visibility of toolbar combobox using conditions.

pull/15/head
Daniel Grunwald 15 years ago
parent
commit
e469342370
  1. 6
      src/Main/ICSharpCode.Core.Presentation/ToolBar/ToolBarComboBox.cs

6
src/Main/ICSharpCode.Core.Presentation/ToolBar/ToolBarComboBox.cs

@ -11,12 +11,14 @@ namespace ICSharpCode.Core.Presentation
{ {
IComboBoxCommand menuCommand; IComboBoxCommand menuCommand;
readonly Codon codon; readonly Codon codon;
readonly object caller;
public ToolBarComboBox(Codon codon, object caller) public ToolBarComboBox(Codon codon, object caller)
{ {
if (codon == null) if (codon == null)
throw new ArgumentNullException("codon"); throw new ArgumentNullException("codon");
this.codon = codon; this.codon = codon;
this.caller = caller;
ToolTipService.SetShowOnDisabled(this, true); ToolTipService.SetShowOnDisabled(this, true);
this.IsEditable = false; this.IsEditable = false;
menuCommand = (IComboBoxCommand)codon.AddIn.CreateObject(codon.Properties["class"]); menuCommand = (IComboBoxCommand)codon.AddIn.CreateObject(codon.Properties["class"]);
@ -36,6 +38,10 @@ namespace ICSharpCode.Core.Presentation
public void UpdateStatus() public void UpdateStatus()
{ {
if (codon.GetFailedAction(caller) == ConditionFailedAction.Exclude)
this.Visibility = Visibility.Collapsed;
else
this.Visibility = Visibility.Visible;
} }
protected override void OnSelectionChanged(SelectionChangedEventArgs e) protected override void OnSelectionChanged(SelectionChangedEventArgs e)

Loading…
Cancel
Save