Open himgoyalmicro opened 1 month ago
This looks like a reasonably conservative approach, I support the proposed syntax (where the commas are optional like in other collections). The Alternative Design is obviously not viable, not only because of duplication but also because of the ability to change the value once set, which brings challenges of preserving instances of individual definitions etc.
The setter does not need to be public I believe, internal would do. Introducing a public setter brings complexity in terms of managing changes to the value and ownership.
Creating the collections is not that easy though, as they do not have a public constructor and require an instance of the owning Grid. During XAML parsing, the type converter could get the instance of the Grid from ITypeDescriptorContext
resp. IProvideValueTarget
and could use the internal constructor. However, that means the converters cannot be used on its own without context. Alternatively, we could add public parameter-less constructors and deal with ownership on assignment.
I agree with miloush here; and yeah, it should be possible to specify both comma-separated and space-separated values as it is with other elements, e.g. Thickness
.
I agree with miloush here; and yeah, it should be possible to specify both comma-separated and space-separated values as it is with other elements, e.g. Thickness.
@h3xds1nz, @miloush this suggestion is reasonable and I have updated the API Proposal to show both comma-separated and space-separated values.
The setter does not need to be public I believe, internal would do. Introducing a public setter brings complexity in terms of managing changes to the value and ownership.
I am yet to try this one out. Once done I will update the proposal accordingly
Background and motivation
Following up on discussion in #5612 and #1739 this proposal is to simplify the definition syntax of RowDefinitions and ColumnDefinitions by:
Goal
The goal of this feature is to make Grid markup less verbose, allowing developers to create grids with simpler syntax.
Example
Current Syntax
Defining columns and rows is overly tedious, repetitive and not very productive, as is shown below:
Proposed Syntax
The same functionality as above with the proposed succinct syntax is shown below:
Scope
API Proposal
Provide new typeconverters for
ColumnDefinitionCollection
andRowDefinitionCollection
. This will allow us to convert string input into the corresponding collection.Introduce Setter properties for
ColumnDefinitons
andRowDefinitions
of Grid.API Usage
Alternative Designs
Introduce new public dependency properties
Columns
andRows
that provide a dedicated place to update the row and column definitions.Remarks
However, this leaves us with two similar properties to set the same things, which is not a clean approach.
Risks
No response