diff --git a/src/Microsoft.DotNet.Wpf/cycle-breakers/PresentationFramework/PresentationFramework.cs b/src/Microsoft.DotNet.Wpf/cycle-breakers/PresentationFramework/PresentationFramework.cs index 78efe1b3984..e84f6b73a12 100644 --- a/src/Microsoft.DotNet.Wpf/cycle-breakers/PresentationFramework/PresentationFramework.cs +++ b/src/Microsoft.DotNet.Wpf/cycle-breakers/PresentationFramework/PresentationFramework.cs @@ -5036,6 +5036,24 @@ public void Refresh() { } public override bool ShouldSerializeContent() { throw null; } public void StopLoading() { } } + public partial class ColumnDefinitionCollectionConverter : System.ComponentModel.TypeConverter + { + public ColumnDefinitionCollectionConverter() { } + public override bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext typeDescriptorContext, System.Type sourceType) { throw null; } + public override bool CanConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Type destinationType) { throw null; } + public override object ConvertFrom(System.ComponentModel.ITypeDescriptorContext typeDescriptorContext, System.Globalization.CultureInfo cultureInfo, object source) { throw null; } + public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, System.Type destinationType) { throw null; } + } + + public partial class RowDefinitionCollectionConverter : System.ComponentModel.TypeConverter + { + public RowDefinitionCollectionConverter() { } + public override bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext typeDescriptorContext, System.Type sourceType) { throw null; } + public override bool CanConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Type destinationType) { throw null; } + public override object ConvertFrom(System.ComponentModel.ITypeDescriptorContext typeDescriptorContext, System.Globalization.CultureInfo cultureInfo, object source) { throw null; } + public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, System.Type destinationType) { throw null; } + } + public partial class Grid : System.Windows.Controls.Panel, System.Windows.Markup.IAddChild { public static readonly System.Windows.DependencyProperty ColumnProperty; @@ -5045,9 +5063,11 @@ public partial class Grid : System.Windows.Controls.Panel, System.Windows.Markup public static readonly System.Windows.DependencyProperty RowSpanProperty; public static readonly System.Windows.DependencyProperty ShowGridLinesProperty; public Grid() { } + [System.ComponentModel.TypeConverterAttribute(typeof(System.Windows.Controls.ColumnDefinitionCollectionConverter))] [System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Content)] public System.Windows.Controls.ColumnDefinitionCollection ColumnDefinitions { get { throw null; } } protected internal override System.Collections.IEnumerator LogicalChildren { get { throw null; } } + [System.ComponentModel.TypeConverterAttribute(typeof(System.Windows.Controls.RowDefinitionCollectionConverter))] [System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Content)] public System.Windows.Controls.RowDefinitionCollection RowDefinitions { get { throw null; } } public bool ShowGridLines { get { throw null; } set { } } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/PresentationFramework.csproj b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/PresentationFramework.csproj index 6e84493822b..031bbf308c1 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/PresentationFramework.csproj +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/PresentationFramework.csproj @@ -547,6 +547,7 @@ + @@ -739,6 +740,7 @@ + diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/ColumnDefinition.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/ColumnDefinition.cs index 6962180fe76..af42b0acb58 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/ColumnDefinition.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/ColumnDefinition.cs @@ -562,7 +562,7 @@ private void PrivateValidateValueForAddition(object value) throw new ArgumentException(SR.Format(SR.GridCollection_MustBeCertainType, "ColumnDefinitionCollection", "ColumnDefinition")); } - if (item.Parent != null) + if (item.Parent != _owner && item.Parent != null) { throw new ArgumentException(SR.Format(SR.GridCollection_InOtherCollection, "value", "ColumnDefinitionCollection")); } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/ColumnDefinitionCollectionConverter.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/ColumnDefinitionCollectionConverter.cs new file mode 100644 index 00000000000..1ab3a411450 --- /dev/null +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/ColumnDefinitionCollectionConverter.cs @@ -0,0 +1,122 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.ComponentModel; +using System.Windows.Controls; +using System.Windows.Markup; +using System.Globalization; + +#pragma warning disable 1634, 1691 // suppressing PreSharp warnings + +namespace System.Windows.Controls +{ + + public class ColumnDefinitionCollectionConverter : TypeConverter + { + #region Public Methods + + /// + /// CanConvertFrom - Returns whether or not this class can convert from a given type. + /// + /// + /// bool - True if thie converter can convert from the provided type, false if not. + /// + /// The ITypeDescriptorContext for this call. + /// The Type being queried for support. + public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) + { + return sourceType == typeof(string) || base.CanConvertFrom(context, sourceType); + } + + /// + /// CanConvertTo - Returns whether or not this class can convert to a given type. + /// + /// + /// bool - True if this converter can convert to the provided type, false if not. + /// + /// The ITypeDescriptorContext for this call. + /// The Type being queried for support. + public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) + { + return destinationType == typeof(string) || base.CanConvertTo(context, destinationType); + } + + /// + /// ConvertFrom - Attempt to convert to a ColumnDefinitionCollection from the given object. + /// + /// + /// The object which was constructoed. + /// + /// + /// An ArgumentNullException is thrown if the example object is null. + /// + /// The ITypeDescriptorContext for this call. + /// The CultureInfo which is respected when converting. + /// The Thickness to convert. + public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) + { + if(value != null) + { + if (value is string input) + { + IProvideValueTarget ipvt = context?.GetService(typeof(IProvideValueTarget)) as IProvideValueTarget; + Grid grid = ipvt?.TargetObject as Grid; + if(grid != null) + { + var collection = new ColumnDefinitionCollection(grid); // Pass Grid instance + var converter = new GridLengthConverter(); + + if(input == ""){ + return collection; + } + foreach (var length in input.Split(',')) + { + if (converter.ConvertFromString(length.Trim()) is GridLength gridLength) + { + collection.Add(new ColumnDefinition { Width = gridLength }); + } + } + return collection; + } + } + return base.ConvertFrom(context, culture, value); + } + throw GetConvertFromException(value); + } + + /// + /// ConvertTo - Attempt to convert a ColumnDefinitionCollection to the given type + /// + /// + /// The object which was constructoed. + /// + /// + /// An ArgumentNullException is thrown if the example object is null. + /// + /// The ITypeDescriptorContext for this call. + /// The CultureInfo which is respected when converting. + /// The ColumnDefintionCollection to convert. + /// The type to which to convert the ColumnDefintionCollection instance. + public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) + { + ArgumentNullException.ThrowIfNull(value); + ArgumentNullException.ThrowIfNull(destinationType); + if (destinationType == typeof(string) && value is ColumnDefinitionCollection columnDefinitions) + { + var parts = new string[columnDefinitions.Count]; + + for (int i = 0; i < columnDefinitions.Count; i++) + { + parts[i] = columnDefinitions[i].Width.ToString(); + } + + return string.Join(",", parts); + } + + return base.ConvertTo(context, culture, value, destinationType); + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/Grid.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/Grid.cs index 7e7a8040c82..f82a8920712 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/Grid.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/Grid.cs @@ -31,7 +31,6 @@ using System.Windows.Documents; using System.Windows.Media; using System.Windows.Markup; - #pragma warning disable 1634, 1691 // suppressing PreSharp warnings namespace System.Windows.Controls @@ -272,6 +271,7 @@ public bool ShowGridLines /// /// Returns a ColumnDefinitionCollection of column definitions. /// + [TypeConverter(typeof(ColumnDefinitionCollectionConverter))] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public ColumnDefinitionCollection ColumnDefinitions { @@ -282,11 +282,21 @@ public ColumnDefinitionCollection ColumnDefinitions return (_data.ColumnDefinitions); } + set + { + if (value == null){ + _data.ColumnDefinitions = new ColumnDefinitionCollection(this); + return; + } + _data ??= new ExtendedData(); + _data.ColumnDefinitions = value; + } } /// /// Returns a RowDefinitionCollection of row definitions. /// + [TypeConverter(typeof(RowDefinitionCollectionConverter))] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public RowDefinitionCollection RowDefinitions { @@ -297,6 +307,15 @@ public RowDefinitionCollection RowDefinitions return (_data.RowDefinitions); } + set + { + if (value == null){ + _data.RowDefinitions = new RowDefinitionCollection(this); + return; + } + _data ??= new ExtendedData(); + _data.RowDefinitions = value; + } } #endregion Public Properties diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/RowDefinition.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/RowDefinition.cs index b50920ea489..34621c1c87b 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/RowDefinition.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/RowDefinition.cs @@ -562,7 +562,7 @@ private void PrivateValidateValueForAddition(object value) throw new ArgumentException(SR.Format(SR.GridCollection_MustBeCertainType, "RowDefinitionCollection", "RowDefinition")); } - if (item.Parent != null) + if (item.Parent != _owner && item.Parent != null) { throw new ArgumentException(SR.Format(SR.GridCollection_InOtherCollection, "value", "RowDefinitionCollection")); } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/RowDefinitionCollectionConverter.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/RowDefinitionCollectionConverter.cs new file mode 100644 index 00000000000..7145712bfef --- /dev/null +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/RowDefinitionCollectionConverter.cs @@ -0,0 +1,125 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.ComponentModel; +using System.Windows.Controls; +using System.Windows.Markup; +using System.Globalization; + +#pragma warning disable 1634, 1691 // suppressing PreSharp warnings + +namespace System.Windows.Controls +{ + + public class RowDefinitionCollectionConverter : TypeConverter + { + #region Public Methods + + /// + /// CanConvertFrom - Returns whether or not this class can convert from a given type. + /// + /// + /// bool - True if thie converter can convert from the provided type, false if not. + /// + /// The ITypeDescriptorContext for this call. + /// The Type being queried for support. + public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) + { + return sourceType == typeof(string) || base.CanConvertFrom(context, sourceType); + } + + /// + /// CanConvertTo - Returns whether or not this class can convert to a given type. + /// + /// + /// bool - True if this converter can convert to the provided type, false if not. + /// + /// The ITypeDescriptorContext for this call. + /// The Type being queried for support. + public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) + { + return destinationType == typeof(string) || base.CanConvertTo(context, destinationType); + } + + /// + /// ConvertFrom - Attempt to convert to a RowDefinitionCollection from the given object. + /// + /// + /// The object which was constructoed. + /// + /// + /// An ArgumentNullException is thrown if the example object is null. + /// + /// + /// An ArgumentException is thrown if the object is not null and is not a valid type, + /// or if the destinationType isn't one of the valid destination types. + /// + /// The ITypeDescriptorContext for this call. + /// The CultureInfo which is respected when converting. + /// The Thickness to convert. + public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) + { + if(value != null){ + if (value is string input) + { + IProvideValueTarget ipvt = context?.GetService(typeof(IProvideValueTarget)) as IProvideValueTarget; + Grid grid = ipvt?.TargetObject as Grid; + if(grid != null) + { + var collection = new RowDefinitionCollection(grid); // Pass Grid instance + var converter = new GridLengthConverter(); + + if(input == ""){ + return collection; + } + foreach (var length in input.Split(',')) + { + if (converter.ConvertFromString(length.Trim()) is GridLength gridLength) + { + collection.Add(new RowDefinition { Height = gridLength }); + } + } + return collection; + } + } + return base.ConvertFrom(context, culture, value); + } + throw GetConvertFromException(value); + } + + /// + /// ConvertTo - Attempt to convert a RowDefinitionCollection to the given type + /// + /// + /// The object which was constructoed. + /// + /// + /// An ArgumentNullException is thrown if the example object is null. + /// + /// The ITypeDescriptorContext for this call. + /// The CultureInfo which is respected when converting. + /// The RowDefintionCollection to convert. + /// The type to which to convert the RowDefintionCollection instance. + public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) + { + ArgumentNullException.ThrowIfNull(value); + ArgumentNullException.ThrowIfNull(destinationType); + if (destinationType == typeof(string) && value is RowDefinitionCollection RowDefinitions) + { + var parts = new string[RowDefinitions.Count]; + + for (int i = 0; i < RowDefinitions.Count; i++) + { + parts[i] = RowDefinitions[i].Height.ToString(); + } + + return string.Join(",", parts); + } + + return base.ConvertTo(context, culture, value, destinationType); + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/Baml2006/Baml2006KnownTypes.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/Baml2006/Baml2006KnownTypes.cs index 8848d13601b..bfb394b3f66 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/Baml2006/Baml2006KnownTypes.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/Baml2006/Baml2006KnownTypes.cs @@ -853,6 +853,8 @@ public static Type GetKnownType(Int16 typeId) case 757: t = () => typeof(XmlLanguageConverter); break; case 758: t = () => typeof(XmlNamespaceMapping); break; case 759: t = () => typeof(ZoomPercentageConverter); break; + case 760: t = () => typeof(RowDefinitionCollectionConverter); break; + case 761: t = () => typeof(ColumnDefinitionCollectionConverter); break; default: t = () => null; break; } @@ -955,6 +957,8 @@ internal static TypeConverter CreateKnownTypeConverter(Int16 converterId) case -722: o = new System.Windows.Media.VectorCollectionConverter(); break; case -723: o = new System.Windows.VectorConverter(); break; case -757: o = new System.Windows.Markup.XmlLanguageConverter(); break; + case -760: o = new System.Windows.Controls.RowDefinitionCollectionConverter(); break; + case -761: o = new System.Windows.Controls.ColumnDefinitionCollectionConverter(); break; } return o; } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/Baml2006/WpfGeneratedKnownProperties.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/Baml2006/WpfGeneratedKnownProperties.cs index 2fd51dff509..725e8523548 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/Baml2006/WpfGeneratedKnownProperties.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/Baml2006/WpfGeneratedKnownProperties.cs @@ -6403,7 +6403,9 @@ private WpfKnownMember Create_BamlProperty_Grid_ColumnDefinitions() false // IsAttachable ); bamlMember.GetDelegate = delegate(object target) { return ((System.Windows.Controls.Grid)target).ColumnDefinitions; }; + bamlMember.SetDelegate = delegate(object target, object value) { ((System.Windows.Controls.Grid)target).ColumnDefinitions = (System.Windows.Controls.ColumnDefinitionCollection)value; }; bamlMember.IsWritePrivate = true; + bamlMember.TypeConverterType = typeof(System.Windows.Controls.ColumnDefinitionCollectionConverter); bamlMember.Freeze(); return bamlMember; } @@ -6420,7 +6422,9 @@ private WpfKnownMember Create_BamlProperty_Grid_RowDefinitions() false // IsAttachable ); bamlMember.GetDelegate = delegate(object target) { return ((System.Windows.Controls.Grid)target).RowDefinitions; }; + bamlMember.SetDelegate = delegate(object target, object value) { ((System.Windows.Controls.Grid)target).RowDefinitions = (System.Windows.Controls.RowDefinitionCollection)value; }; bamlMember.IsWritePrivate = true; + bamlMember.TypeConverterType = typeof(System.Windows.Controls.RowDefinitionCollectionConverter); bamlMember.Freeze(); return bamlMember; } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/Baml2006/WpfGeneratedKnownTypes.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/Baml2006/WpfGeneratedKnownTypes.cs index 0b2c324ad85..cb6a869229f 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/Baml2006/WpfGeneratedKnownTypes.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/Baml2006/WpfGeneratedKnownTypes.cs @@ -777,6 +777,8 @@ private WpfKnownType CreateKnownBamlType(short bamlNumber, bool isBamlType, bool case 757: return Create_BamlType_XmlLanguageConverter(isBamlType, useV3Rules); // type converter case 758: return Create_BamlType_XmlNamespaceMapping(isBamlType, useV3Rules); case 759: return Create_BamlType_ZoomPercentageConverter(isBamlType, useV3Rules); + case 760: return Create_BamlType_RowDefinitionCollectionConverter(isBamlType, useV3Rules); + case 761: return Create_BamlType_ColumnDefinitionCollectionConverter(isBamlType, useV3Rules); default: throw new InvalidOperationException("Invalid BAML number"); } @@ -11851,5 +11853,29 @@ private WpfKnownType Create_BamlType_KeyboardNavigation(bool isBamlType, bool us bamlType.Freeze(); return bamlType; } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] + private WpfKnownType Create_BamlType_RowDefinitionCollectionConverter(bool isBamlType, bool useV3Rules) + { + var bamlType = new WpfKnownType(this, // SchemaContext + 760, "RowDefinitionCollectionConverter", + typeof(System.Windows.Controls.RowDefinitionCollectionConverter), + isBamlType, useV3Rules); + bamlType.DefaultConstructor = delegate() { return new System.Windows.Controls.RowDefinitionCollectionConverter(); }; + bamlType.Freeze(); + return bamlType; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] + private WpfKnownType Create_BamlType_ColumnDefinitionCollectionConverter(bool isBamlType, bool useV3Rules) + { + var bamlType = new WpfKnownType(this, // SchemaContext + 761, "ColumnDefinitionCollectionConverter", + typeof(System.Windows.Controls.ColumnDefinitionCollectionConverter), + isBamlType, useV3Rules); + bamlType.DefaultConstructor = delegate() { return new System.Windows.Controls.ColumnDefinitionCollectionConverter(); }; + bamlType.Freeze(); + return bamlType; + } } } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/KnownTypes.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/KnownTypes.cs index cbd2d5bcd41..2337189aaa9 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/KnownTypes.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/KnownTypes.cs @@ -829,7 +829,9 @@ internal enum KnownElements : short XmlLanguageConverter, XmlNamespaceMapping, ZoomPercentageConverter, - MaxElement + MaxElement, + RowDefinitionCollectionConverter, + ColumnDefinitionCollectionConverter } // This enum specifies the IDs we use for known CLR and DP Properties in BAML. @@ -1670,6 +1672,8 @@ internal static object CreateKnownElement(KnownElements knownElement) case KnownElements.XmlLanguageConverter: o = new System.Windows.Markup.XmlLanguageConverter(); break; case KnownElements.XmlNamespaceMapping: o = new System.Windows.Data.XmlNamespaceMapping(); break; case KnownElements.ZoomPercentageConverter: o = new System.Windows.Documents.ZoomPercentageConverter(); break; + case KnownElements.RowDefinitionCollectionConverter: o = new System.Windows.Controls.RowDefinitionCollectionConverter(); break; + case KnownElements.ColumnDefinitionCollectionConverter: o = new System.Windows.Controls.ColumnDefinitionCollectionConverter(); break; } return o; } @@ -5537,6 +5541,8 @@ private Type InitializeOneType(KnownElements knownElement) case KnownElements.DateTimeConverter: t = typeof(DateTimeConverter); break; case KnownElements.DateTimeConverter2: t = typeof(DateTimeConverter2); break; case KnownElements.UriTypeConverter: t = typeof(UriTypeConverter); break; + case KnownElements.RowDefinitionCollectionConverter: t = _asmFramework.GetType("System.Windows.Controls.RowDefinitionCollectionConverter"); break; + case KnownElements.ColumnDefinitionCollectionConverter: t = _asmFramework.GetType("System.Windows.Controls.ColumnDefinitionCollectionConverter"); break; } if(t == null) @@ -6311,6 +6317,8 @@ private Type InitializeOneType(KnownElements knownElement) case KnownElements.XmlLanguageConverter: t = typeof(System.Windows.Markup.XmlLanguageConverter); break; case KnownElements.XmlNamespaceMapping: t = typeof(System.Windows.Data.XmlNamespaceMapping); break; case KnownElements.ZoomPercentageConverter: t = typeof(System.Windows.Documents.ZoomPercentageConverter); break; + case KnownElements.RowDefinitionCollectionConverter : t = typeof(System.Windows.Controls.RowDefinitionCollectionConverter); break; + case KnownElements.ColumnDefinitionCollectionConverter : t = typeof(System.Windows.Controls.ColumnDefinitionCollectionConverter); break; } return t; diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/ref/PresentationFramework.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/ref/PresentationFramework.cs index 15b0071ed2d..6491c897709 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/ref/PresentationFramework.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/ref/PresentationFramework.cs @@ -5106,6 +5106,25 @@ public void Refresh() { } public override bool ShouldSerializeContent() { throw null; } public void StopLoading() { } } + + public partial class ColumnDefinitionCollectionConverter : System.ComponentModel.TypeConverter + { + public ColumnDefinitionCollectionConverter() { } + public override bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext typeDescriptorContext, System.Type sourceType) { throw null; } + public override bool CanConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Type destinationType) { throw null; } + public override object ConvertFrom(System.ComponentModel.ITypeDescriptorContext typeDescriptorContext, System.Globalization.CultureInfo cultureInfo, object source) { throw null; } + public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, System.Type destinationType) { throw null; } + } + + public partial class RowDefinitionCollectionConverter : System.ComponentModel.TypeConverter + { + public RowDefinitionCollectionConverter() { } + public override bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext typeDescriptorContext, System.Type sourceType) { throw null; } + public override bool CanConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Type destinationType) { throw null; } + public override object ConvertFrom(System.ComponentModel.ITypeDescriptorContext typeDescriptorContext, System.Globalization.CultureInfo cultureInfo, object source) { throw null; } + public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, System.Type destinationType) { throw null; } + } + public partial class Grid : System.Windows.Controls.Panel, System.Windows.Markup.IAddChild { public static readonly System.Windows.DependencyProperty ColumnProperty; @@ -5115,11 +5134,13 @@ public partial class Grid : System.Windows.Controls.Panel, System.Windows.Markup public static readonly System.Windows.DependencyProperty RowSpanProperty; public static readonly System.Windows.DependencyProperty ShowGridLinesProperty; public Grid() { } + [System.ComponentModel.TypeConverterAttribute(typeof(System.Windows.Controls.ColumnDefinitionCollectionConverter))] [System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Content)] - public System.Windows.Controls.ColumnDefinitionCollection ColumnDefinitions { get { throw null; } } + public System.Windows.Controls.ColumnDefinitionCollection ColumnDefinitions { get { throw null; } set { } } protected internal override System.Collections.IEnumerator LogicalChildren { get { throw null; } } + [System.ComponentModel.TypeConverterAttribute(typeof(System.Windows.Controls.RowDefinitionCollectionConverter))] [System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Content)] - public System.Windows.Controls.RowDefinitionCollection RowDefinitions { get { throw null; } } + public System.Windows.Controls.RowDefinitionCollection RowDefinitions { get { throw null; } set { } } public bool ShowGridLines { get { throw null; } set { } } protected override int VisualChildrenCount { get { throw null; } } protected override System.Windows.Size ArrangeOverride(System.Windows.Size arrangeSize) { throw null; }