This repository has been archived by the owner on May 1, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move C# Markup Extensions from Forms to Toolkit (#522)
* [Spec] CSharpForMarkup (#8342) * - Add MarkupExtensions from https://github.com/VincentH-Net/CSharpForMarkup/blob/061566282706de22d040e5b7b32bc3c2e3e323e3/src/XamarinFormsMarkupExtensions.cs - Remove specific converters - Fix .NETStandard 1 build errors by refactoring IConvertible to Enum generic constraints - Add RegisterDefaultBindableProperties method - Reformat source to comply with Forms contibuting guidelines * - Move markup extensions to Xamarin.Forms.Markup namespace to prevent impact on existing code and to support clear separation of UI markup from UI logic - Split up source file for better maintainability * Cleanup: - Names of generic types and variables to reflect where clauses - Namespaces remove unused & sort - Add whitespace - Remove unused file * Fix for incorrect type name in exception message Remove RowCol helpers because compiler cannot infer its generic type parameters. Use Row and Col methods instead * Add targetNullValue and fallbackValue parameters to binding helpers. Equivalent to https://github.com/VincentH-Net/CSharpForMarkup/tree/bd7f99957653f5e813ec805e3dad88aa487b9526 * rename binding helpers sourcePropertyName parameter to path * Enable Style<T> on BindableObject instead of Element to resolve xamarin/Xamarin.Forms#8342 (comment) * Fix for Grid properties Row, Col, RowSpan, ColumnSpan not set when default value is specified VincentH-Net/CSharpForMarkup#7 * Support DefaultBindableProperties for BindableObject (was limited to Element) * .Font: - Support any IFontElement (was limited to Button, Label, Entry and Picker) - Fix for italic ignored when bold == true * Fix for .FontSize, .Bold, .Italic return Label instead of type derived from Label * Unit tests batch 1: for LabelExtensions, LayoutExtensions, ViewExtensions * Add DefaultBindableProperties for more BindableObject types * Remove .Menu() helper from ViewInFlexLayoutExtensions (bc no relation to FlexLayout) * Fix for .Row and .Col without span specified still sets span * Rename MarkupBaseTestFixture.TestPropertySet to TestPropertiesSet * Add unit tests for ViewInFlexLayoutExtensions, ViewInGridExtensions and VisualElementExtensions * Add default bindable property for all applicable bindable objects in core. * Add unit tests for DefaultBindableProperties * Support Bind, Assign and Invoke on BindableObject (was Element) Add inline doc to clarify purpose of Bind overloads * Add unit tests for BindableObjectExtensions * Fix for attributes not set in .Font Rename fontSize parameter to size Enable .FontSize, .Bold and .Italic on IFontElement (was Label) * Add unit tests for ElementExtensions * Add unit tests for ElementExtensions * Add assert of exception message content in GetDefaultBindablePropertyForUnsupportedType * Add unit tests for EnumsForGridRowsAndColumns * Add inline doc to clarify purpose of gesture recognizer binding overloads Rename private constant bindingContextPropertyName to bindingContextPath for clarity * Add unit tests for Style; cleanup namespaces in Style * Simplify BindableObjectExtensions implementation (functionality unchanged) * Add IGestureRecognizers to GestureElement and View, to avoid code duplication when accessing the existing GestureRecognizers property * - Add specific helpers for more built-in gesture recognizers - Add helpers to support initializing gesture recognizers - Eliminate duplicate code for View and GestureElement by using new IGestureRecognizers - Simplify implementation - Rename ViewGesturesExtensions to ElementGesturesExtensions * Extract BindingHelpers from BindableObjectExtensionsTests * Add unit tests for ElementGesturesExtensions * Add support for typed converter parameters Add asserts for conversion values in unit tests * Add unit tests for FuncConverter * Add missing calls to Bind overloads in unit test for supporting derived types in BindableObject extensions fluent API * Cleanup: remove unneeded Xamarin.Forms. prefix from static class references * Add unit tests for PlatformSpecificsExtensions * Reorder FuncConverter type params to optimize for most common usage and to remain backwards compatible with https://github.com/VincentH-Net/CSharpForMarkup * Extend Bind*Gesture helpers to support all possible binding parameters * Rename EnumsForGridRowsAndColumns to GridRowColEnums * Add BindCommand helper to bind to default Command + CommandParameter properties Add RegisterForCommand to register default Command + CommandParameter properties for custom bindable objects * - Change Bind*Gesture helper parameters to match BindCommand parameters, to enable binding to Command + CommandParameter in a single compact call (removed parameters did not make sense for a command). - Add inline doc to more ElementGesturesExtensions helpers where needed - Improve ElementGesturesExtensions source formattting for consistency and readability * Remove PlatformSpecificsExtensions (only 2 iOS-only helpers; replace with guidance in PR description on how to use any platform specific with .Invoke) * Fix inline doc spelling: it's -> its * Rename TextLeft -> TextStart, TextRight -> TextEnd to support RTL * Add Columns.Define(width, width ...) and Rows.Define(height, height ...) overloads for Grid * Rename Grid rows & columns extensions class to GridRowsColumns * Change gesture recognizer helpers implementation from reuse existing instance to always add new instance * Change Bind*Gesture helpers default to not bind the commandparameter (is the more common scenario) * Rename BoolNotConverter to NotConverter and make it a 2-way converter * Add culture support to FuncConverter * Rename helpers Left -> Start, Right -> End Add opt-in LeftToRight and RightToLeft helpers * Rename Col -> Column throughout * Rename H -> Horizontal and V -> Vertical throughout * Add Markup_Experimental flag for all API methods and update all unit tests to run with and without the flag * Re-add "Markup_Experimental" flag * Add default bindable properties / test exclusions for new BindableObject types in core * Add constructorHint to FuncConverter and Style for more clear experimental flag message * Add default bindable property for RadioButton - fixes test AllBindableElementsInCoreHaveDefaultBindablePropertyOrAreExcluded failure * Cross-Platform OS Theme APIs (#9958) * Implement OnAppTheme * Implement AppThemeColor * Added tests * Finishing up * Implement UWP * Xcode 11 and additional test * Update Forms.cs * Update ViewRenderer.cs * Update ViewRenderer.cs * Remove IAppThemeProvider * Implemented RequestedThemeChanged * Update WindowsBasePlatformServices.cs * Bindable props and Android invalidate * Update DefaultBindableProperties.cs * Updates at runtime * Review feedback part 1 * Implement VisualElement.OnRequestedThemeChanged * UWP Dispatcher * Add experimental flag * ControlGallery restructure * Update ViewRenderer.cs * Update WindowsBasePlatformServices.cs * iOS pre-13 fix * AppTheme fix NRE (#10327) * Various fixes * Back to basics * [Enhancement] Shapes (#9218) * Added Shapes to Core and Core Gallery samples Implemented basic Shapes on iOS * Added basic shapes Android implementation * Fixed UWP namespace conflicts * Fixed WPF namespace conflicts * Implemented basic shapes on UWP * Fixed UWP Ellipse and Rectangle size issue * Fixed Tizen Build * Changes to fix the build errors * Exclude shapes renderers from Tizen compilation * Implemented LineCap and LineJoin in Android and iOS * Implemented LineCap and LineJoin on UWP * Fixed build error * Updated Polygon sample * Fixed UWP Build error (namespace conflicts) * Fixed namespaces collision build error * Added "Shapes_Experimental" flag * Update UWP ShapeRenderer size logic * Updated iOS and Android ShapeRenderer size logic * Fixed UWP Build error * Added WPF implementation * Fixed Tizen Build error * Added Shapes macOS implementation * Fixed broken unit tests * Use the same Shapes classes between UWP and WPF backends * Fixed flipper macOS shape issue * Changed Shape class to be abstract * Added Polygon and Polyline unit tests * Added more Shapes Unit Tests * Moved Shapes to Xamarin.Forms.Shapes in Android, iOS and macOS * Moved Shapes to Xamarin.Forms.Shapes namespace in Windows (UWP and WPF) fixes #2452 (partially) fixes #9178 * [Enhancement] Shapes (Path) (#9264) * Added Path definition in Core (Shapes) Implemented Path in Android and iOS * Fixed Android build errors * Fixed UWP Build * Fixed WPF Build * Implemented PathRenderer on UWP * Added unit tests * Fixed namespaces conflicts in Platform projects * Changes to fix the build errors * Implemented Path Transformations in Android and iOS * Fixed Build error in WPF and UWP * Implemented Path Transformations in UWP * Fixed iOS Build error * Changes to fix the Build (Path namespace conflict) * More changes to fix the build error * Fixed Windows Build errors * Fixed Path size issue on UWP * Added Shapes_Experimental flag * Updated path sample * Updated Android ShapeRenderer size logic * Added Shape Aspect sample in Core Gallery * Added more Shapes samples * Updated UWP PathRenderer size logic * Updated droid and iOS pathRenderer size logic (same behavior in all the platforms) * Updated UWP ShapeRenderer * Implemented Path in WPF Backend * Fixed build error * Initial Clip implementation in WPF and UWP (work in progress) * Added Path implementation on macOS * Added Clip implementation in Android, iOS and macOS * Fixed broken unit tests * Notify the change of Geometry if any of the child properties changed * Added new sample clipping different views * Fixed flipped shape issue on macOS * Added support to Clip using EllipseGeometry, LineGeometry and RectangleGeometry in UWP * Changed Shape class to be abstract * Moved Shapes to Xamarin.Forms.Shapes in Android, iOS and macOS * Moved Shapes to Xamarin.Forms.Shapes namespace in Windows (UWP and WPF) * Fixed wrong property in LineGeometry * Fixed build error * Added Clip Performance sample in Core Gallery * Update Matrix.cs * Update RectangleGeometry.cs * Update Xamarin.Forms.Platform.macOS.csproj * Some duplicate classes * Update PointCollectionTests.cs * Update ImageButtonRenderer.cs * Update Xamarin.Forms.Platform.iOS.csproj * Update Xamarin.Forms.Platform.iOS.csproj * Fixed tabs error Co-authored-by: Samantha Houts <samhouts@users.noreply.github.com> fixes #2452 (partially) fixes #9178 * Add fluent DynamicResource markup helpers * Add support for all IPaddingElement Elements to Padding markup helpers (was only Layouts) * Make family first parameter of Font markup helper (reduces the need to use named parameters across all FontElement extensions) * Add Stars(double) markup helper for Grids * Add RelativeLayout markup helpers * wip Add RelativeLayoutTests * Add RelativeLayout markup helpers done * Add BindableLayout markup helpers * wip Add MultiBind and MultiConverter support to markup helpers * - Add multiconverter markup helpers - Improve Bind markup helpers: add multibinding, make more strongly typed, remove converterParameter where unused - wip Add unit tests for multiconverter and multibind * wip Add unit tests for multibind * Move MultiBind helpers + tests to separate files wip Complete MultiBind unit tests * wip Add unit tests for MultiBind markup helpers * Add unit tests for MultiBind and MultiConvert markup helpers * Add overloads for Bindable Layout markup helpers that take a Func<object> instead of a DataTemplate * move C# Markup out of forms with internalsvisibleto, eliminate reflection * Markup API: build against Forms 5 NuGet, remove experimental checks, change namespace to Xamarin.CommunityToolkit.Markup, add TODO comments for inaccessible IPaddingElement * Build against Forms 5 NuGet, change namespace to Xamarin.CommunityToolkit.Markup.UnitTests, remove experimental flag testing. add TODO comments for inacccessible API's * Add PR link to TODO comment * Update to Forms NuGets that have public IPaddingElement Get unit tests working and succeeding except for issue in Forms * Bring unit tests to 100% code coverage Cleanup mocks and remove all unused code from them Remove all unnecessary namespace usings * prefix Markup top-level folders with Xamarin.CommunityToolkit. * add Xamarin.CommunityToolkit.Markup.sln, eliminate Markup subfolders, fix notimplemented exception in MockPlatformServices * include stylecop.json in Markup project * add comment with Forms NuGets download url to project files * add prefix Xamarin.CommunityToolkit. to namespaces and assembly names where missing * add package settings, license and icon to markup project * add MarkupSample solution * fix android build errro due to max path length (remove solution folder) complete MarkupSample * remove dependency on internal Forms PaddingElement and FontElement classes * add temporary msbuild target for downloading NuGets from Forms PR * add markup to ci * fix markup project folder names in ci * fix markup temporary NuGet download in ci * fix markup unit test project for ci * use NuGets from PR as merged into Forms 5.5.0 branch fix tests that fail due to Forms PR 12689 not yet merged * remove experimental wrapper from markup unit tests align markup unit test project packagereferences to xct unit test project * fix all code formatting warnings where applicable suppress remaining code formatting warnings with justification where not applicable * add warning codes from GlobalSuppressions.cs to NoWarn in project files * fix Forms version warning revert adding warning codes in project files * ci run all tests in single task * align markup csproj to XCT csproj for same type of debug info in release package * update forms version in markup sample * update to Forms 5.0.0.1709-pre4 remove custom Forms NuGet download targets update unit tests for Forms fix fix xamarin/Xamarin.Forms#12689 * Markup package version to 1.0.0-pre4 Markup sample to Markup 1.0.0-pre4 and Forms 5.0.0.1709-pre4 Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com> Co-authored-by: Javier Suárez <javiersuarezruiz@hotmail.com> Co-authored-by: Vincent Hoogendoorn <dev@vincenth.net> Co-authored-by: Vincent Hoogendoorn <vincenth@workstreampeople.com>
- Loading branch information