Measurements of units were added

This commit is contained in:
Evgeny Redikultsev
2022-11-26 17:33:21 +05:00
parent f849ee024a
commit c5e503252e
25 changed files with 293 additions and 61 deletions

View File

@@ -0,0 +1,47 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Strings;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace StructureHelper.Infrastructure.UI.Converters
{
internal static class CommonOperation
{
public static double ConvertToDoubleChangeComma(string s)
{
double result;
if (!double.TryParse(s, NumberStyles.Any, CultureInfo.CurrentCulture, out result) &&
!double.TryParse(s, NumberStyles.Any, CultureInfo.GetCultureInfo("en-US"), out result) &&
!double.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out result))
{
throw new StructureHelperException($"{ErrorStrings.IncorrectValue}: {s}");
}
return result;
}
public static IStringDoublePair DivideIntoStringDoublePair(string s)
{
string digitPattern = @"\d+(\.?|\,?)\d+";
string textPattern = @"[0-9]|\.|\,";
string caracterPattern = "[a-z]+$";
string target = "";
Regex regexText = new Regex(textPattern);
string textString = regexText.Replace(s, target);
var textMatch = Regex.Match(textString, caracterPattern, RegexOptions.IgnoreCase);
if (textMatch.Success) {textString = textMatch.Value.ToLower();}
var match = Regex.Match(s, digitPattern);
if (match.Success)
{
string digitString = match.Value;
double digit = ConvertToDoubleChangeComma(digitString);
return new StringDoublePair() { Digit = digit, Text = textString };
}
throw new StructureHelperException(ErrorStrings.DataIsInCorrect);
}
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelper.Infrastructure.UI.Converters
{
internal interface IStringDoublePair
{
double Digit { get; }
string Text { get; }
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelper.Infrastructure.UI.Converters
{
internal class StringDoublePair : IStringDoublePair
{
public double Digit { get; set; }
public string Text { get; set; }
}
}

View File

@@ -12,6 +12,9 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
internal class Area : UnitBase
{
public override string unitName { get => "Area"; }
public override string MeasureUnit => throw new NotImplementedException();
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
double val;
@@ -24,12 +27,15 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
double val;
if (value != null)
try
{
var strVal = value as string;
double.TryParse(strVal, out val);
val = CommonOperation.ConvertToDoubleChangeComma(strVal);
}
catch
{
return null;
}
else { throw new Exception($"{unitName} value is null"); }
val /= (UnitConstatnts.Length * UnitConstatnts.Length);
return val;
}

View File

@@ -14,6 +14,8 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
public override string unitName { get => "Force"; }
public override string MeasureUnit => throw new NotImplementedException();
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
double val;
@@ -26,12 +28,15 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
double val;
if (value != null)
try
{
var strVal = value as string;
double.TryParse(strVal, out val);
val = CommonOperation.ConvertToDoubleChangeComma(strVal);
}
catch
{
return null;
}
else { throw new Exception($"{unitName} value is null"); }
val /= coeffficient;
return val;
}

View File

@@ -1,4 +1,8 @@
using System;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperCommon.Services.Units;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
@@ -10,6 +14,12 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
{
internal class Length : UnitBase
{
private IEnumerable<IUnit> units = UnitsFactory.GetUnitCollection();
private UnitTypes type = UnitTypes.Length;
private IUnit currentUnit => units.Where(u => u.UnitType == type & u.Name == "mm").Single();
public override string MeasureUnit => currentUnit.Name;
private double coeffficient => currentUnit.Multiplyer;
public override string unitName { get => "Length"; }
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
@@ -17,21 +27,47 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
double val;
if (value != null) { val = (double)value; }
else { throw new Exception($"{unitName} value is null"); }
val *= UnitConstatnts.Length;
return val;
val *= coeffficient;
string strValue = $"{val} {MeasureUnit}";
return strValue;
}
public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
double val;
if (value != null)
try
{
var strVal = value as string;
double.TryParse(strVal, out val);
IStringDoublePair pair = CommonOperation.DivideIntoStringDoublePair(strVal);
double multy;
try
{
multy = coeffficient / GetMultiplyer(units, type, pair.Text);
}
else { throw new Exception($"{unitName} value is null"); }
val /= UnitConstatnts.Length;
catch (Exception ex)
{
multy = 1d;
}
val = pair.Digit * multy;
}
catch
{
return null;
}
val /= coeffficient;
return val;
}
private double GetMultiplyer(IEnumerable<IUnit> units, UnitTypes unitType, string unitName)
{
try
{
return units.Where(u => u.UnitType == unitType & u.Name == unitName).Single().Multiplyer;
}
catch (Exception ex)
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ex);
}
}
}
}

