diff --git a/src/AddIns/DisplayBindings/WpfDesign/StandaloneDesigner/EventHandlerService.cs b/src/AddIns/DisplayBindings/WpfDesign/StandaloneDesigner/EventHandlerService.cs index c4ff83c607..310f09f9f7 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/StandaloneDesigner/EventHandlerService.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/StandaloneDesigner/EventHandlerService.cs @@ -1,4 +1,4 @@ -// +// // // // @@ -22,24 +22,19 @@ namespace StandaloneDesigner this.mainWindow = mainWindow; } - public void CreateEventHandler(DesignItem item, DesignItemProperty eventProperty) + public void CreateEventHandler(DesignItemProperty eventProperty) { + var item = eventProperty.DesignItem; string handlerName = (string)eventProperty.ValueOnInstance; + if (string.IsNullOrEmpty(handlerName)) { - if (string.IsNullOrEmpty(item.Name)) { - // cannot create event for unnamed controls - if (mainWindow.propertyEditor.NameTextBox.Focus()) { - IErrorService errorService = item.Context.Services.GetService(); - if (errorService != null) { - Label errorLabel = new Label(); - errorLabel.Content = "You need to give the " + item.ComponentType.Name + " a name."; - errorService.ShowErrorTooltip(mainWindow.propertyEditor.NameTextBox, errorLabel); - } - } - return; + string prefix = item.Name; + if (string.IsNullOrEmpty(prefix)) { + //TODO + prefix = item.ComponentType.Name; } - - handlerName = item.Name + eventProperty.Name; + + handlerName = prefix + eventProperty.Name; eventProperty.SetValue(handlerName); } diff --git a/src/AddIns/DisplayBindings/WpfDesign/StandaloneDesigner/Files/1.xaml b/src/AddIns/DisplayBindings/WpfDesign/StandaloneDesigner/Files/1.xaml new file mode 100644 index 0000000000..cca7754177 --- /dev/null +++ b/src/AddIns/DisplayBindings/WpfDesign/StandaloneDesigner/Files/1.xaml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/WpfDesign/StandaloneDesigner/StandaloneDesigner.csproj b/src/AddIns/DisplayBindings/WpfDesign/StandaloneDesigner/StandaloneDesigner.csproj index ffc74677a5..53ecbd1218 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/StandaloneDesigner/StandaloneDesigner.csproj +++ b/src/AddIns/DisplayBindings/WpfDesign/StandaloneDesigner/StandaloneDesigner.csproj @@ -1,4 +1,4 @@ - + {84D65E9C-B66C-44C3-95FD-445EFE3ED322} Debug @@ -6,6 +6,13 @@ WinExe StandaloneDesigner StandaloneDesigner + v3.5 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + + 2.0 + + bin\Debug\ @@ -27,6 +34,9 @@ + + 3.5 + @@ -37,9 +47,11 @@ - - + + MSBuild:Compile + Designer + GlobalAssemblyInfo.cs @@ -54,7 +66,14 @@ Code Window1.xaml - + + Designer + PreserveNewest + + + MSBuild:Compile + Designer + {78CC29AC-CC79-4355-B1F2-97936DF198AC} WpfDesign.Designer @@ -63,7 +82,6 @@ {66A378A1-E9F4-4AD5-8946-D0EC06C2902F} WpfDesign - diff --git a/src/AddIns/DisplayBindings/WpfDesign/StandaloneDesigner/Window1.xaml b/src/AddIns/DisplayBindings/WpfDesign/StandaloneDesigner/Window1.xaml index eef982e153..705d6f007f 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/StandaloneDesigner/Window1.xaml +++ b/src/AddIns/DisplayBindings/WpfDesign/StandaloneDesigner/Window1.xaml @@ -1,63 +1,60 @@  - - - - - - - - - - - - - - - - - - - - - - - - - - - - ]]> - - - - - - - - - - - - - - - - - - - - + SnapsToDevicePixels="True" + Title="StandaloneDesigner" + WindowState="Maximized"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/WpfDesign/StandaloneDesigner/Window1.xaml.cs b/src/AddIns/DisplayBindings/WpfDesign/StandaloneDesigner/Window1.xaml.cs index ac3f009c12..734cbebc60 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/StandaloneDesigner/Window1.xaml.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/StandaloneDesigner/Window1.xaml.cs @@ -9,7 +9,7 @@ using System.Xml; using ICSharpCode.WpfDesign; using ICSharpCode.WpfDesign.Designer; using ICSharpCode.WpfDesign.Designer.Xaml; -using ICSharpCode.WpfDesign.PropertyEditor; +using ICSharpCode.WpfDesign.PropertyGrid; using System.Threading; using System.Windows.Threading; @@ -27,6 +27,7 @@ namespace StandaloneDesigner }; try { InitializeComponent(); + CodeTextBox.Text = File.ReadAllText("Files/1.xaml"); foreach (object o in toolBar.Items) { if (o is Button) { (o as Button).CommandTarget = designSurface; @@ -53,7 +54,7 @@ namespace StandaloneDesigner toolbox.ToolService = designSurface.DesignContext.Services.Tool; } else { if (designSurface.DesignContext != null) { - propertyEditor.EditedObject = null; + propertyGridView.PropertyGrid.SelectedItems = null; using (StringWriter writer = new StringWriter()) { using (XmlTextWriter xmlWriter = new XmlTextWriter(writer)) { @@ -75,8 +76,7 @@ namespace StandaloneDesigner ISelectionService selectionService = designSurface.DesignContext.Services.Selection; ICollection items = selectionService.SelectedItems; if (!IsCollectionWithSameElements(items, oldItems)) { - IPropertyEditorDataSource dataSource = DesignItemDataSource.GetDataSourceForDesignItems(items); - propertyEditor.EditedObject = dataSource; + propertyGridView.PropertyGrid.SelectedItems = items; oldItems = items; } } @@ -109,7 +109,4 @@ namespace StandaloneDesigner timer.Start(); } } -} - - - +} \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/AbstractEventHandlerService.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/AbstractEventHandlerService.cs index 68eaa10f46..64313ba8dc 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/AbstractEventHandlerService.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/AbstractEventHandlerService.cs @@ -1,4 +1,4 @@ -// +// // // // @@ -68,29 +68,18 @@ namespace ICSharpCode.WpfDesign.AddIn protected abstract void CreateEventHandlerInternal(Type eventHandlerType, string handlerName); - public void CreateEventHandler(DesignItem item, DesignItemProperty eventProperty) + public void CreateEventHandler(DesignItemProperty eventProperty) { - string handlerName = (string)eventProperty.ValueOnInstance; - if (string.IsNullOrEmpty(handlerName)) { - if (string.IsNullOrEmpty(item.Name)) { - PadDescriptor padContent = WorkbenchSingleton.Workbench.GetPad(typeof(PropertyPad)); - if (padContent != null) { - padContent.BringPadToFront(); - } - - // cannot create event for unnamed controls - if (viewContent.PropertyEditor.NameTextBox.Focus()) { - IErrorService errorService = item.Context.Services.GetService(); - if (errorService != null) { - Label errorLabel = new Label(); - errorLabel.Content = "You need to give the " + item.ComponentType.Name + " a name."; - errorService.ShowErrorTooltip(viewContent.PropertyEditor.NameTextBox, errorLabel); - } - } - return; + var item = eventProperty.DesignItem; + string handlerName = (string)eventProperty.ValueOnInstance; + + if (string.IsNullOrEmpty(handlerName)) { + string prefix = item.Name; + if (string.IsNullOrEmpty(prefix)) { + prefix = item.ComponentType.Name; } - - handlerName = item.Name + eventProperty.Name; + + handlerName = prefix + eventProperty.Name; eventProperty.SetValue(handlerName); } CreateEventHandlerInternal(eventProperty.ReturnType, handlerName); diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/CSharpEventHandlerService.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/CSharpEventHandlerService.cs index 466334c493..d5af2306f2 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/CSharpEventHandlerService.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/CSharpEventHandlerService.cs @@ -1,4 +1,4 @@ -// +// // // // diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/ChooseClass.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/ChooseClass.cs index 50e1f1a562..8cb769ad21 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/ChooseClass.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/ChooseClass.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Windows.Data; diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/ChooseClassDialog.xaml b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/ChooseClassDialog.xaml index 54863add55..c72a1c7121 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/ChooseClassDialog.xaml +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/ChooseClassDialog.xaml @@ -1,4 +1,4 @@ - GetAssemblies() + { + var pc = ParserService.CurrentProjectContent; + var a = GetAssembly(pc); + if (a != null) yield return a; + foreach (var r in pc.ReferencedContents) { + a = GetAssembly(r); + if (a != null) yield return a; + } + } + } +} \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/ObjectEditor.xaml b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/ObjectEditor.xaml index 960944a5aa..6456e70d4e 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/ObjectEditor.xaml +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/ObjectEditor.xaml @@ -1,4 +1,4 @@ -