|
|
@@ -224,10 +224,13 @@ public class DimensionsEditorControl<TDimensions, TLink, TUnit> : DynamicEnclose
|
|
|
CheckChanged((box.Tag as string)!);
|
|
|
}
|
|
|
|
|
|
+ private Guid _currentUnitID = Guid.Empty;
|
|
|
+
|
|
|
private void Combo_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
{
|
|
|
if (Combo.SelectedValue is not Guid unitID) return;
|
|
|
if (Combo.SelectedItem is not Tuple<string, TUnit> tuple) return;
|
|
|
+
|
|
|
var unit = tuple.Item2;
|
|
|
|
|
|
UpdateColumn(1, unit.HasQuantity, QuantityBox);
|
|
|
@@ -236,13 +239,16 @@ public class DimensionsEditorControl<TDimensions, TLink, TUnit> : DynamicEnclose
|
|
|
UpdateColumn(4, unit.HasHeight, HeightBox);
|
|
|
UpdateColumn(5, unit.HasWeight, WeightBox);
|
|
|
|
|
|
- foreach(var property in DatabaseSchema.Properties(typeof(TUnit)))
|
|
|
+ if (unit.ID != _currentUnitID)
|
|
|
{
|
|
|
- var value = property.Getter()(unit);
|
|
|
- OtherValues[$"{ColumnName}.Unit.{property.Name}"] = value;
|
|
|
- }
|
|
|
+ foreach(var property in DatabaseSchema.Properties(typeof(TUnit)))
|
|
|
+ {
|
|
|
+ var value = property.Getter()(unit);
|
|
|
+ OtherValues[$"{ColumnName}.Unit.{property.Name}"] = value;
|
|
|
+ }
|
|
|
|
|
|
- CheckChanged("Unit.ID");
|
|
|
+ CheckChanged("Unit.ID");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
protected override object? GetChildValue(string property)
|
|
|
@@ -273,7 +279,8 @@ public class DimensionsEditorControl<TDimensions, TLink, TUnit> : DynamicEnclose
|
|
|
{
|
|
|
if (property == "Unit.ID")
|
|
|
{
|
|
|
- Combo.SelectedValue = value is Guid guid ? guid : Guid.Empty;
|
|
|
+ _currentUnitID = value is Guid guid ? guid : Guid.Empty;
|
|
|
+ Combo.SelectedValue = _currentUnitID;
|
|
|
}
|
|
|
else if(property == "UnitSize")
|
|
|
{
|