View File

@@ -14,6 +14,8 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
public override string unitName { get => "Stress"; }
public override string MeasureUnit => throw new NotImplementedException();
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
double val;
@@ -26,12 +28,15 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
double val;
if (value != null)
try
{
var strVal = value as string;
double.TryParse(strVal, out val);
val = CommonOperation.ConvertToDoubleChangeComma(strVal);
}
catch
{
return null;
}
else { throw new Exception($"{unitName} value is null"); }
val /= coeffficient;
return val;
}

View File

@@ -11,6 +11,7 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
internal abstract class UnitBase : IValueConverter
{
public abstract string unitName { get;}
public abstract string MeasureUnit { get; }
public abstract object Convert(object value, Type targetType, object parameter, CultureInfo culture);
public abstract object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture);
}

View File

@@ -11,8 +11,6 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
{
public class PointViewPrimitive : PrimitiveBase, IHasCenter
{
const double lengthUnit = 1000d;
IPointPrimitive primitive;
public double Area
@@ -27,11 +25,11 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
public double PrimitiveLeft
{
get => DeltaX - Diameter / 2d * lengthUnit;
get => DeltaX - Diameter / 2d;
}
public double PrimitiveTop
{
get => DeltaY - Diameter / 2d * lengthUnit;
get => DeltaY - Diameter / 2d;
}
public PointViewPrimitive(IPointPrimitive _primitive) : base(_primitive)

View File

@@ -11,8 +11,6 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
{
public class RectangleViewPrimitive : PrimitiveBase, IHasDivision, IHasCenter
{
const double lengthUnit = 1000d;
private IRectanglePrimitive primitive;
public override double PrimitiveWidth
@@ -38,11 +36,11 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
public double PrimitiveLeft
{
get => DeltaX - primitive.Width / 2 * lengthUnit;
get => DeltaX - primitive.Width / 2d;
}
public double PrimitiveTop
{
get => DeltaY - primitive.Height / 2 * lengthUnit;
get => DeltaY - primitive.Height / 2d;
}
public int NdmMinDivision
{

View File

@@ -32,13 +32,13 @@
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding CenterX, Converter={StaticResource LengthConverter}}"/>
<TextBlock Grid.Row="3" Text="Center Y: "/>
<TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding CenterY, Converter={StaticResource LengthConverter}}"/>
<TextBlock Grid.Row="4" Text="Diameter: "/>
<TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding Diameter, Converter={StaticResource LengthConverter}}"/>
<TextBlock Grid.Row="4" Text="Area: "/>
<TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding Area, Converter={StaticResource AreaConverter}}"/>
</Grid>
</Ellipse.ToolTip>
<Ellipse.RenderTransform>
<TransformGroup>
<TranslateTransform X="{Binding CenterX, Converter={StaticResource LengthConverter}}" Y="{Binding InvertedCenterY, Converter={StaticResource LengthConverter}}"/>
<TranslateTransform X="{Binding CenterX}" Y="{Binding InvertedCenterY}"/>
<RotateTransform/>
</TransformGroup>
</Ellipse.RenderTransform>

View File

@@ -46,7 +46,7 @@
</Rectangle.ToolTip>
<Rectangle.RenderTransform>
<TransformGroup>
<TranslateTransform X="{Binding CenterX, Converter={StaticResource LengthConverter}}" Y="{Binding InvertedCenterY, Converter={StaticResource LengthConverter}}"/>
<TranslateTransform X="{Binding CenterX}" Y="{Binding InvertedCenterY}"/>
<RotateTransform/>
</TransformGroup>
</Rectangle.RenderTransform>

View File

@@ -30,20 +30,20 @@
<Style x:Key="EllipseStyle" TargetType="Ellipse" BasedOn="{StaticResource ShapeStyle}">
<Style.Setters>
<Setter Property="Width" Value="{Binding Diameter, Converter={StaticResource LengthConverter}}"/>
<Setter Property="Height" Value="{Binding Diameter, Converter={StaticResource LengthConverter}}"/>
<Setter Property="Width" Value="{Binding Diameter}"/>
<Setter Property="Height" Value="{Binding Diameter}"/>
</Style.Setters>
</Style>
<Style x:Key="RectangleStyle" TargetType="Rectangle" BasedOn="{StaticResource ShapeStyle}">
<Setter Property="Width" Value="{Binding PrimitiveWidth, Converter={StaticResource LengthConverter}}"/>
<Setter Property="Height" Value="{Binding PrimitiveHeight, Converter={StaticResource LengthConverter}}"/>
<Setter Property="Width" Value="{Binding PrimitiveWidth}"/>
<Setter Property="Height" Value="{Binding PrimitiveHeight}"/>
</Style>
<Style x:Key="LinePrimitiveStyle" TargetType="Line" BasedOn="{StaticResource ShapeStyle}">
<Setter Property="X1" Value="{Binding StartPoinX, Converter={StaticResource LengthConverter}}"/>
<Setter Property="Y1" Value="{Binding StartPoinY, Converter={StaticResource LengthConverter}}"/>
<Setter Property="X2" Value="{Binding EndPoinX, Converter={StaticResource LengthConverter}}"/>
<Setter Property="Y2" Value="{Binding EndPoinY, Converter={StaticResource LengthConverter}}"/>
<Setter Property="X1" Value="{Binding StartPoinX}"/>
<Setter Property="Y1" Value="{Binding StartPoinY}"/>
<Setter Property="X2" Value="{Binding EndPoinX}"/>
<Setter Property="Y2" Value="{Binding EndPoinY}"/>
</Style>
</ResourceDictionary>

View File

@@ -133,7 +133,10 @@
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Infrastructure\Enums\PrimitiveType.cs" />
<Compile Include="Infrastructure\UI\Converters\CommonOperation.cs" />
<Compile Include="Infrastructure\UI\Converters\Common\InvertBoolConverter.cs" />
<Compile Include="Infrastructure\UI\Converters\IStringDoublePair.cs" />
<Compile Include="Infrastructure\UI\Converters\StringDoublePair.cs" />
<Compile Include="Infrastructure\UI\Converters\Units\Area.cs" />
<Compile Include="Infrastructure\UI\Converters\Units\Stress.cs" />
<Compile Include="Infrastructure\UI\Converters\Units\Force.cs" />

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Infrastructures.Enums
{
public enum UnitTypes
{
Length,
Area,
Stress,
Force,
Moment
}
}

View File

@@ -15,5 +15,6 @@ namespace StructureHelperCommon.Infrastructures.Strings
public static string ShapeIsNotCorrect => "#0004: Shape is not valid";
public static string LimitStatesIsNotValid => "#0005: Type of limite state is not valid";
public static string LoadTermIsNotValid => "#0006: Load term is not valid";
public static string IncorrectValue => "#0007: value is not valid";
}
}

