Browse Source

Merge branch 'DrawLineOnCanvas'

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

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

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

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

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

Loading…
Cancel
Save