Browse Source

Merge branch 'DrawLineOnCanvas'

pull/650/head
jkuehner 11 years ago
parent
commit
d6ec889a87
  1. 2
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/LineExtensionBase.cs
  2. 52
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/NumberEditor.xaml.cs

2
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/LineExtensionBase.cs

@ -73,7 +73,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
public LineExtensionBase() public LineExtensionBase()
{ {
_surface = new Canvas(); _surface = new Canvas();
adornerPanel = new AdornerPanel(); adornerPanel = new AdornerPanel(){ MinWidth = 10, MinHeight = 10 };
adornerPanel.Order = AdornerOrder.Foreground; adornerPanel.Order = AdornerOrder.Foreground;
adornerPanel.Children.Add(_surface); adornerPanel.Children.Add(_surface);
Adorners.Add(adornerPanel); Adorners.Add(adornerPanel);

52
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/NumberEditor.xaml.cs

@ -117,16 +117,20 @@ namespace ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors
Maximum = range.Max; Maximum = range.Max;
} }
if (Minimum == 0 && Maximum == 1) { if (type == typeof(double) || type == typeof(decimal)) {
DecimalPlaces = 2; DecimalPlaces = 2;
SmallChange = 0.01;
LargeChange = 0.1;
}
else {
ClearValue(DecimalPlacesProperty);
ClearValue(SmallChangeProperty);
ClearValue(LargeChangeProperty);
} }
// if (Minimum == 0 && Maximum == 1) {
// DecimalPlaces = 2;
// SmallChange = 0.01;
// LargeChange = 0.1;
// }
// else {
// ClearValue(DecimalPlacesProperty);
// ClearValue(SmallChangeProperty);
// ClearValue(LargeChangeProperty);
// }
} }
public override void OnApplyTemplate() public override void OnApplyTemplate()
@ -147,21 +151,21 @@ namespace ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors
double val; double val;
if(double.TryParse(textBox.Text, out val)){ if(double.TryParse(textBox.Text, out val)){
if(PropertyNode.FirstProperty.TypeConverter.IsValid(textBox.Text)){ if(PropertyNode.FirstProperty.TypeConverter.IsValid(textBox.Text)){
if(val >= Minimum && val <= Maximum || double.IsNaN(val)){ if(val >= Minimum && val <= Maximum || double.IsNaN(val)){
textBox.Foreground=Brushes.Black; textBox.Foreground=Brushes.Black;
textBox.ToolTip=textBox.Text; textBox.ToolTip=textBox.Text;
}else{ }else{
textBox.Foreground = Brushes.DarkBlue; textBox.Foreground = Brushes.DarkBlue;
textBox.ToolTip = "Value should be in between "+Minimum+" and "+Maximum; textBox.ToolTip = "Value should be in between "+Minimum+" and "+Maximum;
} }
}else{ }else{
textBox.Foreground = Brushes.DarkRed; textBox.Foreground = Brushes.DarkRed;
textBox.ToolTip = "Cannot convert to Type : " + PropertyNode.FirstProperty.ReturnType.Name; textBox.ToolTip = "Cannot convert to Type : " + PropertyNode.FirstProperty.ReturnType.Name;
} }
}else{ }else{
textBox.Foreground = Brushes.DarkRed; textBox.Foreground = Brushes.DarkRed;
textBox.ToolTip = string.IsNullOrWhiteSpace(textBox.Text)? null:"Value does not belong to any numeric type"; textBox.ToolTip = string.IsNullOrWhiteSpace(textBox.Text)? null:"Value does not belong to any numeric type";
} }
} }
@ -170,7 +174,7 @@ namespace ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors
protected override void OnDragStarted() protected override void OnDragStarted()
{ {
group = PropertyNode.Context.OpenGroup("drag number", group = PropertyNode.Context.OpenGroup("drag number",
PropertyNode.Properties.Select(p => p.DesignItem).ToArray()); PropertyNode.Properties.Select(p => p.DesignItem).ToArray());
} }
protected override void OnDragCompleted() protected override void OnDragCompleted()

Loading…
Cancel
Save