View File

@@ -0,0 +1,20 @@
using StructureHelperCommon.Infrastructures.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Services.Units
{
/// <summary>
/// Interface for measurements Unit
/// </summary>
public interface IUnit
{
UnitTypes UnitType { get; }
string Name { get; }
double Multiplyer { get; }
}
}

View File

@@ -0,0 +1,16 @@
using StructureHelperCommon.Infrastructures.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Services.Units
{
public class Unit : IUnit
{
public UnitTypes UnitType { get; set; }
public string Name { get; set; }
public double Multiplyer { get; set; }
}
}

View File

@@ -0,0 +1,27 @@
using StructureHelperCommon.Infrastructures.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Services.Units
{
public static class UnitsFactory
{
public static List<IUnit> GetUnitCollection()
{
List<IUnit> units = new List<IUnit>();
UnitTypes type = UnitTypes.Length;
units.Add(new Unit() { UnitType = type, Name = "m", Multiplyer = 1d });
units.Add(new Unit() { UnitType = type, Name = "mm", Multiplyer = 1e3d });
units.Add(new Unit() { UnitType = type, Name = "cm", Multiplyer = 1e2d });
units.Add(new Unit() { UnitType = type, Name = "km", Multiplyer = 1e-3d });
type = UnitTypes.Stress;
units.Add(new Unit() { UnitType = type, Name = "Pa", Multiplyer = 1d });
units.Add(new Unit() { UnitType = type, Name = "kPa", Multiplyer = 1e-3d });
units.Add(new Unit() { UnitType = type, Name = "MPa", Multiplyer = 1e-6d });
return units;
}
}
}

View File

