diff --git a/data/templates/project/CSharp/WPFApplication.xpt b/data/templates/project/CSharp/WPFApplication.xpt index ecbd2d5d48..37d67858aa 100644 --- a/data/templates/project/CSharp/WPFApplication.xpt +++ b/data/templates/project/CSharp/WPFApplication.xpt @@ -37,13 +37,9 @@ WinExe - - - - @@ -59,28 +55,25 @@ using System.Configuration; namespace ${StandardNamespace} { - /// - /// Interaction logic for App.xaml - /// - - public partial class App : Application - { - - public App() - { - InitializeComponent(); - } - - } + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + public App() + { + InitializeComponent(); + } + } }]]> - - - + xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + Title="${StandardNamespace}" Height="300" Width="300" + > + + + ]]> - /// Interaction logic for Window1.xaml - /// - - public partial class Window1 : Window - { - - public Window1() - { - InitializeComponent(); - } - - } + /// + /// Interaction logic for Window1.xaml + /// + public partial class Window1 : Window + { + public Window1() + { + InitializeComponent(); + } + } }]]> diff --git a/data/templates/project/CSharp/WPFNavigationApplication.xpt b/data/templates/project/CSharp/WPFNavigationApplication.xpt index 6e90ff8ba6..fa2995c582 100644 --- a/data/templates/project/CSharp/WPFNavigationApplication.xpt +++ b/data/templates/project/CSharp/WPFNavigationApplication.xpt @@ -36,20 +36,16 @@ WinExe - - - - - - - + xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + StartupUri="Page1.xaml" + > + + + ]]> - /// Interaction logic for App.xaml - /// - - public partial class App : Application - { - - public App() - { - InitializeComponent(); - } - - } + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + public App() + { + InitializeComponent(); + } + } }]]> - - - + xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + Title="Page1" + > + + + ]]> - /// Interaction logic for Page1.xaml - /// - - public partial class Page1 : Page - { - public Page1() - { - InitializeComponent(); - } - - } + /// + /// Interaction logic for Page1.xaml + /// + public partial class Page1 : Page + { + public Page1() + { + InitializeComponent(); + } + } }]]> diff --git a/src/AddIns/DisplayBindings/WpfDesign/StandaloneDesigner/Toolbox.cs b/src/AddIns/DisplayBindings/WpfDesign/StandaloneDesigner/Toolbox.cs index 3ee4eb23aa..e205875d51 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/StandaloneDesigner/Toolbox.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/StandaloneDesigner/Toolbox.cs @@ -12,6 +12,7 @@ using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using ICSharpCode.WpfDesign; +using ICSharpCode.WpfDesign.Designer; using ICSharpCode.WpfDesign.Designer.Services; namespace StandaloneDesigner @@ -35,12 +36,10 @@ namespace StandaloneDesigner this.Items.Clear(); if (toolService != null) { AddTool("Pointer", toolService.PointerTool); - AddTool(typeof(Button)); - AddTool(typeof(TextBox)); - AddTool(typeof(CheckBox)); - AddTool(typeof(Label)); - AddTool(typeof(Canvas)); - AddTool(typeof(Grid)); + + foreach (Type t in DesignSurface.SupportedToolboxControls) + AddTool(t); + toolService.CurrentToolChanged += OnCurrentToolChanged; OnCurrentToolChanged(null, null); } diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfToolbox.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfToolbox.cs index c78e87b8e6..f95c5bfed5 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfToolbox.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfToolbox.cs @@ -45,11 +45,8 @@ namespace ICSharpCode.WpfDesign.AddIn sideTab.ChoosedItemChanged += OnChoosedItemChanged; sideTab.Items.Add(new WpfSideTabItem()); - sideTab.Items.Add(new WpfSideTabItem(typeof(WPF.Button))); - sideTab.Items.Add(new WpfSideTabItem(typeof(WPF.CheckBox))); - sideTab.Items.Add(new WpfSideTabItem(typeof(WPF.TextBox))); - sideTab.Items.Add(new WpfSideTabItem(typeof(WPF.Grid))); - sideTab.Items.Add(new WpfSideTabItem(typeof(WPF.Canvas))); + foreach (Type t in Designer.DesignSurface.SupportedToolboxControls) + sideTab.Items.Add(new WpfSideTabItem(t)); sideBar.Tabs.Add(sideTab); sideBar.ActiveTab = sideTab; diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfViewContent.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfViewContent.cs index 5248fa7565..0b7a83fb07 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfViewContent.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfViewContent.cs @@ -24,7 +24,7 @@ using ICSharpCode.WpfDesign.PropertyEditor; namespace ICSharpCode.WpfDesign.AddIn { /// - /// Description of WpfViewContent. + /// IViewContent implementation that hosts the WPF designer. /// public class WpfViewContent : AbstractViewContentHandlingLoadErrors, IHasPropertyContainer, IToolsHost { diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/TypeEditors/ContentEditor.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/TypeEditors/ContentEditor.cs index 85e1cfef48..a7966281d1 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/TypeEditors/ContentEditor.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/TypeEditors/ContentEditor.cs @@ -109,7 +109,6 @@ namespace ICSharpCode.WpfDesign.Designer.Controls.TypeEditors { } - EventHandler valueChangedListeners; internal bool preventSetValue; public override object Value { @@ -121,10 +120,8 @@ namespace ICSharpCode.WpfDesign.Designer.Controls.TypeEditors } } - public override event EventHandler ValueChanged { - add { valueChangedListeners += value; } - remove { valueChangedListeners -= value; } - } + // don't forward add/remove calls to the underlying property, but register them here + public override event EventHandler ValueChanged; public override System.ComponentModel.TypeConverter TypeConverter { get { return System.ComponentModel.TypeDescriptor.GetConverter(typeof(string)); } @@ -132,8 +129,8 @@ namespace ICSharpCode.WpfDesign.Designer.Controls.TypeEditors internal void RaiseValueChanged() { - if (valueChangedListeners != null) { - valueChangedListeners(this, EventArgs.Empty); + if (ValueChanged != null) { + ValueChanged(this, EventArgs.Empty); } } } diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/TypeEditors/CursorEditor.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/TypeEditors/CursorEditor.cs new file mode 100644 index 0000000000..fb265a66bd --- /dev/null +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/TypeEditors/CursorEditor.cs @@ -0,0 +1,25 @@ +// +// +// +// +// $Revision$ +// + +using System; +using System.Windows.Controls; +using ICSharpCode.WpfDesign.PropertyEditor; + +namespace ICSharpCode.WpfDesign.Designer.Controls.TypeEditors +{ + [TypeEditor(typeof(System.Windows.Input.Cursor))] + public class CursorEditor : ComboBox + { + public CursorEditor(IPropertyEditorDataProperty property) + { + foreach (object o in property.TypeConverter.GetStandardValues()) { + this.Items.Add(o); + } + SetBinding(ComboBox.SelectedItemProperty, PropertyEditorBindingHelper.CreateBinding(this, property)); + } + } +} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/TypeEditors/NullableBoolEditor.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/TypeEditors/NullableBoolEditor.cs new file mode 100644 index 0000000000..684b295f0e --- /dev/null +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/TypeEditors/NullableBoolEditor.cs @@ -0,0 +1,51 @@ +// +// +// +// +// $Revision$ +// + +using System; +using System.Windows.Controls; +using ICSharpCode.WpfDesign.PropertyEditor; + +namespace ICSharpCode.WpfDesign.Designer.Controls.TypeEditors +{ + [TypeEditor(typeof(bool?))] + public class NullableBoolEditor : ComboBox + { + readonly static Entry[] entries = { + new Entry(SharedInstances.BoxedTrue, bool.TrueString), + new Entry(SharedInstances.BoxedFalse, bool.FalseString), + new Entry(null, "Null") + }; + + public NullableBoolEditor(IPropertyEditorDataProperty property) + { + this.SelectedValuePath = "Value"; + this.ItemsSource = entries; + SetBinding(ComboBox.SelectedValueProperty, PropertyEditorBindingHelper.CreateBinding(this, property)); + } + + sealed class Entry + { + object val; + string description; + + public object Value { + get { return val; } + } + + public Entry(object val, string description) + { + this.val = val; + this.description = description; + } + + public override string ToString() + { + return description; + } + } + } +} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.cs index d979eefab7..cf18d409c4 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.cs @@ -23,6 +23,38 @@ namespace ICSharpCode.WpfDesign.Designer /// public sealed class DesignSurface : SingleVisualChildElement { + public static Type[] SupportedToolboxControls = { + typeof(Button), + typeof(CheckBox), + typeof(ComboBox), + typeof(Label), + typeof(TextBox), + typeof(RadioButton), + typeof(Canvas), + typeof(Grid), + typeof(Border), + typeof(DockPanel), + typeof(Expander), + typeof(GroupBox), + typeof(Image), + typeof(InkCanvas), + typeof(ListBox), + typeof(ListView), + typeof(Menu), + typeof(PasswordBox), + typeof(ProgressBar), + typeof(RichTextBox), + typeof(ScrollViewer), + typeof(Slider), + typeof(StackPanel), + typeof(TabControl), + typeof(ToolBar), + typeof(TreeView), + typeof(Viewbox), + typeof(Viewport3D), + typeof(WrapPanel) + }; + readonly ScrollViewer _scrollViewer; readonly DesignPanel _designPanel; DesignContext _designContext; diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/WpfDesign.Designer.csproj b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/WpfDesign.Designer.csproj index 6f2c45d744..5b2f4f3c68 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/WpfDesign.Designer.csproj +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/WpfDesign.Designer.csproj @@ -73,6 +73,8 @@ + +