Browse Source

Merge pull request #588 from jogibear9988/master

Feature: Support of DesignWidth/DesignHeight Property
pull/603/head
Siegfried Pammer 11 years ago
parent
commit
0be92538a3
  1. 26
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/DesignTimeProperties.cs
  2. 12
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlProperty.cs

26
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/DesignTimeProperties.cs

@ -174,7 +174,31 @@ namespace ICSharpCode.WpfDesign.XamlDom @@ -174,7 +174,31 @@ namespace ICSharpCode.WpfDesign.XamlDom
public static readonly DependencyProperty DesignHeightProperty =
DependencyProperty.RegisterAttached("DesignHeight", typeof(double), typeof(DesignTimeProperties));
#endregion
#region LayoutOverrides
/// <summary>
/// Getter for <see cref="LayoutOverridesProperty"/>
/// </summary>
public static string GetLayoutOverrides(DependencyObject obj)
{
return (string)obj.GetValue(LayoutOverridesProperty);
}
/// <summary>
/// Setter for <see cref="LayoutOverridesProperty"/>
/// </summary>
public static void SetLayoutOverrides(DependencyObject obj, string value)
{
obj.SetValue(LayoutOverridesProperty, value);
}
/// <summary>
/// Layout-Overrides
/// </summary>
public static readonly DependencyProperty LayoutOverridesProperty =
DependencyProperty.RegisterAttached("LayoutOverrides", typeof(string), typeof(DesignTimeProperties));
#endregion
#region LayoutRounding
/// <summary>
/// Getter for <see cref="LayoutRoundingProperty"/>

12
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlProperty.cs

@ -228,6 +228,18 @@ namespace ICSharpCode.WpfDesign.XamlDom @@ -228,6 +228,18 @@ namespace ICSharpCode.WpfDesign.XamlDom
if (this.parentObject.XamlSetTypeConverter != null)
this.ParentObject.XamlSetTypeConverter(this.parentObject.Instance, new XamlSetTypeConverterEventArgs(this.SystemXamlMemberForProperty, null, ((XamlTextValue) propertyValue).Text, this.parentObject.OwnerDocument.GetTypeDescriptorContext(this.parentObject), null));
if (propertyInfo.DependencyProperty == DesignTimeProperties.DesignWidthProperty) {
var widthProperty = this.ParentObject.Properties.FirstOrDefault(x => x.DependencyProperty == FrameworkElement.WidthProperty);
if (widthProperty == null || !widthProperty.IsSet)
((FrameworkElement) this.ParentObject.Instance).Width = (double) ValueOnInstance;
}
if (propertyInfo.DependencyProperty == DesignTimeProperties.DesignHeightProperty) {
var heightProperty = this.ParentObject.Properties.FirstOrDefault(x => x.DependencyProperty == FrameworkElement.HeightProperty);
if (heightProperty == null || !heightProperty.IsSet)
((FrameworkElement)this.ParentObject.Instance).Width = (double)ValueOnInstance;
}
}
catch {
Debug.WriteLine("UpdateValueOnInstance() failed");

Loading…
Cancel
Save