@@ -49,6 +49,7 @@
<Compile Include="Infrastructures\Enums\CalcTerms.cs" />
<Compile Include="Infrastructures\Enums\CodeTypes.cs" />
<Compile Include="Infrastructures\Enums\LimitStates.cs" />
<Compile Include="Infrastructures\Enums\UnitTypes.cs" />
<Compile Include="Infrastructures\Exceptions\StructureHelperException.cs" />
<Compile Include="Infrastructures\Interfaces\IHasParent.cs" />
<Compile Include="Infrastructures\Interfaces\ISaveable.cs" />
@@ -68,6 +69,9 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services\ColorServices\ColorProcessor.cs" />
<Compile Include="Services\ShapeServices\ShapeService.cs" />
<Compile Include="Services\Units\IUnit.cs" />
<Compile Include="Services\Units\Unit.cs" />
<Compile Include="Services\Units\UnitsFactory.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -9,6 +9,7 @@ using StructureHelper.Services.Primitives;
using StructureHelper.UnitSystem;
using StructureHelper.UnitSystem.Systems;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Services.Units;
using StructureHelperLogics.Models.Calculations.CalculationProperties;
using StructureHelperLogics.Models.Materials;
using StructureHelperLogics.Models.Materials.Factories;

View File

@@ -157,25 +157,32 @@
<i:InvokeCommandAction Command="{Binding ScaleCanvasUp}"/>
</mouseEventTriggers:MouseWheelUpEventTrigger>
</i:Interaction.Triggers>
<Canvas.RenderTransform>
<Canvas.LayoutTransform>
<TransformGroup>
<ScaleTransform ScaleX="{Binding ScaleValue}" ScaleY="{Binding ScaleValue}"
CenterX="{Binding ScrollPanelX}" CenterY="{Binding ScrollPanelY}"/>
</TransformGroup>
</Canvas.RenderTransform>
</Canvas.LayoutTransform>
<Canvas.Background>
<DrawingBrush Viewport="0,0,10,10" ViewportUnits="Absolute" TileMode="Tile">
<VisualBrush TileMode="Tile"
Viewport="0,0,0.050,0.050" ViewportUnits="Absolute"
Viewbox="0,0,0.050,0.050" ViewboxUnits="Absolute">
<VisualBrush.Visual>
<Rectangle StrokeThickness="{Binding GridLineThickness}" Height="0.050" Width="0.050" Stroke="Darkgray"/>
</VisualBrush.Visual>
</VisualBrush>
<!--<DrawingBrush Viewport="0,0,0.05,0.05" ViewportUnits="Absolute" TileMode="Tile">
<DrawingBrush.Drawing>
<GeometryDrawing Brush="Black">
<GeometryDrawing.Geometry>
<GeometryGroup FillRule="EvenOdd">
<RectangleGeometry Rect="0,0,50,50"/>
<RectangleGeometry Rect="0,0,49.5,49.5"/>
<RectangleGeometry Rect="0,0,0.050,0.050"/>
<RectangleGeometry Rect="0,0,0.0499,0.0499"/>
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingBrush.Drawing>
</DrawingBrush>
</DrawingBrush>-->
</Canvas.Background>
<Line X1="0" X2="{Binding XX2}" Y1="{Binding XY1}" Y2="{Binding XY1}" Stroke="Red" StrokeThickness="{Binding AxisLineThickness}"/>
<Line X1="{Binding YX1}" X2="{Binding YX1}" Y1="0" Y2="{Binding YY2}" Stroke="ForestGreen" StrokeThickness="{Binding AxisLineThickness}"/>

View File

