Browse Source

Fix SD-1657 - Grid adorner - File no longer marked as dirty when just moving the mouse over the column header.

pull/14/head 4.0-RC1
Matt Ward 15 years ago
parent
commit
10b427cfaf
  1. 39
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/GridAdorner.cs

39
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/GridAdorner.cs

@ -433,34 +433,37 @@ namespace ICSharpCode.WpfDesign.Designer.Controls @@ -433,34 +433,37 @@ namespace ICSharpCode.WpfDesign.Designer.Controls
public void SetGridLengthUnit(GridUnitType unit)
{
DesignItem item = unitSelector.SelectedItem;
GridLength value;
grid.UpdateLayout();
Debug.Assert(item != null);
if (orientation == Orientation.Vertical) {
value = (GridLength)item.Properties[RowDefinition.HeightProperty].ValueOnInstance;
if (unit == GridUnitType.Auto)
value = GridLength.Auto;
else
value = new GridLength(value.Value, unit);
item.Properties[RowDefinition.HeightProperty].SetValue(value);
SetGridLengthUnit(unit, item, RowDefinition.HeightProperty);
} else {
value = (GridLength)item.Properties[ColumnDefinition.WidthProperty].ValueOnInstance;
if (unit == GridUnitType.Auto)
value = GridLength.Auto;
else
value = new GridLength(value.Value, unit);
item.Properties[ColumnDefinition.WidthProperty].SetValue(value);
SetGridLengthUnit(unit, item, ColumnDefinition.WidthProperty);
}
grid.UpdateLayout();
InvalidateVisual();
}
void SetGridLengthUnit(GridUnitType unit, DesignItem item, DependencyProperty property)
{
DesignItemProperty itemProperty = item.Properties[property];
GridLength oldValue = (GridLength)itemProperty.ValueOnInstance;
GridLength value = GetNewGridLength(unit, oldValue);
if (value != oldValue) {
itemProperty.SetValue(value);
}
}
GridLength GetNewGridLength(GridUnitType unit, GridLength oldValue)
{
if (unit == GridUnitType.Auto) {
return GridLength.Auto;
}
return new GridLength(oldValue.Value, unit);
}
}
public abstract class GridSplitterAdorner : Control

Loading…
Cancel
Save