Browse Source

Grid placement Fix

When Grid Stretched horizontal no width should be set!
Same on vertical!
pull/519/head
jkuehner 11 years ago
parent
commit
50ad72bcc0
  1. 27
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/GridPlacementSupport.cs

27
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/GridPlacementSupport.cs

@ -218,28 +218,15 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
margin.Bottom = GetRowOffset(bottomRowIndex + 1) - info.Bounds.Bottom; margin.Bottom = GetRowOffset(bottomRowIndex + 1) - info.Bounds.Bottom;
info.Item.Properties[FrameworkElement.MarginProperty].SetValue(margin); info.Item.Properties[FrameworkElement.MarginProperty].SetValue(margin);
var widthIsSet = info.Item.Properties[FrameworkElement.WidthProperty].IsSet; if (ha == HorizontalAlignment.Stretch)
var heightIsSet = info.Item.Properties[FrameworkElement.HeightProperty].IsSet; info.Item.Properties[FrameworkElement.WidthProperty].Reset();
if (!widthIsSet) else
{
if (ha == HorizontalAlignment.Stretch)
info.Item.Properties[FrameworkElement.WidthProperty].Reset();
else
info.Item.Properties[FrameworkElement.WidthProperty].SetValue(info.Bounds.Width);
}
else {
info.Item.Properties[FrameworkElement.WidthProperty].SetValue(info.Bounds.Width); info.Item.Properties[FrameworkElement.WidthProperty].SetValue(info.Bounds.Width);
}
if (!heightIsSet) if (va == VerticalAlignment.Stretch)
{ info.Item.Properties[FrameworkElement.HeightProperty].Reset();
if (va == VerticalAlignment.Stretch) else
info.Item.Properties[FrameworkElement.HeightProperty].Reset();
else
info.Item.Properties[FrameworkElement.HeightProperty].SetValue(info.Bounds.Height);
}
else {
info.Item.Properties[FrameworkElement.HeightProperty].SetValue(info.Bounds.Height); info.Item.Properties[FrameworkElement.HeightProperty].SetValue(info.Bounds.Height);
}
} }
public override void LeaveContainer(PlacementOperation operation) public override void LeaveContainer(PlacementOperation operation)

Loading…
Cancel
Save