@@ -37,10 +37,12 @@ namespace StructureHelper.Windows.MainWindow
{
public class MainViewModel : ViewModelBase
{
const double ConstAxisLineThickness = 2d;
const double scale = 1d;
private double ConstAxisLineThickness = 2d * scale;
private double ConstGridLineThickness = 0.25d * scale;
private List<IHeadMaterial> headMaterials;
private readonly double scaleRate = 1.1;
private readonly double scaleRate = 1.1d;
private IPrimitiveRepository PrimitiveRepository { get; }
public PrimitiveBase SelectedPrimitive { get; set; }
@@ -73,7 +75,7 @@ namespace StructureHelper.Windows.MainWindow
}
public int PrimitivesCount => Primitives.Count;
private double scaleValue = 1.0;
private double scaleValue;
public double ScaleValue
{
@@ -83,13 +85,19 @@ namespace StructureHelper.Windows.MainWindow
OnPropertyChanged(value, ref scaleValue);
axisLineThickness = ConstAxisLineThickness / scaleValue;
OnPropertyChanged(nameof(AxisLineThickness));
gridLineThickness = ConstGridLineThickness / scaleValue;
OnPropertyChanged(nameof(GridLineThickness));
}
}
public double AxisLineThickness
{
get =>axisLineThickness == 0d? ConstAxisLineThickness: axisLineThickness;
set { axisLineThickness = value; }
get => axisLineThickness;
}
public double GridLineThickness
{
get => gridLineThickness;
}
private double canvasWidth, canvasHeight, xX2, xY1, yX1, yY2;
@@ -165,18 +173,22 @@ namespace StructureHelper.Windows.MainWindow
private double delta = 0.0005;
private double axisLineThickness;
private double gridLineThickness;
public MainViewModel(MainModel model, IPrimitiveRepository primitiveRepository, UnitSystemService unitSystemService)
{
PrimitiveRepository = primitiveRepository;
Model = model;
headMaterials = Model.HeadMaterialRepository.HeadMaterials;
CanvasWidth = 1500;
CanvasHeight = 1000;
CanvasWidth = 2d * scale;
CanvasHeight = 1.5d * scale;
XX2 = CanvasWidth;
XY1 = CanvasHeight / 2d;
YX1 = CanvasWidth / 2d;
YY2 = CanvasHeight;
scaleValue = 1000d / scale;
axisLineThickness = ConstAxisLineThickness / scaleValue;
gridLineThickness = ConstGridLineThickness / scaleValue;
calculationProperty = new CalculationProperty();
LeftButtonUp = new RelayCommand(o =>

View File

@@ -35,11 +35,11 @@
</Grid.RowDefinitions>
<TextBlock Text="Elastic material"/>
<TextBlock Grid.Row="1" Text="Young's modulus"/>
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Modulus, Converter={StaticResource StressConverter}, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Modulus, Converter={StaticResource StressConverter}, ValidatesOnExceptions=True}"/>
<TextBlock Grid.Row="2" Text="Compressive strength"/>
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding CompressiveStrength, Converter={StaticResource StressConverter}, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding CompressiveStrength, Converter={StaticResource StressConverter}, ValidatesOnExceptions=True}"/>
<TextBlock Grid.Row="3" Text="Tensile strength"/>
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding TensileStrength, Converter={StaticResource StressConverter}, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding TensileStrength, Converter={StaticResource StressConverter}, ValidatesOnExceptions=True}"/>
</Grid>
</DataTemplate>
</Window.Resources>

View File

@@ -22,8 +22,8 @@
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Text="Width"/>
<TextBlock Grid.Row="1" Text="Height"/>
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding Width, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Row="1" Grid.Column="1" Margin="1" Text="{Binding Height, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding Width, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
<TextBox Grid.Row="1" Grid.Column="1" Margin="1" Text="{Binding Height, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
</Grid>
</Expander>
</DataTemplate>
@@ -38,7 +38,7 @@
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Text="Area"/>
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding Area, Converter={StaticResource AreaConverter}, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding Area, Converter={StaticResource AreaConverter}, ValidatesOnExceptions=True}"/>
</Grid>
</Expander>
</DataTemplate>
@@ -55,8 +55,8 @@
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Text="Minimum element division"/>
<TextBlock Grid.Row="1" Text="Maximum element size"/>
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding MinElementDivision, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Row="1" Grid.Column="1" Margin="1" Text="{Binding MaxElementSize, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding MinElementDivision, ValidatesOnExceptions=True}"/>
<TextBox Grid.Row="1" Grid.Column="1" Margin="1" Text="{Binding MaxElementSize, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
</Grid>
</Expander>
</DataTemplate>
@@ -106,8 +106,8 @@
<Button Width="50" Content="..." Command="{Binding EditMaterialCommand}">
</Button>
</StackPanel>
<TextBox Grid.Row="2" Grid.Column="1" Margin="1" Text="{Binding CenterX, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Row="3" Grid.Column="1" Margin="1" Text="{Binding CenterY, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Row="2" Grid.Column="1" Margin="1" Text="{Binding CenterX, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
<TextBox Grid.Row="3" Grid.Column="1" Margin="1" Text="{Binding CenterY, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
<TextBox Grid.Row="5" Grid.Column="1" Margin="1" Text="{Binding ZIndex}"/>
<StackPanel Grid.Row="4" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
<CheckBox IsChecked="{Binding SetMaterialColor}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,20,0"/>