Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2671 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
10 changed files with 184 additions and 101 deletions
@ -0,0 +1,25 @@ |
|||||||
|
// <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.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)); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,51 @@ |
|||||||
|
// <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.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; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue