diff --git a/src/AddIns/Misc/SearchAndReplace/Project/Commands/SearchToolbarCommands.cs b/src/AddIns/Misc/SearchAndReplace/Project/Commands/SearchToolbarCommands.cs
index 4c515e790b..e5a9e11b1c 100644
--- a/src/AddIns/Misc/SearchAndReplace/Project/Commands/SearchToolbarCommands.cs
+++ b/src/AddIns/Misc/SearchAndReplace/Project/Commands/SearchToolbarCommands.cs
@@ -6,9 +6,9 @@
//
using System;
-using System.Windows.Forms;
+using System.Windows.Controls;
using ICSharpCode.Core;
-using ICSharpCode.Core.WinForms;
+using System.Windows.Input;
namespace SearchAndReplace
{
@@ -18,6 +18,7 @@ namespace SearchAndReplace
public class FindComboBox : AbstractComboBoxCommand
{
ComboBox comboBox;
+
public FindComboBox()
{
}
@@ -31,9 +32,9 @@ namespace SearchAndReplace
comboBox.Text = SearchOptions.FindPattern;
}
- void OnKeyPress(object sender, KeyPressEventArgs e)
+ void OnKeyPress(object sender, KeyEventArgs e)
{
- if (e.KeyChar == '\r') {
+ if (e.Key == Key.Enter) {
CommitSearch();
e.Handled = true;
}
@@ -60,10 +61,10 @@ namespace SearchAndReplace
protected override void OnOwnerChanged(EventArgs e)
{
base.OnOwnerChanged(e);
- ToolBarComboBox toolbarItem = (ToolBarComboBox)Owner;
- comboBox = toolbarItem.ComboBox;
- comboBox.DropDownStyle = ComboBoxStyle.DropDown;
- comboBox.KeyPress += OnKeyPress;
+ comboBox = (ComboBox)Owner;
+ comboBox.IsEditable = true;
+ comboBox.KeyDown += OnKeyPress;
+ comboBox.Width = 130;
SearchOptions.Properties.PropertyChanged += new PropertyChangedEventHandler(SearchOptionsChanged);
RefreshComboBox();
diff --git a/src/AddIns/Misc/SearchAndReplace/Project/SearchAndReplace.csproj b/src/AddIns/Misc/SearchAndReplace/Project/SearchAndReplace.csproj
index dd89831c99..43bcba59e6 100644
--- a/src/AddIns/Misc/SearchAndReplace/Project/SearchAndReplace.csproj
+++ b/src/AddIns/Misc/SearchAndReplace/Project/SearchAndReplace.csproj
@@ -36,6 +36,12 @@
+
+ 3.0
+
+
+ 3.0
+
3.5
@@ -44,6 +50,9 @@
+
+ 3.0
+
diff --git a/src/Main/Base/Project/Src/Commands/ChooseLayoutCommand.cs b/src/Main/Base/Project/Src/Commands/ChooseLayoutCommand.cs
index 8f4519f146..61633d8b3b 100644
--- a/src/Main/Base/Project/Src/Commands/ChooseLayoutCommand.cs
+++ b/src/Main/Base/Project/Src/Commands/ChooseLayoutCommand.cs
@@ -8,11 +8,10 @@
using System;
using System.Collections.Generic;
using System.IO;
-using System.Windows.Forms;
using ICSharpCode.Core;
-using ICSharpCode.Core.WinForms;
using ICSharpCode.SharpDevelop.Gui;
+using System.Windows.Forms;
namespace ICSharpCode.SharpDevelop.Commands
{
@@ -42,7 +41,7 @@ namespace ICSharpCode.SharpDevelop.Commands
if (editingLayout) return;
LoggingService.Debug("ChooseLayoutCommand.Run()");
- ComboBox comboBox = ((ToolBarComboBox)Owner).ComboBox;
+ var comboBox = (System.Windows.Controls.ComboBox)Owner;
string dataPath = Path.Combine(PropertyService.DataDirectory, "resources" + Path.DirectorySeparatorChar + "layouts");
string configPath = Path.Combine(PropertyService.ConfigDirectory, "layouts");
if (!Directory.Exists(configPath)) {
@@ -157,8 +156,7 @@ namespace ICSharpCode.SharpDevelop.Commands
{
if (editingLayout) return;
LoggingService.Debug("ChooseLayoutCommand.LayoutChanged(object,EventArgs)");
- ToolBarComboBox toolbarItem = (ToolBarComboBox)Owner;
- ComboBox comboBox = toolbarItem.ComboBox;
+ var comboBox = (System.Windows.Controls.ComboBox)Owner;
for (int i = 0; i < comboBox.Items.Count; ++i) {
if (((LayoutConfiguration)comboBox.Items[i]).Name == LayoutConfiguration.CurrentLayoutName) {
comboBox.SelectedIndex = i;
@@ -169,23 +167,28 @@ namespace ICSharpCode.SharpDevelop.Commands
protected override void OnOwnerChanged(EventArgs e)
{
base.OnOwnerChanged(e);
- ToolBarComboBox toolbarItem = (ToolBarComboBox)Owner;
- ComboBox comboBox = toolbarItem.ComboBox;
- comboBox.Items.Clear();
- int index = 0;
- foreach (LayoutConfiguration config in LayoutConfiguration.Layouts) {
- if (LayoutConfiguration.CurrentLayoutName == config.Name) {
- index = comboBox.Items.Count;
+
+ editingLayout = true;
+ try {
+ var comboBox = (System.Windows.Controls.ComboBox)Owner;
+ comboBox.Items.Clear();
+ int index = 0;
+ foreach (LayoutConfiguration config in LayoutConfiguration.Layouts) {
+ if (LayoutConfiguration.CurrentLayoutName == config.Name) {
+ index = comboBox.Items.Count;
+ }
+ comboBox.Items.Add(config);
}
- comboBox.Items.Add(config);
+ editIndex = comboBox.Items.Count;
+
+ comboBox.Items.Add(StringParser.Parse("${res:ICSharpCode.SharpDevelop.Commands.ChooseLayoutCommand.EditItem}"));
+
+ resetIndex = comboBox.Items.Count;
+ comboBox.Items.Add(StringParser.Parse("${res:ICSharpCode.SharpDevelop.Commands.ChooseLayoutCommand.ResetToDefaultItem}"));
+ comboBox.SelectedIndex = index;
+ } finally {
+ editingLayout = false;
}
- editIndex = comboBox.Items.Count;
-
- comboBox.Items.Add(StringParser.Parse("${res:ICSharpCode.SharpDevelop.Commands.ChooseLayoutCommand.EditItem}"));
-
- resetIndex = comboBox.Items.Count;
- comboBox.Items.Add(StringParser.Parse("${res:ICSharpCode.SharpDevelop.Commands.ChooseLayoutCommand.ResetToDefaultItem}"));
- comboBox.SelectedIndex = index;
}
}
}
diff --git a/src/Main/ICSharpCode.Core.Presentation/ICSharpCode.Core.Presentation.csproj b/src/Main/ICSharpCode.Core.Presentation/ICSharpCode.Core.Presentation.csproj
index bf90f38d69..5056f24f1a 100644
--- a/src/Main/ICSharpCode.Core.Presentation/ICSharpCode.Core.Presentation.csproj
+++ b/src/Main/ICSharpCode.Core.Presentation/ICSharpCode.Core.Presentation.csproj
@@ -71,6 +71,7 @@
+
diff --git a/src/Main/ICSharpCode.Core.Presentation/ToolBar/ToolBarComboBox.cs b/src/Main/ICSharpCode.Core.Presentation/ToolBar/ToolBarComboBox.cs
new file mode 100644
index 0000000000..0c0e7e9217
--- /dev/null
+++ b/src/Main/ICSharpCode.Core.Presentation/ToolBar/ToolBarComboBox.cs
@@ -0,0 +1,31 @@
+//
+//
+//
+//
+// $Revision$
+//
+
+using System;
+using System.Windows.Controls;
+
+namespace ICSharpCode.Core.Presentation
+{
+ sealed class ToolBarComboBox : ComboBox
+ {
+// readonly Codon codon;
+// readonly object caller;
+ IComboBoxCommand menuCommand;
+
+ public ToolBarComboBox(Codon codon, object caller)
+ {
+ this.IsEditable = false;
+ menuCommand = (IComboBoxCommand)codon.AddIn.CreateObject(codon.Properties["class"]);
+ menuCommand.Owner = this;
+ }
+ protected override void OnSelectionChanged(SelectionChangedEventArgs e)
+ {
+ base.OnSelectionChanged(e);
+ menuCommand.Run();
+ }
+ }
+}
diff --git a/src/Main/ICSharpCode.Core.Presentation/ToolBar/ToolBarService.cs b/src/Main/ICSharpCode.Core.Presentation/ToolBar/ToolBarService.cs
index 82b4c5231b..ab1333bd81 100644
--- a/src/Main/ICSharpCode.Core.Presentation/ToolBar/ToolBarService.cs
+++ b/src/Main/ICSharpCode.Core.Presentation/ToolBar/ToolBarService.cs
@@ -64,8 +64,7 @@ namespace ICSharpCode.Core.Presentation
case "Item":
return new ToolBarButton(codon, caller, createCommand);
case "ComboBox":
- return "ComboBox";
- //return new ToolBarComboBox(codon, caller);
+ return new ToolBarComboBox(codon, caller);
case "TextBox":
return "TextBox";
//return new ToolBarTextBox(codon, caller);