Browse Source

WpfDesign: remove "Func" classes, use LINQ instead.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@3077 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 18 years ago
parent
commit
c973d32937
  1. 3
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/AdornerLayer.cs
  2. 12
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/PropertyEditor/PropertyEditor.cs
  3. 11
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/TypeEditors/BrushEditor.cs
  4. 69
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/TypeEditors/BrushEditorDialog.xaml.cs
  5. 5
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.cs
  6. 3
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PanelInstanceFactory.cs
  7. 56
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Func.cs
  8. 5
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/ModelTools.cs
  9. 1
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/WpfDesign.Designer.csproj
  10. 3
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Extensions/ExtensionManager.cs
  11. 76
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Func.cs
  12. 11
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementOperation.cs
  13. 3
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/DesignItemDataSource.cs
  14. 3
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/MultipleSelectionDataSource.cs
  15. 14
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/TextBoxEditor.cs
  16. 7
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/WpfDesign.csproj

3
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/AdornerLayer.cs

@ -64,7 +64,8 @@ namespace ICSharpCode.WpfDesign.Designer.Controls @@ -64,7 +64,8 @@ namespace ICSharpCode.WpfDesign.Designer.Controls
public void CopyTo(AdornerPanel[] array, int arrayIndex)
{
Func.ToArray(this).CopyTo(array, arrayIndex);
foreach (AdornerPanel panel in this)
array[arrayIndex++] = panel;
}
public bool Remove(AdornerPanel item)

12
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/PropertyEditor/PropertyEditor.cs

@ -9,6 +9,7 @@ using System; @@ -9,6 +9,7 @@ using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
@ -92,7 +93,7 @@ namespace ICSharpCode.WpfDesign.Designer @@ -92,7 +93,7 @@ namespace ICSharpCode.WpfDesign.Designer
if (useCategories) {
List<PropertyEditorCategoryView> categories = new List<PropertyEditorCategoryView>();
foreach (IPropertyEditorDataProperty p in Func.Sort(dataSource.Properties, CompareMemberNames)) {
foreach (IPropertyEditorDataProperty p in dataSource.Properties.OrderBy(p2 => p2.Name)) {
if (p.Name == "Name") {
continue;
}
@ -111,7 +112,7 @@ namespace ICSharpCode.WpfDesign.Designer @@ -111,7 +112,7 @@ namespace ICSharpCode.WpfDesign.Designer
} else {
PropertyGridView grid = new PropertyGridView();
contentStackPanel.Children.Add(grid);
foreach (IPropertyEditorDataProperty p in Func.Sort(dataSource.Properties, CompareMemberNames)) {
foreach (IPropertyEditorDataProperty p in dataSource.Properties.OrderBy(p2 => p2.Name)) {
if (p.Name == "Name") {
continue;
}
@ -128,16 +129,11 @@ namespace ICSharpCode.WpfDesign.Designer @@ -128,16 +129,11 @@ namespace ICSharpCode.WpfDesign.Designer
PropertyGridView grid = new PropertyGridView();
contentStackPanel.Children.Add(grid);
foreach (IPropertyEditorDataEvent e in Func.Sort(dataSource.Events, CompareMemberNames)) {
foreach (IPropertyEditorDataEvent e in dataSource.Events.OrderBy(p => p.Name)) {
grid.AddEvent(e);
}
}
static int CompareMemberNames(IPropertyEditorDataMember p1, IPropertyEditorDataMember p2)
{
return p1.Name.CompareTo(p2.Name);
}
HashSet<string> expandedCategories = new HashSet<string>();
PropertyEditorCategoryView GetOrCreateCategory(List<PropertyEditorCategoryView> categories, string category)

11
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/TypeEditors/BrushEditor.cs

@ -46,15 +46,22 @@ namespace ICSharpCode.WpfDesign.Designer.Controls.TypeEditors @@ -46,15 +46,22 @@ namespace ICSharpCode.WpfDesign.Designer.Controls.TypeEditors
SetDock(ddb, Dock.Right);
this.Children.Add(ddb);
this.Children.Add(brushShowingBorder);
this.Unloaded += delegate {
if (dlg != null)
dlg.Close();
};
}
BrushEditorDialog dlg;
void DropDownButtonClick(object sender, RoutedEventArgs e)
{
BrushEditorDialog dlg = new BrushEditorDialog();
dlg = new BrushEditorDialog(property);
Point pos = ddb.PointToScreen(new Point(ddb.ActualWidth, ddb.ActualHeight));
dlg.Left = pos.X - dlg.Width;
dlg.Top = pos.Y;
dlg.SelectedBrush = brushShowingBorder.BorderBrush;
dlg.SelectedBrush = property.Value as Brush;
dlg.SelectedBrushChanged += delegate {
property.Value = dlg.SelectedBrush;
};

69
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/TypeEditors/BrushEditorDialog.xaml.cs

@ -1,9 +1,10 @@ @@ -1,9 +1,10 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Windows;
using System.Linq;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
@ -12,6 +13,9 @@ using System.Windows.Media; @@ -12,6 +13,9 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using ICSharpCode.WpfDesign.PropertyEditor;
using System.Windows.Threading;
namespace ICSharpCode.WpfDesign.Designer.Controls.TypeEditors
{
/// <summary>
@ -25,7 +29,7 @@ namespace ICSharpCode.WpfDesign.Designer.Controls.TypeEditors @@ -25,7 +29,7 @@ namespace ICSharpCode.WpfDesign.Designer.Controls.TypeEditors
ControlTemplate RadioButtonTemplate;
public BrushEditorDialog()
public BrushEditorDialog(IPropertyEditorDataProperty property)
{
InitializeComponent();
@ -35,7 +39,7 @@ namespace ICSharpCode.WpfDesign.Designer.Controls.TypeEditors @@ -35,7 +39,7 @@ namespace ICSharpCode.WpfDesign.Designer.Controls.TypeEditors
const int smallColorSquareSize = 12;
// special brushes:
AddColorSquare(null, null, "null", bigColorSquareSize);
AddColorSquare(null, null, "null", bigColorSquareSize).IsChecked = true;
AddColorSquare(Brushes.Black, null, "Black", bigColorSquareSize);
AddColorSquare(Brushes.White, null, "White", bigColorSquareSize);
AddColorSquare(Brushes.Transparent, null, "Transparent", bigColorSquareSize);
@ -49,13 +53,27 @@ namespace ICSharpCode.WpfDesign.Designer.Controls.TypeEditors @@ -49,13 +53,27 @@ namespace ICSharpCode.WpfDesign.Designer.Controls.TypeEditors
if (!specialBrushes.Contains(brush))
AddColorSquare(brush, null, p.Name, smallColorSquareSize);
}
canvas.Height = y + smallColorSquareSize;
y += smallColorSquareSize;
if (property != null) {
AddSeparatorLine();
TextBoxEditor textBoxEditor = new TextBoxEditor(property);
textBoxEditor.Width = 100;
Canvas.SetTop(textBoxEditor, y);
canvas.Children.Add(textBoxEditor);
textBoxEditor.ValueSaved += delegate {
this.SelectedBrush = textBoxEditor.Property.Value as Brush;
};
y += 21;
}
canvas.Height = y;
}
int x = 0;
int y = 0;
void AddColorSquare(Brush brush, UIElement content, string tooltip, int size)
RadioButton AddColorSquare(Brush brush, UIElement content, string tooltip, int size)
{
RadioButton radioButton = new RadioButton {
Background = brush,
@ -82,6 +100,7 @@ namespace ICSharpCode.WpfDesign.Designer.Controls.TypeEditors @@ -82,6 +100,7 @@ namespace ICSharpCode.WpfDesign.Designer.Controls.TypeEditors
x = 0;
y += size;
}
return radioButton;
}
void AddSeparatorLine()
@ -94,7 +113,6 @@ namespace ICSharpCode.WpfDesign.Designer.Controls.TypeEditors @@ -94,7 +113,6 @@ namespace ICSharpCode.WpfDesign.Designer.Controls.TypeEditors
Y1 = 0.5,
Y2 = 0.5
};
Canvas.SetLeft(line, 0);
Canvas.SetTop(line, y + 1);
canvas.Children.Add(line);
y += 3;
@ -110,7 +128,7 @@ namespace ICSharpCode.WpfDesign.Designer.Controls.TypeEditors @@ -110,7 +128,7 @@ namespace ICSharpCode.WpfDesign.Designer.Controls.TypeEditors
if (selectedBrush != value) {
selectedBrush = value;
foreach (RadioButton btn in canvas.Children.OfType<RadioButton>()) {
btn.IsChecked = btn.Background == value;
btn.IsChecked = BrushEquals(btn.Background, value);
}
if (SelectedBrushChanged != null) {
@ -120,12 +138,47 @@ namespace ICSharpCode.WpfDesign.Designer.Controls.TypeEditors @@ -120,12 +138,47 @@ namespace ICSharpCode.WpfDesign.Designer.Controls.TypeEditors
}
}
bool BrushEquals(Brush b1, Brush b2)
{
if (b1 == b2)
return true;
SolidColorBrush scb1 = b1 as SolidColorBrush;
SolidColorBrush scb2 = b2 as SolidColorBrush;
if (scb1 == null || scb2 == null)
return false;
return scb1.Color == scb2.Color;
}
public event EventHandler SelectedBrushChanged;
protected override void OnDeactivated(EventArgs e)
{
base.OnDeactivated(e);
Close();
CloseIfNotActive(null, null);
}
Window activeWindow;
void CloseIfNotActive(object sender, EventArgs e)
{
if (activeWindow != null) {
activeWindow.Deactivated -= CloseIfNotActive;
activeWindow = null;
}
Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(
delegate {
if (IsActive)
return;
foreach (Window child in OwnedWindows) {
Debug.WriteLine(child + " isActive=" + child.IsActive);
if (child.IsActive) {
activeWindow = child;
child.Deactivated += CloseIfNotActive;
return;
}
}
Close();
}));
}
}
}

5
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.cs

@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
@ -88,7 +89,7 @@ namespace ICSharpCode.WpfDesign.Designer @@ -88,7 +89,7 @@ namespace ICSharpCode.WpfDesign.Designer
void OnUndoExecuted(object sender, ExecutedRoutedEventArgs e)
{
UndoService undoService = GetService<UndoService>();
IUndoAction action = Func.First(undoService.UndoActions);
IUndoAction action = undoService.UndoActions.First();
Debug.WriteLine("Undo " + action.Title);
undoService.Undo();
_designContext.Services.Selection.SetSelectedComponents(GetLiveElements(action.AffectedElements));
@ -103,7 +104,7 @@ namespace ICSharpCode.WpfDesign.Designer @@ -103,7 +104,7 @@ namespace ICSharpCode.WpfDesign.Designer
void OnRedoExecuted(object sender, ExecutedRoutedEventArgs e)
{
UndoService undoService = GetService<UndoService>();
IUndoAction action = Func.First(undoService.RedoActions);
IUndoAction action = undoService.RedoActions.First();
Debug.WriteLine("Redo " + action.Title);
undoService.Redo();
_designContext.Services.Selection.SetSelectedComponents(GetLiveElements(action.AffectedElements));

3
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PanelInstanceFactory.cs

@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
using System;
using System.ComponentModel;
using System.Linq;
using System.Windows.Media;
using System.Windows.Controls;
using ICSharpCode.WpfDesign.Extensions;
@ -92,7 +93,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -92,7 +93,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
PropertyDescriptor property = properties[_parent._propertyName];
if (property != null) {
if ((properties as System.Collections.IDictionary).IsReadOnly) {
properties = new PropertyDescriptorCollection(Func.ToArray(properties));
properties = new PropertyDescriptorCollection(properties.Cast<PropertyDescriptor>().ToArray());
}
properties.Remove(property);
properties.Add(new ShadowPropertyDescriptor(_parent, property));

56
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Func.cs

@ -1,56 +0,0 @@ @@ -1,56 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision$</version>
// </file>
using System;
using System.ComponentModel;
using System.Collections.Generic;
namespace ICSharpCode.WpfDesign.Designer
{
delegate void Action();
// Static helpers that should become extension methods in the future
static class Func
{
public static T[] ToArray<T>(ICollection<T> collection)
{
T[] arr = new T[collection.Count];
collection.CopyTo(arr, 0);
return arr;
}
public static PropertyDescriptor[] ToArray(PropertyDescriptorCollection collection)
{
PropertyDescriptor[] arr = new PropertyDescriptor[collection.Count];
collection.CopyTo(arr, 0);
return arr;
}
/// <summary>
/// Returns a sorted copy of the collection.
/// </summary>
public static ICollection<T> Sort<T>(ICollection<T> collection, Comparison<T> comparison)
{
T[] arr = ToArray(collection);
Array.Sort(arr, comparison);
return arr;
}
/// <summary>
/// Returns the first element from <paramref name="input"/>.
/// </summary>
public static T First<T>(IEnumerable<T> input)
{
if (input == null)
throw new ArgumentNullException("input");
foreach (T item in input) {
return item;
}
throw new ArgumentException("input must not be an empty collection", "input");
}
}
}

5
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/ModelTools.cs

@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
using System;
using System.Collections.Generic;
using System.Windows;
using System.Linq;
namespace ICSharpCode.WpfDesign.Designer
{
@ -74,10 +75,10 @@ namespace ICSharpCode.WpfDesign.Designer @@ -74,10 +75,10 @@ namespace ICSharpCode.WpfDesign.Designer
/// </summary>
public static void DeleteComponents(ICollection<DesignItem> items)
{
DesignItem parent = Func.First(items).Parent;
DesignItem parent = items.First().Parent;
PlacementOperation operation = PlacementOperation.Start(items, PlacementType.Delete);
try {
ISelectionService selectionService = Func.First(items).Services.Selection;
ISelectionService selectionService = items.First().Services.Selection;
selectionService.SetSelectedComponents(items, SelectionTypes.Remove);
// if the selection is empty after deleting some components, select the parent of the deleted component
if (selectionService.SelectionCount == 0 && !items.Contains(parent)) {

1
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/WpfDesign.Designer.csproj

@ -98,7 +98,6 @@ @@ -98,7 +98,6 @@
<Compile Include="Extensions\TopLeftContainerDragHandle.cs" />
<Compile Include="Extensions\ResizeThumbExtension.cs" />
<Compile Include="Extensions\WindowResizeBehavior.cs" />
<Compile Include="Func.cs" />
<Compile Include="ServiceRequiredException.cs" />
<Compile Include="Services\ClickOrDragMouseGesture.cs" />
<Compile Include="Services\CreateComponentTool.cs" />

3
src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Extensions/ExtensionManager.cs

@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace ICSharpCode.WpfDesign.Extensions
@ -127,7 +128,7 @@ namespace ICSharpCode.WpfDesign.Extensions @@ -127,7 +128,7 @@ namespace ICSharpCode.WpfDesign.Extensions
foreach (ExtensionEntry entry in GetExtensionEntries(item)) {
servers.Add(entry.Server);
}
return Func.ToArray(servers);
return servers.ToArray();
}
internal IEnumerable<Extension> CreateExtensions(ExtensionServer server, DesignItem item)

76
src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Func.cs

@ -1,76 +0,0 @@ @@ -1,76 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
namespace ICSharpCode.WpfDesign
{
// Static helpers that should become extension methods in the future
static class Func
{
public static T[] ToArray<T>(ICollection<T> collection) where T : class
{
T[] arr = new T[collection.Count];
collection.CopyTo(arr, 0);
return arr;
}
/// <summary>
/// Outputs distinct elements only, filtering all duplicates.
/// </summary>
public static IEnumerable<T> Distinct<T>(IEnumerable<T> input) where T : class
{
// store elements already seen
HashSet<T> elements = new HashSet<T>();
foreach (T element in input) {
if (elements.Add(element)) {
yield return element;
}
}
}
/// <summary>
/// Returns the first element from <paramref name="input"/>.
/// </summary>
public static T First<T>(IEnumerable<T> input)
{
if (input == null)
throw new ArgumentNullException("input");
foreach (T item in input) {
return item;
}
throw new ArgumentException("input must not be an empty collection", "input");
}
/// <summary>
/// Skips the first <paramref name="skipCount"/> items in input and returns the rest.
/// </summary>
public static IEnumerable<T> Skip<T>(IEnumerable<T> input, long skipCount)
{
if (input == null)
throw new ArgumentNullException("input");
if (skipCount < 0)
throw new ArgumentOutOfRangeException("skipCount", skipCount, "skipCount must be non-negative.");
using (IEnumerator<T> enumerator = input.GetEnumerator()) {
if (skipCount != 0) {
long i = 0;
while (enumerator.MoveNext()) {
// skip item
if (++i == skipCount)
break;
}
if (i != skipCount) yield break; // MoveNext returned false, don't call it again
}
while (enumerator.MoveNext()) {
yield return enumerator.Current;
}
}
}
}
}

11
src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementOperation.cs

@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Diagnostics;
using System.Windows;
using System.Windows.Input;
@ -145,7 +146,7 @@ namespace ICSharpCode.WpfDesign @@ -145,7 +146,7 @@ namespace ICSharpCode.WpfDesign
throw new ArgumentNullException("placedItems");
if (type == null)
throw new ArgumentNullException("type");
DesignItem[] items = Func.ToArray(placedItems);
DesignItem[] items = placedItems.ToArray();
if (items.Length == 0)
throw new ArgumentException("placedItems.Length must be > 0");
@ -190,15 +191,15 @@ namespace ICSharpCode.WpfDesign @@ -190,15 +191,15 @@ namespace ICSharpCode.WpfDesign
throw new ArgumentNullException("items");
if (items.Count == 0)
return null;
DesignItem parent = Func.First(items).Parent;
foreach (DesignItem item in Func.Skip(items, 1)) {
DesignItem parent = items.First().Parent;
foreach (DesignItem item in items.Skip(1)) {
if (item.Parent != parent)
return null;
}
if (parent != null)
return parent.GetBehavior<IPlacementBehavior>();
else if (items.Count == 1)
return Func.First(items).GetBehavior<IRootPlacementBehavior>();
return items.First().GetBehavior<IRootPlacementBehavior>();
else
return null;
}
@ -228,7 +229,7 @@ namespace ICSharpCode.WpfDesign @@ -228,7 +229,7 @@ namespace ICSharpCode.WpfDesign
if (placedItems.Count != positions.Count)
throw new ArgumentException("positions.Count must be = placedItems.Count");
DesignItem[] items = Func.ToArray(placedItems);
DesignItem[] items = placedItems.ToArray();
PlacementOperation op = new PlacementOperation(items, type);
try {

3
src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/DesignItemDataSource.cs

@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
// </file>
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
@ -95,7 +96,7 @@ namespace ICSharpCode.WpfDesign.PropertyEditor @@ -95,7 +96,7 @@ namespace ICSharpCode.WpfDesign.PropertyEditor
}
designItemProperties.AddRange(item.Properties);
foreach (DesignItemProperty p in Func.Distinct(designItemProperties)) {
foreach (DesignItemProperty p in designItemProperties.Distinct()) {
if (p.IsEvent) {
events.Add(new DesignItemDataEvent(this, p));
} else {

3
src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/MultipleSelectionDataSource.cs

@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Media;
namespace ICSharpCode.WpfDesign.PropertyEditor
@ -53,7 +54,7 @@ namespace ICSharpCode.WpfDesign.PropertyEditor @@ -53,7 +54,7 @@ namespace ICSharpCode.WpfDesign.PropertyEditor
this.services = services;
if (sources == null)
throw new ArgumentNullException("sources");
data = Func.ToArray(sources);
data = sources.ToArray();
if (data.Length < 2)
throw new ArgumentException("The collection must have at least 2 items!");

14
src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/TextBoxEditor.cs

@ -28,6 +28,13 @@ namespace ICSharpCode.WpfDesign.PropertyEditor @@ -28,6 +28,13 @@ namespace ICSharpCode.WpfDesign.PropertyEditor
bool isDirty;
bool hasError;
/// <summary>
/// The property edited by the TextBoxEditor.
/// </summary>
public IPropertyEditorDataProperty Property {
get { return property; }
}
/// <summary>
/// Creates a new TextBoxEditor instance.
/// </summary>
@ -70,8 +77,15 @@ namespace ICSharpCode.WpfDesign.PropertyEditor @@ -70,8 +77,15 @@ namespace ICSharpCode.WpfDesign.PropertyEditor
hasError = true;
throw;
}
if (ValueSaved != null)
ValueSaved(this, EventArgs.Empty);
}
/// <summary>
/// Raised when the user changes the property value using this text box.
/// </summary>
public event EventHandler ValueSaved;
static UIElement DescribeError(Exception ex)
{
return new TextBlock(new Run(ex.Message));

7
src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/WpfDesign.csproj

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<ProjectGuid>{66A378A1-E9F4-4AD5-8946-D0EC06C2902F}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -18,6 +18,7 @@ @@ -18,6 +18,7 @@
<OutputPath>..\..\..\..\..\..\AddIns\AddIns\DisplayBindings\WpfDesign\</OutputPath>
<RunCodeAnalysis>False</RunCodeAnalysis>
<CodeAnalysisRules>-Microsoft.Globalization#CA1303</CodeAnalysisRules>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugSymbols>true</DebugSymbols>
@ -48,6 +49,9 @@ @@ -48,6 +49,9 @@
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="WindowsBase">
<Private>False</Private>
@ -85,7 +89,6 @@ @@ -85,7 +89,6 @@
<Compile Include="Extensions\LogicalExtensionServers.cs" />
<Compile Include="Extensions\SelectionExtensionServer.cs" />
<Compile Include="HashSet.cs" />
<Compile Include="Func.cs" />
<Compile Include="PlacementOperation.cs" />
<Compile Include="PlacementType.cs" />
<Compile Include="PropertyEditor\BooleanEditor.cs" />

Loading…
Cancel
Save