summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWonYoung Choi <wy80.choi@samsung.com>2016-09-27 10:18:54 +0900
committerWonYoung Choi <wy80.choi@samsung.com>2016-10-03 12:39:42 +0900
commit16af1efb4bca8567b8d5edfc65b8574d3dff4756 (patch)
tree20b77d07ec8b0e943dcbe637f7eac82d68e4b0a5
parentd67c7d47d0cfe8359f9975cebb066a94d74a677f (diff)
downloadxamarin-forms-16af1efb4bca8567b8d5edfc65b8574d3dff4756.tar.gz
xamarin-forms-16af1efb4bca8567b8d5edfc65b8574d3dff4756.tar.bz2
xamarin-forms-16af1efb4bca8567b8d5edfc65b8574d3dff4756.zip
Update to date Xamarin.Forms of master branch in GitHub
Change-Id: I58f3420f0efd4fca193533bf1f2ba8ca26dab9e0
-rw-r--r--.gitignore7
-rw-r--r--.nuspec/Xamarin.Forms.Maps.nuspec17
-rw-r--r--.nuspec/Xamarin.Forms.Pages.Azure.nuspec11
-rw-r--r--.nuspec/Xamarin.Forms.Pages.nuspec9
-rw-r--r--.nuspec/Xamarin.Forms.nuspec112
-rw-r--r--ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj4
-rw-r--r--PagesGallery/PagesGallery.Droid/app.config4
-rw-r--r--PagesGallery/PagesGallery.iOS/PagesGallery.iOS.csproj1
-rw-r--r--PagesGallery/PagesGallery/PagesGallery.csproj19
-rw-r--r--PagesGallery/PagesGallery/packages.config6
-rw-r--r--Stubs/Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android (Forwarders).csproj4
-rw-r--r--Stubs/Xamarin.Forms.Platform.Android/packages.config4
-rw-r--r--Stubs/Xamarin.Forms.Platform.iOS.Classic/Properties/AssemblyInfo.cs37
-rw-r--r--Stubs/Xamarin.Forms.Platform.iOS.Classic/Xamarin.Forms.Platform.iOS.Classic (Forwarders).csproj65
-rw-r--r--Xamarin.Forms.Build.Tasks/BindablePropertyReferenceExtensions.cs61
-rw-r--r--Xamarin.Forms.Build.Tasks/CompiledConverters/BindablePropertyConverter.cs84
-rw-r--r--Xamarin.Forms.Build.Tasks/CompiledConverters/BindingTypeConverter.cs32
-rw-r--r--Xamarin.Forms.Build.Tasks/CompiledConverters/BoundsTypeConverter.cs73
-rw-r--r--Xamarin.Forms.Build.Tasks/CompiledConverters/ColorTypeConverter.cs55
-rw-r--r--Xamarin.Forms.Build.Tasks/CompiledConverters/ICompiledTypeConverter.cs12
-rw-r--r--Xamarin.Forms.Build.Tasks/CompiledConverters/LayoutOptionsConverter.cs37
-rw-r--r--Xamarin.Forms.Build.Tasks/CompiledConverters/RectangleTypeConverter.cs49
-rw-r--r--Xamarin.Forms.Build.Tasks/CompiledMarkupExtensions/StaticExtension.cs44
-rw-r--r--Xamarin.Forms.Build.Tasks/CreateObjectVisitor.cs15
-rw-r--r--Xamarin.Forms.Build.Tasks/ExpandMarkupsVisitor.cs2
-rw-r--r--Xamarin.Forms.Build.Tasks/MethodReferenceExtensions.cs1
-rw-r--r--Xamarin.Forms.Build.Tasks/NodeILExtensions.cs148
-rw-r--r--Xamarin.Forms.Build.Tasks/Properties/AssemblyInfo.cs4
-rw-r--r--Xamarin.Forms.Build.Tasks/PropertyDefinitionExtensions.cs24
-rw-r--r--Xamarin.Forms.Build.Tasks/SetPropertiesVisitor.cs576
-rw-r--r--Xamarin.Forms.Build.Tasks/SetResourcesVisitor.cs12
-rw-r--r--Xamarin.Forms.Build.Tasks/Xamarin.Forms.Build.Tasks.csproj19
-rw-r--r--Xamarin.Forms.Build.Tasks/XamlCTask.cs177
-rw-r--r--Xamarin.Forms.Build.Tasks/XamlGTask.cs4
-rw-r--r--Xamarin.Forms.Build.Tasks/XmlTypeExtensions.cs8
-rw-r--r--Xamarin.Forms.ControlGallery.Android/Activity1.cs61
-rw-r--r--Xamarin.Forms.ControlGallery.Android/ColorPicker.cs160
-rw-r--r--Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs18
-rw-r--r--Xamarin.Forms.ControlGallery.Android/Properties/AndroidManifest.xml2
-rw-r--r--Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj16
-rw-r--r--Xamarin.Forms.ControlGallery.Android/packages.config2
-rw-r--r--Xamarin.Forms.ControlGallery.WP8/App.xaml.cs5
-rw-r--r--Xamarin.Forms.ControlGallery.WP8/Xamarin.Forms.ControlGallery.WP8.csproj8
-rw-r--r--Xamarin.Forms.ControlGallery.WP8/packages.config2
-rw-r--r--Xamarin.Forms.ControlGallery.WindowsUniversal/MainPage.xaml.cs75
-rw-r--r--Xamarin.Forms.ControlGallery.iOS/AppDelegate.cs247
-rw-r--r--Xamarin.Forms.ControlGallery.iOS/BrokenNativeControl.cs16
-rw-r--r--Xamarin.Forms.ControlGallery.iOS/CustomRenderers.cs75
-rw-r--r--Xamarin.Forms.ControlGallery.iOS/Info.plist9
-rw-r--r--Xamarin.Forms.ControlGallery.iOS/Main.cs22
-rw-r--r--Xamarin.Forms.ControlGallery.iOS/Xamarin.Forms.ControlGallery.iOS.Classic.csproj232
-rw-r--r--Xamarin.Forms.ControlGallery.iOS/Xamarin.Forms.ControlGallery.iOS.csproj35
-rw-r--r--Xamarin.Forms.ControlGallery.iOS/packages.config6
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla43161.cs65
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/TestPages/ScreenshotConditionalApp.cs5
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems1
-rw-r--r--Xamarin.Forms.Controls/ControlGalleryPages/NativeBindingGalleryPage.cs101
-rw-r--r--Xamarin.Forms.Controls/CoreGallery.cs4
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/XamlNativeViews.xaml14
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/XamlNativeViews.xaml.cs21
-rw-r--r--Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj31
-rw-r--r--Xamarin.Forms.Controls/packages.config2
-rw-r--r--Xamarin.Forms.Core.Android.UITests/Xamarin.Forms.Core.Android.UITests.csproj2
-rw-r--r--Xamarin.Forms.Core.Android.UITests/packages.config2
-rw-r--r--Xamarin.Forms.Core.UnitTests/ButtonUnitTest.cs2
-rw-r--r--Xamarin.Forms.Core.UnitTests/NativeBindingTests.cs496
-rw-r--r--Xamarin.Forms.Core.UnitTests/UnitPlatform.cs1
-rw-r--r--Xamarin.Forms.Core.UnitTests/Xamarin.Forms.Core.UnitTests.csproj14
-rw-r--r--Xamarin.Forms.Core.UnitTests/packages.config4
-rw-r--r--Xamarin.Forms.Core.Windows.UITests/Xamarin.Forms.Core.Windows.UITests.csproj8
-rw-r--r--Xamarin.Forms.Core.Windows.UITests/packages.config4
-rw-r--r--Xamarin.Forms.Core.iOS.UITests/Xamarin.Forms.Core.iOS.UITests.csproj2
-rw-r--r--Xamarin.Forms.Core.iOS.UITests/packages.config2
-rw-r--r--Xamarin.Forms.Core/BindablePropertyConverter.cs15
-rw-r--r--Xamarin.Forms.Core/Binding.cs11
-rw-r--r--Xamarin.Forms.Core/BindingTypeConverter.cs1
-rw-r--r--Xamarin.Forms.Core/BoundsTypeConverter.cs5
-rw-r--r--Xamarin.Forms.Core/ColorTypeConverter.cs72
-rw-r--r--Xamarin.Forms.Core/ConstraintExpression.cs9
-rw-r--r--Xamarin.Forms.Core/Element.cs10
-rw-r--r--Xamarin.Forms.Core/INativeBindingService.cs10
-rw-r--r--Xamarin.Forms.Core/INativeValueConverterService.cs9
-rw-r--r--Xamarin.Forms.Core/IProvideValueTarget.cs1
-rw-r--r--Xamarin.Forms.Core/LayoutOptionsConverter.cs24
-rw-r--r--Xamarin.Forms.Core/NativeBindingHelpers.cs196
-rw-r--r--Xamarin.Forms.Core/ParameterAttribute.cs2
-rw-r--r--Xamarin.Forms.Core/Properties/AssemblyInfo.cs8
-rw-r--r--Xamarin.Forms.Core/Properties/ExposeInternalsToXamarin.cs52
-rw-r--r--Xamarin.Forms.Core/ProvideCompiledAttribute.cs15
-rw-r--r--Xamarin.Forms.Core/RectangleTypeConverter.cs1
-rw-r--r--Xamarin.Forms.Core/SignWithXamarinKey.props7
-rw-r--r--Xamarin.Forms.Core/TypeConverter.cs2
-rw-r--r--Xamarin.Forms.Core/Xamarin.Forms.Core.csproj18
-rw-r--r--Xamarin.Forms.Core/Xamarin.Forms.snkbin596 -> 0 bytes
-rw-r--r--Xamarin.Forms.Core/XamlParseException.cs2
-rw-r--r--Xamarin.Forms.CustomAttributes/Xamarin.Forms.CustomAttributes.csproj6
-rw-r--r--Xamarin.Forms.Maps.Android/MapRenderer.cs438
-rw-r--r--Xamarin.Forms.Maps.iOS/FormsMaps.cs7
-rw-r--r--Xamarin.Forms.Maps.iOS/GeocoderBackend.cs17
-rw-r--r--Xamarin.Forms.Maps.iOS/MapRenderer.cs42
-rw-r--r--Xamarin.Forms.Maps.iOS/Xamarin.Forms.Maps.iOS.Classic.csproj92
-rw-r--r--Xamarin.Forms.Maps.iOS/Xamarin.Forms.Maps.iOS.csproj2
-rw-r--r--Xamarin.Forms.Maps/Properties/AssemblyInfo.cs2
-rw-r--r--Xamarin.Forms.Maps/Xamarin.Forms.Maps.csproj12
-rw-r--r--Xamarin.Forms.Pages.Azure/Xamarin.Forms.Pages.Azure.csproj8
-rw-r--r--Xamarin.Forms.Pages.UnitTests/Xamarin.Forms.Pages.UnitTests.csproj13
-rw-r--r--Xamarin.Forms.Pages.UnitTests/packages.config4
-rw-r--r--Xamarin.Forms.Pages/BaseDataSource.cs2
-rw-r--r--Xamarin.Forms.Pages/Xamarin.Forms.Pages.csproj11
-rw-r--r--Xamarin.Forms.Platform.Android.AppLinks/AndroidAppLinks.cs4
-rw-r--r--Xamarin.Forms.Platform.Android.FormsViewGroup/Xamarin.Forms.Platform.Android.FormsViewGroup.csproj1
-rw-r--r--Xamarin.Forms.Platform.Android/AppCompat/FormsAppCompatActivity.cs8
-rw-r--r--Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs7
-rw-r--r--Xamarin.Forms.Platform.Android/ColorExtensions.cs5
-rw-r--r--Xamarin.Forms.Platform.Android/Extensions/NativeBindingExtensions.cs33
-rw-r--r--Xamarin.Forms.Platform.Android/Forms.cs4
-rw-r--r--Xamarin.Forms.Platform.Android/FormsApplicationActivity.cs8
-rw-r--r--Xamarin.Forms.Platform.Android/NativeBindingservice.cs39
-rw-r--r--Xamarin.Forms.Platform.Android/NativeValueConverterService.cs19
-rw-r--r--Xamarin.Forms.Platform.Android/NativeViewWrapper.cs10
-rw-r--r--Xamarin.Forms.Platform.Android/Renderers/WebViewRenderer.cs1
-rw-r--r--Xamarin.Forms.Platform.Android/VisualElementPackager.cs7
-rw-r--r--Xamarin.Forms.Platform.Android/VisualElementTracker.cs24
-rw-r--r--Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android.csproj8
-rw-r--r--Xamarin.Forms.Platform.UAP/NativeBindingService.cs47
-rw-r--r--Xamarin.Forms.Platform.UAP/NativeValueConverterService.cs29
-rw-r--r--Xamarin.Forms.Platform.UAP/Xamarin.Forms.Platform.UAP.csproj11
-rw-r--r--Xamarin.Forms.Platform.WP8/VisualElementTracker.cs44
-rw-r--r--Xamarin.Forms.Platform.WinRT.Phone/PhoneResources.xaml5
-rw-r--r--Xamarin.Forms.Platform.WinRT.Tablet/TabletResources.xaml3
-rw-r--r--Xamarin.Forms.Platform.WinRT/FrameworkElementExtensions.cs16
-rw-r--r--Xamarin.Forms.Platform.WinRT/LabelRenderer.cs2
-rw-r--r--Xamarin.Forms.Platform.WinRT/NativeBindingExtensions.cs58
-rw-r--r--Xamarin.Forms.Platform.WinRT/NativeEventWrapper.cs45
-rw-r--r--Xamarin.Forms.Platform.WinRT/NativePropertyListener.cs47
-rw-r--r--Xamarin.Forms.Platform.WinRT/NativeViewWrapper.cs8
-rw-r--r--Xamarin.Forms.Platform.WinRT/VisualElementPackager.cs6
-rw-r--r--Xamarin.Forms.Platform.WinRT/Xamarin.Forms.Platform.WinRT.csproj15
-rw-r--r--Xamarin.Forms.Platform.iOS/CADisplayLinkTicker.cs11
-rw-r--r--Xamarin.Forms.Platform.iOS/Cells/CellRenderer.cs9
-rw-r--r--Xamarin.Forms.Platform.iOS/Cells/CellTableViewCell.cs10
-rw-r--r--Xamarin.Forms.Platform.iOS/Cells/EntryCellRenderer.cs14
-rw-r--r--Xamarin.Forms.Platform.iOS/Cells/ImageCellRenderer.cs9
-rw-r--r--Xamarin.Forms.Platform.iOS/Cells/SwitchCellRenderer.cs5
-rw-r--r--Xamarin.Forms.Platform.iOS/Cells/TextCellRenderer.cs5
-rw-r--r--Xamarin.Forms.Platform.iOS/Cells/ViewCellRenderer.cs33
-rw-r--r--Xamarin.Forms.Platform.iOS/ContextActionCell.cs20
-rw-r--r--Xamarin.Forms.Platform.iOS/ContextScrollViewDelegate.cs16
-rw-r--r--Xamarin.Forms.Platform.iOS/EventTracker.cs14
-rw-r--r--Xamarin.Forms.Platform.iOS/Extensions/CellExtensions.cs7
-rw-r--r--Xamarin.Forms.Platform.iOS/Extensions/ColorExtensions.cs21
-rw-r--r--Xamarin.Forms.Platform.iOS/Extensions/DateExtensions.cs15
-rw-r--r--Xamarin.Forms.Platform.iOS/Extensions/Extensions.cs7
-rw-r--r--Xamarin.Forms.Platform.iOS/Extensions/LayoutExtensions.cs (renamed from Xamarin.Forms.Platform.iOS/LayoutExtensions.cs)10
-rw-r--r--Xamarin.Forms.Platform.iOS/Extensions/ToolbarItemExtensions.cs16
-rw-r--r--Xamarin.Forms.Platform.iOS/Extensions/UIViewExtensions.cs49
-rw-r--r--Xamarin.Forms.Platform.iOS/Forms.cs18
-rw-r--r--Xamarin.Forms.Platform.iOS/FormsApplicationDelegate.cs11
-rw-r--r--Xamarin.Forms.Platform.iOS/GlobalCloseContextGestureRecognizer.cs17
-rw-r--r--Xamarin.Forms.Platform.iOS/IVisualElementRenderer.cs5
-rw-r--r--Xamarin.Forms.Platform.iOS/NativeBindingService.cs39
-rw-r--r--Xamarin.Forms.Platform.iOS/NativeValueConverterService.cs20
-rw-r--r--Xamarin.Forms.Platform.iOS/NativeViewPropertyListener.cs24
-rw-r--r--Xamarin.Forms.Platform.iOS/NativeViewWrapper.cs22
-rw-r--r--Xamarin.Forms.Platform.iOS/NativeViewWrapperRenderer.cs15
-rw-r--r--Xamarin.Forms.Platform.iOS/PageExtensions.cs5
-rw-r--r--Xamarin.Forms.Platform.iOS/Platform.cs23
-rw-r--r--Xamarin.Forms.Platform.iOS/PlatformEffect.cs8
-rw-r--r--Xamarin.Forms.Platform.iOS/PlatformRenderer.cs6
-rw-r--r--Xamarin.Forms.Platform.iOS/Properties/AssemblyInfo.cs5
-rw-r--r--Xamarin.Forms.Platform.iOS/RendererPool.cs7
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/ActivityIndicatorRenderer.cs7
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/AlignmentExtensions.cs5
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/BoxRenderer.cs16
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs14
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/CarouselPageRenderer.cs16
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/DatePickerRenderer.cs21
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs14
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs9
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/FontExtensions.cs6
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/FormattedStringExtensions.cs6
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/FrameRenderer.cs5
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/ImageRenderer.cs23
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/KeyboardInsetTracker.cs15
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/KeyboardObserver.cs5
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/LabelRenderer.cs15
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs18
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/NavigationMenuRenderer.cs19
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs26
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/OpenGLViewRenderer.cs17
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs6
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs16
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/PickerRenderer.cs18
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/ProgressBarRenderer.cs14
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/ScrollViewRenderer.cs12
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs7
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/SliderRenderer.cs14
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/StepperRenderer.cs5
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/SwitchRenderer.cs5
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs21
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/TableViewModelRenderer.cs19
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/TableViewRenderer.cs9
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs5
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/TimePickerRenderer.cs25
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/WebViewRenderer.cs12
-rw-r--r--Xamarin.Forms.Platform.iOS/ResourcesProvider.cs5
-rw-r--r--Xamarin.Forms.Platform.iOS/ViewInitializedEventArgs.cs5
-rw-r--r--Xamarin.Forms.Platform.iOS/ViewRenderer.cs13
-rw-r--r--Xamarin.Forms.Platform.iOS/VisualElementPackager.cs6
-rw-r--r--Xamarin.Forms.Platform.iOS/VisualElementRenderer.cs20
-rw-r--r--Xamarin.Forms.Platform.iOS/VisualElementTracker.cs9
-rw-r--r--Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.Classic.csproj273
-rw-r--r--Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.csproj9
-rw-r--r--Xamarin.Forms.Platform.iOS/iOSAppLinks.cs13
-rw-r--r--Xamarin.Forms.Platform/Properties/AssemblyInfo.cs2
-rw-r--r--Xamarin.Forms.Platform/Xamarin.Forms.Platform.csproj10
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/CompiledTypeConverter.xaml9
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/CompiledTypeConverter.xaml.cs45
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/GenericCollections.xaml.cs5
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/Issues/BPNotResolvedOnSubClass.xaml.cs13
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/Issues/Bz43450.xaml15
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/Issues/Bz43450.xaml.cs32
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/Issues/Issue1497.cs16
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/MarkupExpressionParserTests.cs6
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/MockCompiler.cs30
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/NativeViewsAndBindings.xaml13
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/NativeViewsAndBindings.xaml.cs293
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/OnPlatform.xaml18
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/OnPlatform.xaml.cs73
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/StaticExtensionTests.cs72
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/Validation/SetterOnNonBP.xaml12
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/Validation/SetterOnNonBP.xaml.cs8
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/XStatic.xaml8
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/XStatic.xaml.cs56
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/XStaticException.xaml8
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/XStaticException.xaml.cs55
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj35
-rw-r--r--Xamarin.Forms.Xaml.Xamlg/Xamarin.Forms.Xaml.Xamlg.csproj1
-rw-r--r--Xamarin.Forms.Xaml/ApplyPropertiesVisitor.cs376
-rw-r--r--Xamarin.Forms.Xaml/CreateValuesVisitor.cs30
-rw-r--r--Xamarin.Forms.Xaml/MarkupExtensions/BindingExtension.cs4
-rw-r--r--Xamarin.Forms.Xaml/MarkupExtensions/StaticExtension.cs6
-rw-r--r--Xamarin.Forms.Xaml/MarkupExtensions/StaticResourceExtension.cs47
-rw-r--r--Xamarin.Forms.Xaml/Properties/AssemblyInfo.cs2
-rw-r--r--Xamarin.Forms.Xaml/TypeConversionExtensions.cs15
-rw-r--r--Xamarin.Forms.Xaml/Xamarin.Forms.Xaml.csproj18
-rw-r--r--Xamarin.Forms.Xaml/XamlNode.cs3
-rw-r--r--Xamarin.Forms.Xaml/XamlParser.cs77
-rw-r--r--Xamarin.Forms.Xaml/XamlServiceProvider.cs22
-rw-r--r--Xamarin.Forms.Xaml/XmlnsHelper.cs11
-rw-r--r--Xamarin.Forms.sln167
-rwxr-xr-xbuild48
-rw-r--r--build-for-target.sh56
-rw-r--r--docs/Xamarin.Forms.Core/Xamarin.Forms.Xaml/XamlParseException.xml19
-rw-r--r--docs/Xamarin.Forms.Core/Xamarin.Forms/ConstraintExpression.xml47
-rw-r--r--docs/Xamarin.Forms.Xaml/Xamarin.Forms.Xaml.Internals/SimpleValueTargetProvider.xml17
-rw-r--r--docs/Xamarin.Forms.Xaml/Xamarin.Forms.Xaml/BindingExtension.xml16
257 files changed, 4750 insertions, 3509 deletions
diff --git a/.gitignore b/.gitignore
index cad364e8..5be94126 100644
--- a/.gitignore
+++ b/.gitignore
@@ -45,9 +45,4 @@ Xamarin.Forms.ControlGallery.WindowsPhone/AppPackages/
Xamarin.Forms.Controls/secrets.txt
Xamarin.Forms.Controls/controlgallery.config
Xamarin.Forms.ControlGallery.Android/Properties/MapsKey.cs
-*.tss
-
-*.sln
-*.swp
-tags
-GBS_DIR_RPMS
+*.tss \ No newline at end of file
diff --git a/.nuspec/Xamarin.Forms.Maps.nuspec b/.nuspec/Xamarin.Forms.Maps.nuspec
index dda83719..7cc93df2 100644
--- a/.nuspec/Xamarin.Forms.Maps.nuspec
+++ b/.nuspec/Xamarin.Forms.Maps.nuspec
@@ -24,17 +24,13 @@
</group>
</dependencies>
<references>
- <group targetFramework="portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10">
+ <group targetFramework="portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10">
<reference file="Xamarin.Forms.Maps.dll" />
</group>
<group targetFramework="Xamarin.iOS10">
<reference file="Xamarin.Forms.Maps.dll" />
<reference file="Xamarin.Forms.Maps.iOS.dll" />
</group>
- <group targetFramework="MonoTouch10">
- <reference file="Xamarin.Forms.Maps.dll" />
- <reference file="Xamarin.Forms.Maps.iOS.Classic.dll" />
- </group>
<group targetFramework="MonoAndroid10">
<reference file="Xamarin.Forms.Maps.dll" />
<reference file="Xamarin.Forms.Maps.Android.dll" />
@@ -57,8 +53,8 @@
</references>
</metadata>
<files>
- <file src="..\Xamarin.Forms.Maps\bin\$Configuration$\Xamarin.Forms.Maps.dll" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10" />
- <file src="..\docs\Xamarin.Forms.Maps.xml" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10" />
+ <file src="..\Xamarin.Forms.Maps\bin\$Configuration$\Xamarin.Forms.Maps.dll" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10" />
+ <file src="..\docs\Xamarin.Forms.Maps.xml" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10" />
<file src="..\Xamarin.Forms.Maps.Android\bin\$Configuration$\Xamarin.Forms.Maps.Android.dll" target="lib\MonoAndroid10" />
<file src="..\Xamarin.Forms.Maps\bin\$Configuration$\Xamarin.Forms.Maps.dll" target="lib\MonoAndroid10" />
@@ -68,10 +64,6 @@
<file src="..\Xamarin.Forms.Maps\bin\$Configuration$\Xamarin.Forms.Maps.dll" target="lib\Xamarin.iOS10" />
<file src="..\docs\Xamarin.Forms.Maps.xml" target="lib\Xamarin.iOS10" />
- <file src="..\Xamarin.Forms.Maps.iOS\classic_bin\iPhoneSimulator\$Configuration$\Xamarin.Forms.Maps.iOS.Classic.dll" target="lib\MonoTouch10" />
- <file src="..\Xamarin.Forms.Maps\bin\$Configuration$\Xamarin.Forms.Maps.dll" target="lib\MonoTouch10" />
- <file src="..\docs\Xamarin.Forms.Maps.xml" target="lib\MonoTouch10" />
-
<file src="..\Xamarin.Forms.Maps.WP8\bin\$Configuration$\Xamarin.Forms.Maps.WP8.dll" target="lib\WP80" />
<file src="..\Xamarin.Forms.Maps\bin\$Configuration$\Xamarin.Forms.Maps.dll" target="lib\WP80" />
<file src="..\docs\Xamarin.Forms.Maps.xml" target="lib\WP80" />
@@ -121,10 +113,9 @@
<file src="..\Xamarin.Forms.Platform.WinRT.Tablet\bin\ARM\$Configuration$\FormsTextBoxStyle.xbf" target="build\win81\ARM\Xamarin.Forms.Platform.WinRT.Tablet" />
<!-- Xaml Design-time Stuff -->
- <file src="..\Xamarin.Forms.Maps.Design\bin\$Configuration$\Xamarin.Forms.Maps.Design.dll" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Design" />
+ <file src="..\Xamarin.Forms.Maps.Design\bin\$Configuration$\Xamarin.Forms.Maps.Design.dll" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10\Design" />
<file src="..\Xamarin.Forms.Maps.Design\bin\$Configuration$\Xamarin.Forms.Maps.Design.dll" target="lib\MonoAndroid10\Design" />
<file src="..\Xamarin.Forms.Maps.Design\bin\$Configuration$\Xamarin.Forms.Maps.Design.dll" target="lib\Xamarin.iOS10\Design" />
- <file src="..\Xamarin.Forms.Maps.Design\bin\$Configuration$\Xamarin.Forms.Maps.Design.dll" target="lib\MonoTouch10\Design" />
<file src="..\Xamarin.Forms.Maps.Design\bin\$Configuration$\Xamarin.Forms.Maps.Design.dll" target="lib\WP80\Design" />
<file src="..\Xamarin.Forms.Maps.Design\bin\$Configuration$\Xamarin.Forms.Maps.Design.dll" target="lib\wpa81\Design" />
<file src="..\Xamarin.Forms.Maps.Design\bin\$Configuration$\Xamarin.Forms.Maps.Design.dll" target="lib\win81\Design" />
diff --git a/.nuspec/Xamarin.Forms.Pages.Azure.nuspec b/.nuspec/Xamarin.Forms.Pages.Azure.nuspec
index 7a4532c9..3ff5a5c9 100644
--- a/.nuspec/Xamarin.Forms.Pages.Azure.nuspec
+++ b/.nuspec/Xamarin.Forms.Pages.Azure.nuspec
@@ -21,15 +21,12 @@
</group>
</dependencies>
<references>
- <group targetFramework="portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10">
+ <group targetFramework="portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10">
<reference file="Xamarin.Forms.Pages.Azure.dll" />
</group>
<group targetFramework="Xamarin.iOS10">
<reference file="Xamarin.Forms.Pages.Azure.dll" />
</group>
- <group targetFramework="MonoTouch10">
- <reference file="Xamarin.Forms.Pages.Azure.dll" />
- </group>
<group targetFramework="MonoAndroid10">
<reference file="Xamarin.Forms.Pages.Azure.dll" />
</group>
@@ -48,15 +45,13 @@
</references>
</metadata>
<files>
- <file src="..\Xamarin.Forms.Pages.Azure\bin\$Configuration$\Xamarin.Forms.Pages.Azure.dll" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10" />
+ <file src="..\Xamarin.Forms.Pages.Azure\bin\$Configuration$\Xamarin.Forms.Pages.Azure.dll" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10" />
<file src="..\Xamarin.Forms.Pages.Azure\bin\$Configuration$\Xamarin.Forms.Pages.Azure.dll" target="lib\MonoAndroid10" />
<file src="..\Xamarin.Forms.Pages.Azure\bin\$Configuration$\Xamarin.Forms.Pages.Azure.dll" target="lib\Xamarin.iOS10" />
- <file src="..\Xamarin.Forms.Pages.Azure\bin\$Configuration$\Xamarin.Forms.Pages.Azure.dll" target="lib\MonoTouch10" />
-
- <file src="..\Xamarin.Forms.Pages.Azure\bin\$Configuration$\Xamarin.Forms.Pages.Azure.dll" target="lib\WP80" />
+ <file src="..\Xamarin.Forms.Pages.Azure\bin\$Configuration$\Xamarin.Forms.Pages.Azure.dll" target="lib\WP80" />
<!--UWP-->
<file src="..\Xamarin.Forms.Pages.Azure\bin\$Configuration$\Xamarin.Forms.Pages.Azure.dll" target="lib\uap10.0" />
diff --git a/.nuspec/Xamarin.Forms.Pages.nuspec b/.nuspec/Xamarin.Forms.Pages.nuspec
index c91b2ab8..148f32ef 100644
--- a/.nuspec/Xamarin.Forms.Pages.nuspec
+++ b/.nuspec/Xamarin.Forms.Pages.nuspec
@@ -19,15 +19,12 @@
</group>
</dependencies>
<references>
- <group targetFramework="portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10">
+ <group targetFramework="portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10">
<reference file="Xamarin.Forms.Pages.dll" />
</group>
<group targetFramework="Xamarin.iOS10">
<reference file="Xamarin.Forms.Pages.dll" />
</group>
- <group targetFramework="MonoTouch10">
- <reference file="Xamarin.Forms.Pages.dll" />
- </group>
<group targetFramework="MonoAndroid10">
<reference file="Xamarin.Forms.Pages.dll" />
</group>
@@ -46,14 +43,12 @@
</references>
</metadata>
<files>
- <file src="..\Xamarin.Forms.Pages\bin\$Configuration$\Xamarin.Forms.Pages.dll" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10" />
+ <file src="..\Xamarin.Forms.Pages\bin\$Configuration$\Xamarin.Forms.Pages.dll" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10" />
<file src="..\Xamarin.Forms.Pages\bin\$Configuration$\Xamarin.Forms.Pages.dll" target="lib\MonoAndroid10" />
<file src="..\Xamarin.Forms.Pages\bin\$Configuration$\Xamarin.Forms.Pages.dll" target="lib\Xamarin.iOS10" />
- <file src="..\Xamarin.Forms.Pages\bin\$Configuration$\Xamarin.Forms.Pages.dll" target="lib\MonoTouch10" />
-
<file src="..\Xamarin.Forms.Pages\bin\$Configuration$\Xamarin.Forms.Pages.dll" target="lib\WP80" />
<!--UWP-->
diff --git a/.nuspec/Xamarin.Forms.nuspec b/.nuspec/Xamarin.Forms.nuspec
index 89c97507..d8b8f068 100644
--- a/.nuspec/Xamarin.Forms.nuspec
+++ b/.nuspec/Xamarin.Forms.nuspec
@@ -25,7 +25,7 @@
</group>
</dependencies>
<references>
- <group targetFramework="portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10">
+ <group targetFramework="portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10">
<reference file="Xamarin.Forms.Core.dll" />
<reference file="Xamarin.Forms.Platform.dll" />
<reference file="Xamarin.Forms.Xaml.dll" />
@@ -36,12 +36,6 @@
<reference file="Xamarin.Forms.Xaml.dll" />
<reference file="Xamarin.Forms.Platform.iOS.dll" />
</group>
- <group targetFramework="MonoTouch10">
- <reference file="Xamarin.Forms.Core.dll" />
- <reference file="Xamarin.Forms.Platform.dll" />
- <reference file="Xamarin.Forms.Xaml.dll" />
- <reference file="Xamarin.Forms.Platform.iOS.Classic.dll" />
- </group>
<group targetFramework="MonoAndroid10">
<reference file="Xamarin.Forms.Core.dll" />
<reference file="Xamarin.Forms.Platform.dll" />
@@ -79,27 +73,27 @@
</metadata>
<files>
<!--PCL-->
- <file src="..\Xamarin.Forms.Core\bin\$Configuration$\Xamarin.Forms.Core.dll" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10" />
- <file src="..\Xamarin.Forms.Core\bin\$Configuration$\Xamarin.Forms.Core.*pdb" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10" />
- <file src="..\Xamarin.Forms.Core\bin\$Configuration$\Xamarin.Forms.Core.*mdb" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10" />
- <file src="..\docs\Xamarin.Forms.Core.xml" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10" />
- <file src="..\Xamarin.Forms.Xaml\bin\$Configuration$\Xamarin.Forms.Xaml.dll" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10" />
- <file src="..\Xamarin.Forms.Xaml\bin\$Configuration$\Xamarin.Forms.Xaml.*pdb" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10" />
- <file src="..\Xamarin.Forms.Xaml\bin\$Configuration$\Xamarin.Forms.Xaml.*mdb" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10" />
- <file src="..\docs\Xamarin.Forms.Xaml.xml" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10" />
- <file src="..\Xamarin.Forms.Platform\bin\$Configuration$\Xamarin.Forms.Platform.dll" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10" />
- <file src="..\Xamarin.Forms.Platform\bin\$Configuration$\Xamarin.Forms.Platform.*pdb" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10" />
- <file src="..\Xamarin.Forms.Platform\bin\$Configuration$\Xamarin.Forms.Platform.*mdb" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10" />
+ <file src="..\Xamarin.Forms.Core\bin\$Configuration$\Xamarin.Forms.Core.dll" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10" />
+ <file src="..\Xamarin.Forms.Core\bin\$Configuration$\Xamarin.Forms.Core.*pdb" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10" />
+ <file src="..\Xamarin.Forms.Core\bin\$Configuration$\Xamarin.Forms.Core.*mdb" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10" />
+ <file src="..\docs\Xamarin.Forms.Core.xml" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10" />
+ <file src="..\Xamarin.Forms.Xaml\bin\$Configuration$\Xamarin.Forms.Xaml.dll" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10" />
+ <file src="..\Xamarin.Forms.Xaml\bin\$Configuration$\Xamarin.Forms.Xaml.*pdb" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10" />
+ <file src="..\Xamarin.Forms.Xaml\bin\$Configuration$\Xamarin.Forms.Xaml.*mdb" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10" />
+ <file src="..\docs\Xamarin.Forms.Xaml.xml" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10" />
+ <file src="..\Xamarin.Forms.Platform\bin\$Configuration$\Xamarin.Forms.Platform.dll" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10" />
+ <file src="..\Xamarin.Forms.Platform\bin\$Configuration$\Xamarin.Forms.Platform.*pdb" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10" />
+ <file src="..\Xamarin.Forms.Platform\bin\$Configuration$\Xamarin.Forms.Platform.*mdb" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10" />
<!--Xaml PCL Stuff-->
- <file src="Xamarin.Forms.targets" target="build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms$IdAppend$.targets" />
- <file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\Xamarin.Forms.Build.Tasks.dll" target="build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10" />
- <file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\Xamarin.Forms.Core.dll" target="build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10" />
- <file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\Xamarin.Forms.Xaml.dll" target="build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10" />
+ <file src="Xamarin.Forms.targets" target="build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10\Xamarin.Forms$IdAppend$.targets" />
+ <file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\Xamarin.Forms.Build.Tasks.dll" target="build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10" />
+ <file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\Xamarin.Forms.Core.dll" target="build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10" />
+ <file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\Xamarin.Forms.Xaml.dll" target="build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10" />
<!-- Xaml Design-time Stuff -->
- <file src="..\Xamarin.Forms.Core.Design\bin\$Configuration$\Xamarin.Forms.Core.Design.dll" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Design" />
- <file src="..\Xamarin.Forms.Xaml.Design\bin\$Configuration$\Xamarin.Forms.Xaml.Design.dll" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Design" />
+ <file src="..\Xamarin.Forms.Core.Design\bin\$Configuration$\Xamarin.Forms.Core.Design.dll" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10\Design" />
+ <file src="..\Xamarin.Forms.Xaml.Design\bin\$Configuration$\Xamarin.Forms.Xaml.Design.dll" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10\Design" />
<file src="..\Xamarin.Forms.Core.Design\bin\$Configuration$\Xamarin.Forms.Core.Design.dll" target="lib\MonoAndroid10\Design" />
<file src="..\Xamarin.Forms.Xaml.Design\bin\$Configuration$\Xamarin.Forms.Xaml.Design.dll" target="lib\MonoAndroid10\Design" />
@@ -107,9 +101,6 @@
<file src="..\Xamarin.Forms.Core.Design\bin\$Configuration$\Xamarin.Forms.Core.Design.dll" target="lib\Xamarin.iOS10\Design" />
<file src="..\Xamarin.Forms.Xaml.Design\bin\$Configuration$\Xamarin.Forms.Xaml.Design.dll" target="lib\Xamarin.iOS10\Design" />
- <file src="..\Xamarin.Forms.Core.Design\bin\$Configuration$\Xamarin.Forms.Core.Design.dll" target="lib\MonoTouch10\Design" />
- <file src="..\Xamarin.Forms.Xaml.Design\bin\$Configuration$\Xamarin.Forms.Xaml.Design.dll" target="lib\MonoTouch10\Design" />
-
<file src="..\Xamarin.Forms.Core.Design\bin\$Configuration$\Xamarin.Forms.Core.Design.dll" target="lib\WP80\Design" />
<file src="..\Xamarin.Forms.Xaml.Design\bin\$Configuration$\Xamarin.Forms.Xaml.Design.dll" target="lib\WP80\Design" />
@@ -123,15 +114,15 @@
<file src="..\Xamarin.Forms.Xaml.Design\bin\$Configuration$\Xamarin.Forms.Xaml.Design.dll" target="lib\uap10.0\Design" />
<!-- XamlC stuffs -->
- <file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\Mono.Cecil.dll" target="build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10" />
- <file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\Mono.Cecil.Mdb.dll" target="build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10" />
- <file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\Mono.Cecil.Pdb.dll" target="build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10" />
- <file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\Mono.Cecil.Rocks.dll" target="build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10" />
- <file src="..\ICSharpCode.Decompiler\bin\$Configuration$\ICSharpCode.Decompiler.dll" target="build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10" />
- <file src="..\ICSharpCode.Decompiler\bin\$Configuration$\ICSharpCode.NRefactory.dll" target="build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10" />
- <file src="..\ICSharpCode.Decompiler\bin\$Configuration$\ICSharpCode.NRefactory.Cecil.dll" target="build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10" />
- <file src="..\ICSharpCode.Decompiler\bin\$Configuration$\ICSharpCode.NRefactory.CSharp.dll" target="build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10" />
- <file src="..\ICSharpCode.Decompiler\bin\$Configuration$\ICSharpCode.NRefactory.Xml.dll" target="build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10" />
+ <file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\Mono.Cecil.dll" target="build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10" />
+ <file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\Mono.Cecil.Mdb.dll" target="build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10" />
+ <file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\Mono.Cecil.Pdb.dll" target="build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10" />
+ <file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\Mono.Cecil.Rocks.dll" target="build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10" />
+ <file src="..\ICSharpCode.Decompiler\bin\$Configuration$\ICSharpCode.Decompiler.dll" target="build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10" />
+ <file src="..\ICSharpCode.Decompiler\bin\$Configuration$\ICSharpCode.NRefactory.dll" target="build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10" />
+ <file src="..\ICSharpCode.Decompiler\bin\$Configuration$\ICSharpCode.NRefactory.Cecil.dll" target="build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10" />
+ <file src="..\ICSharpCode.Decompiler\bin\$Configuration$\ICSharpCode.NRefactory.CSharp.dll" target="build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10" />
+ <file src="..\ICSharpCode.Decompiler\bin\$Configuration$\ICSharpCode.NRefactory.Xml.dll" target="build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10" />
<!--Android-->
<file src="..\Xamarin.Forms.Platform.Android\bin\$Configuration$\Xamarin.Forms.Platform.Android.dll" target="lib\MonoAndroid10" />
@@ -160,20 +151,6 @@
<file src="..\docs\Xamarin.Forms.Xaml.xml" target="lib\Xamarin.iOS10" />
<file src="..\Stubs\Xamarin.Forms.Platform.iOS\bin\iPhone\$Configuration$\Xamarin.Forms.Platform.dll" target="lib\Xamarin.iOS10" />
- <!--iPhone Classic-->
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\Xamarin.Forms.Platform.iOS.Classic.dll" target="lib\MonoTouch10" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\Xamarin.Forms.Platform.iOS.Classic.*pdb" target="lib\MonoTouch10" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\Xamarin.Forms.Platform.iOS.Classic.*mdb" target="lib\MonoTouch10" />
- <file src="..\Xamarin.Forms.Core\bin\$Configuration$\Xamarin.Forms.Core.dll" target="lib\MonoTouch10" />
- <file src="..\Xamarin.Forms.Core\bin\$Configuration$\Xamarin.Forms.Core.*pdb" target="lib\MonoTouch10" />
- <file src="..\Xamarin.Forms.Core\bin\$Configuration$\Xamarin.Forms.Core.*mdb" target="lib\MonoTouch10" />
- <file src="..\docs\Xamarin.Forms.Core.xml" target="lib\MonoTouch10" />
- <file src="..\Xamarin.Forms.Xaml\bin\$Configuration$\Xamarin.Forms.Xaml.dll" target="lib\MonoTouch10" />
- <file src="..\Xamarin.Forms.Xaml\bin\$Configuration$\Xamarin.Forms.Xaml.*pdb" target="lib\MonoTouch10" />
- <file src="..\Xamarin.Forms.Xaml\bin\$Configuration$\Xamarin.Forms.Xaml.*mdb" target="lib\MonoTouch10" />
- <file src="..\docs\Xamarin.Forms.Xaml.xml" target="lib\MonoTouch10" />
- <file src="..\Stubs\Xamarin.Forms.Platform.iOS.Classic\bin\iPhone\$Configuration$\Xamarin.Forms.Platform.dll" target="lib\MonoTouch10" />
-
<!--Windows Phone 8-->
<file src="..\Xamarin.Forms.Platform.WP8\bin\$Configuration$\Xamarin.Forms.Platform.WP8.dll" target="lib\WP80" />
<file src="..\Xamarin.Forms.Platform.WP8\bin\$Configuration$\Xamarin.Forms.Platform.WP8.*pdb" target="lib\WP80" />
@@ -285,40 +262,5 @@
<file src="..\Xamarin.Forms.Platform.iOS\bin\$Configuration$\zh-Hant\Xamarin.Forms.Platform.iOS.resources.dll" target="lib\Xamarin.iOS10\zh-Hant" />
<file src="..\Xamarin.Forms.Platform.iOS\bin\$Configuration$\zh-HK\Xamarin.Forms.Platform.iOS.resources.dll" target="lib\Xamarin.iOS10\zh-HK" />
- <!-- iOS Classic Localized String Resource Assemblies -->
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\ar\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\ar" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\ca\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\ca" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\cs\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\cs" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\da\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\da" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\de\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\de" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\el\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\el" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\es\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\es" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\fi\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\fi" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\fr\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\fr" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\he\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\he" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\hi\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\hi" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\hr\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\hr" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\hu\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\hu" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\id\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\id" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\it\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\it" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\ja\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\ja" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\ko\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\ko" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\ms\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\ms" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\nb\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\nb" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\nl\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\nl" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\pl\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\pl" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\pt-BR\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\pt-BR" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\pt\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\pt" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\ro\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\ro" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\ru\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\ru" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\sk\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\sk" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\sv\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\sv" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\th\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\th" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\tr\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\tr" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\uk\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\uk" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\vi\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\vi" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\zh-Hans\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\zh-Hans" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\zh-Hant\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\zh-Hant" />
- <file src="..\Xamarin.Forms.Platform.iOS\classic_bin\iPhoneSimulator\$Configuration$\zh-HK\Xamarin.Forms.Platform.iOS.Classic.resources.dll" target="lib\MonoTouch10\zh-HK" />
</files>
</package>
diff --git a/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj b/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj
index b5ca7143..7bfc0abe 100644
--- a/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj
+++ b/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj
@@ -13,8 +13,8 @@
<NoStdLib>False</NoStdLib>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <SignAssembly>true</SignAssembly>
- <AssemblyOriginatorKeyFile>..\Xamarin.Forms.Core\Xamarin.Forms.snk</AssemblyOriginatorKeyFile>
+ <SignAssembly>false</SignAssembly>
+ <AssemblyOriginatorKeyFile>..\NRefactory\ICSharpCode.NRefactory.snk</AssemblyOriginatorKeyFile>
<DelaySign>False</DelaySign>
<AssemblyOriginatorKeyMode>File</AssemblyOriginatorKeyMode>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
diff --git a/PagesGallery/PagesGallery.Droid/app.config b/PagesGallery/PagesGallery.Droid/app.config
index d536bee7..e4157146 100644
--- a/PagesGallery/PagesGallery.Droid/app.config
+++ b/PagesGallery/PagesGallery.Droid/app.config
@@ -14,6 +14,10 @@
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
</dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="Mono.Cecil" publicKeyToken="0738eb9f132ed756" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-0.9.6.0" newVersion="0.9.6.0" />
+ </dependentAssembly>
</assemblyBinding>
</runtime>
</configuration> \ No newline at end of file
diff --git a/PagesGallery/PagesGallery.iOS/PagesGallery.iOS.csproj b/PagesGallery/PagesGallery.iOS/PagesGallery.iOS.csproj
index 685e8084..cecb6247 100644
--- a/PagesGallery/PagesGallery.iOS/PagesGallery.iOS.csproj
+++ b/PagesGallery/PagesGallery.iOS/PagesGallery.iOS.csproj
@@ -126,6 +126,7 @@
</ProjectReference>
<ProjectReference Include="..\PagesGallery\PagesGallery.csproj">
<Name>PagesGallery</Name>
+ <Project>{7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
diff --git a/PagesGallery/PagesGallery/PagesGallery.csproj b/PagesGallery/PagesGallery/PagesGallery.csproj
index 4cc674ac..681f59da 100644
--- a/PagesGallery/PagesGallery/PagesGallery.csproj
+++ b/PagesGallery/PagesGallery/PagesGallery.csproj
@@ -11,7 +11,7 @@
<RootNamespace>PagesGallery</RootNamespace>
<AssemblyName>PagesGallery</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <TargetFrameworkProfile Condition=" '$(OS)' != 'Unix' ">Profile259</TargetFrameworkProfile>
+ <TargetFrameworkProfile>Profile259</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<NuGetPackageImportStamp>
@@ -49,6 +49,7 @@
</ItemGroup>
<ItemGroup>
<None Include="GettingStarted.Xamarin" />
+ <None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Xamarin.Forms.Core\Xamarin.Forms.Core.csproj">
@@ -95,11 +96,18 @@
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
- <Import Condition=" '$(OS)' != 'Unix' " Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
- <Import Condition=" '$(OS)' == 'Unix' " Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <ItemGroup Condition=" '$(OS)' == 'Unix' ">
- <Reference Include="System" />
+ <ItemGroup>
+ <Reference Include="System.Net.Http">
+ <HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Net.Http.Extensions">
+ <HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Extensions.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Net.Http.Primitives">
+ <HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Primitives.dll</HintPath>
+ </Reference>
</ItemGroup>
+ <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="..\..\.nuspec\Xamarin.Forms.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
@@ -108,4 +116,5 @@
<Target Name="AfterBuild">
</Target>
-->
+ <Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
</Project> \ No newline at end of file
diff --git a/PagesGallery/PagesGallery/packages.config b/PagesGallery/PagesGallery/packages.config
new file mode 100644
index 00000000..316274a4
--- /dev/null
+++ b/PagesGallery/PagesGallery/packages.config
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="Microsoft.Bcl" version="1.1.10" targetFramework="portable45-net45+win8+wp8+wpa81" />
+ <package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="portable45-net45+win8+wp8+wpa81" />
+ <package id="Microsoft.Net.Http" version="2.2.29" targetFramework="portable45-net45+win8+wp8+wpa81" />
+</packages> \ No newline at end of file
diff --git a/Stubs/Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android (Forwarders).csproj b/Stubs/Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android (Forwarders).csproj
index 198d8896..eb0b1060 100644
--- a/Stubs/Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android (Forwarders).csproj
+++ b/Stubs/Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android (Forwarders).csproj
@@ -18,7 +18,7 @@
<DevInstrumentationEnabled>True</DevInstrumentationEnabled>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
- <TargetFrameworkVersion>v6.0</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v7.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -93,4 +93,4 @@
<Target Name="AfterBuild">
</Target>
-->
-</Project> \ No newline at end of file
+</Project>
diff --git a/Stubs/Xamarin.Forms.Platform.Android/packages.config b/Stubs/Xamarin.Forms.Platform.Android/packages.config
index 6810816e..642b73a8 100644
--- a/Stubs/Xamarin.Forms.Platform.Android/packages.config
+++ b/Stubs/Xamarin.Forms.Platform.Android/packages.config
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Xamarin.Android.Support.v4" version="23.3.0" targetFramework="monoandroid60" />
- <package id="Xamarin.Android.Support.v7.RecyclerView" version="23.3.0" targetFramework="monoandroid60" />
+ <package id="Xamarin.Android.Support.v4" version="23.4.0.1" targetFramework="monoandroid70" />
+ <package id="Xamarin.Android.Support.v7.RecyclerView" version="23.4.0.1" targetFramework="monoandroid70" />
</packages> \ No newline at end of file
diff --git a/Stubs/Xamarin.Forms.Platform.iOS.Classic/Properties/AssemblyInfo.cs b/Stubs/Xamarin.Forms.Platform.iOS.Classic/Properties/AssemblyInfo.cs
deleted file mode 100644
index 43f81582..00000000
--- a/Stubs/Xamarin.Forms.Platform.iOS.Classic/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle ("Xamarin.Forms.Platform.iOS.Classic")]
-[assembly: AssemblyDescription ("")]
-[assembly: AssemblyConfiguration ("")]
-[assembly: AssemblyCompany ("")]
-[assembly: AssemblyProduct ("Xamarin.Forms.Platform.iOS.Classic")]
-[assembly: AssemblyCopyright ("Copyright © 2015")]
-[assembly: AssemblyTrademark ("")]
-[assembly: AssemblyCulture ("")]
-[assembly: InternalsVisibleTo ("Xamarin.Forms.Core")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible (false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid ("fa4af8a0-f4f1-41b4-a463-a8b5b8fc5b8b")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion ("1.0.0.0")]
-[assembly: AssemblyFileVersion ("1.0.0.0")]
diff --git a/Stubs/Xamarin.Forms.Platform.iOS.Classic/Xamarin.Forms.Platform.iOS.Classic (Forwarders).csproj b/Stubs/Xamarin.Forms.Platform.iOS.Classic/Xamarin.Forms.Platform.iOS.Classic (Forwarders).csproj
deleted file mode 100644
index 71212660..00000000
--- a/Stubs/Xamarin.Forms.Platform.iOS.Classic/Xamarin.Forms.Platform.iOS.Classic (Forwarders).csproj
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
- <ProductVersion>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{3E443AEF-3EC0-48C4-A524-7C6996339E1B}</ProjectGuid>
- <ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <OutputType>Library</OutputType>
- <RootNamespace>Xamarin.Forms.Platform</RootNamespace>
- <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
- <AssemblyName>Xamarin.Forms.Platform</AssemblyName>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\iPhone\Debug</OutputPath>
- <DefineConstants>DEBUG</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <ConsolePause>false</ConsolePause>
- <MtouchDebug>true</MtouchDebug>
- <CodesignKey>iPhone Developer</CodesignKey>
- <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>none</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\iPhone\Release</OutputPath>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <ConsolePause>false</ConsolePause>
- <CodesignKey>iPhone Developer</CodesignKey>
- <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'AppStore|AnyCPU'">
- <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- </PropertyGroup>
- <ItemGroup>
- <Compile Include="..\Xamarin.Forms.Platform.cs">
- <Link>Xamarin.Forms.Platform.cs</Link>
- </Compile>
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\Xamarin.Forms.Core\Xamarin.Forms.Core.csproj">
- <Project>{57b8b73d-c3b5-4c42-869e-7b2f17d354ac}</Project>
- <Name>Xamarin.Forms.Core</Name>
- </ProjectReference>
- <ProjectReference Include="..\..\Xamarin.Forms.Platform.iOS\Xamarin.Forms.Platform.iOS.Classic.csproj">
- <Project>{4a47b5df-ddfc-476b-ac41-5105ff3b9b8b}</Project>
- <Name>Xamarin.Forms.Platform.iOS.Classic</Name>
- <IsAppExtension>false</IsAppExtension>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Xml" />
- <Reference Include="System.Core" />
- <Reference Include="monotouch" />
- </ItemGroup>
- <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets" />
-</Project> \ No newline at end of file
diff --git a/Xamarin.Forms.Build.Tasks/BindablePropertyReferenceExtensions.cs b/Xamarin.Forms.Build.Tasks/BindablePropertyReferenceExtensions.cs
new file mode 100644
index 00000000..159bbf5f
--- /dev/null
+++ b/Xamarin.Forms.Build.Tasks/BindablePropertyReferenceExtensions.cs
@@ -0,0 +1,61 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Xml;
+
+using Mono.Cecil;
+
+using Xamarin.Forms.Xaml;
+
+namespace Xamarin.Forms.Build.Tasks
+{
+ static class BindablePropertyReferenceExtensions
+ {
+ public static TypeReference GetBindablePropertyType(this FieldReference bpRef, IXmlLineInfo iXmlLineInfo, ModuleDefinition module)
+ {
+ if (!bpRef.Name.EndsWith("Property", StringComparison.InvariantCulture))
+ throw new XamlParseException($"The name of the bindable property {bpRef.Name} does not ends with \"Property\". This is the kind of convention the world is build upon, a bit like Planck's constant.", iXmlLineInfo);
+ var bpName = bpRef.Name.Substring(0, bpRef.Name.Length - 8);
+ var owner = bpRef.DeclaringType;
+ TypeReference _;
+
+ var getter = owner.GetProperty(pd => pd.Name == bpName, out _)?.GetMethod;
+ if (getter == null || getter.IsStatic || !getter.IsPublic)
+ getter = null;
+ getter = getter ?? owner.GetMethods(md => md.Name == $"Get{bpName}" &&
+ md.IsStatic &&
+ md.IsPublic &&
+ md.Parameters.Count == 1 &&
+ md.Parameters [0].ParameterType.FullName == "Xamarin.Forms.BindableObject", module).SingleOrDefault()?.Item1;
+
+ if (getter == null)
+ throw new XamlParseException($"Missing a public static Get{bpName} or a public instance property getter for the attached property \"{bpRef.DeclaringType}.{bpRef.Name}\"", iXmlLineInfo);
+ return getter.ReturnType;
+ }
+
+ public static TypeReference GetBindablePropertyTypeConverter(this FieldReference bpRef, ModuleDefinition module)
+ {
+ TypeReference _;
+ var owner = bpRef.DeclaringType;
+ var bpName = bpRef.Name.EndsWith("Property", StringComparison.Ordinal) ? bpRef.Name.Substring(0, bpRef.Name.Length - 8) : bpRef.Name;
+ var property = owner.GetProperty(pd => pd.Name == bpName, out _);
+ var staticGetter = owner.GetMethods(md => md.Name == $"Get{bpName}" &&
+ md.IsStatic &&
+ md.IsPublic &&
+ md.Parameters.Count == 1 &&
+ md.Parameters [0].ParameterType.FullName == "Xamarin.Forms.BindableObject", module).SingleOrDefault()?.Item1;
+
+ var attributes = new List<CustomAttribute>();
+ if (property != null && property.HasCustomAttributes)
+ attributes.AddRange(property.CustomAttributes);
+ if (property != null && property.PropertyType.Resolve().HasCustomAttributes)
+ attributes.AddRange(property.PropertyType.Resolve().CustomAttributes);
+ if (staticGetter != null && staticGetter.HasCustomAttributes)
+ attributes.AddRange(staticGetter.CustomAttributes);
+ if (staticGetter != null && staticGetter.ReturnType.Resolve().HasCustomAttributes)
+ attributes.AddRange(staticGetter.ReturnType.Resolve().CustomAttributes);
+
+ return attributes.FirstOrDefault(cad => TypeConverterAttribute.TypeConvertersType.Contains(cad.AttributeType.FullName))?.ConstructorArguments [0].Value as TypeReference;
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Build.Tasks/CompiledConverters/BindablePropertyConverter.cs b/Xamarin.Forms.Build.Tasks/CompiledConverters/BindablePropertyConverter.cs
new file mode 100644
index 00000000..92a53539
--- /dev/null
+++ b/Xamarin.Forms.Build.Tasks/CompiledConverters/BindablePropertyConverter.cs
@@ -0,0 +1,84 @@
+using System.Collections.Generic;
+using System.Linq;
+using Mono.Cecil;
+using Mono.Cecil.Cil;
+
+using Xamarin.Forms.Build.Tasks;
+using Xamarin.Forms.Xaml;
+
+using static System.String;
+
+namespace Xamarin.Forms.Core.XamlC
+{
+ class BindablePropertyConverter : ICompiledTypeConverter
+ {
+ public IEnumerable<Instruction> ConvertFromString(string value, ModuleDefinition module, BaseNode node)
+ {
+ if (IsNullOrEmpty(value)) {
+ yield return Instruction.Create(OpCodes.Ldnull);
+ yield break;
+ }
+
+ FieldReference bpRef = null;
+ string typeName = null, propertyName = null;
+
+ var parts = value.Split('.');
+ if (parts.Length == 1) {
+ var parent = node.Parent?.Parent as IElementNode;
+ if ((node.Parent as ElementNode)?.XmlType.NamespaceUri == "http://xamarin.com/schemas/2014/forms" && (node.Parent as ElementNode)?.XmlType.Name == "Setter") {
+ if (parent.XmlType.NamespaceUri == "http://xamarin.com/schemas/2014/forms" &&
+ (parent.XmlType.Name == "Trigger" || parent.XmlType.Name == "DataTrigger" || parent.XmlType.Name == "MultiTrigger" || parent.XmlType.Name == "Style")) {
+ var ttnode = (parent as ElementNode).Properties [new XmlName("", "TargetType")];
+ if (ttnode is ValueNode)
+ typeName = (ttnode as ValueNode).Value as string;
+ else if (ttnode is IElementNode)
+ typeName = ((ttnode as IElementNode).CollectionItems.FirstOrDefault() as ValueNode)?.Value as string ?? ((ttnode as IElementNode).Properties [new XmlName("", "TypeName")] as ValueNode)?.Value as string;
+ }
+ } else if ((node.Parent as ElementNode)?.XmlType.NamespaceUri == "http://xamarin.com/schemas/2014/forms" && (node.Parent as ElementNode)?.XmlType.Name == "Trigger")
+ typeName = ((node.Parent as ElementNode).Properties [new XmlName("", "TargetType")] as ValueNode).Value as string;
+ propertyName = parts [0];
+ } else if (parts.Length == 2) {
+ typeName = parts [0];
+ propertyName = parts [1];
+ } else
+ throw new XamlParseException($"Cannot convert \"{value}\" into {typeof(BindableProperty)}", node);
+
+ var typeRef = GetTypeReference(typeName, module, node);
+ if (typeRef == null)
+ throw new XamlParseException($"Can't resolve {typeName}", node);
+ bpRef = GetBindablePropertyFieldReference(typeRef, propertyName, module);
+ if (bpRef == null)
+ throw new XamlParseException($"Can't resolve {propertyName} on {typeRef.Name}", node);
+ yield return Instruction.Create(OpCodes.Ldsfld, bpRef);
+ }
+
+ public static TypeReference GetTypeReference(string xmlType, ModuleDefinition module, BaseNode iNode)
+ {
+ var split = xmlType.Split(':');
+ if (split.Length > 2)
+ throw new XamlParseException($"Type \"{xmlType}\" is invalid", iNode);
+
+ string prefix, name;
+ if (split.Length == 2) {
+ prefix = split [0];
+ name = split [1];
+ } else {
+ prefix = "";
+ name = split [0];
+ }
+ var namespaceuri = iNode.NamespaceResolver.LookupNamespace(prefix) ?? "";
+ return XmlTypeExtensions.GetTypeReference(namespaceuri, name, module, iNode);
+ }
+
+ public static FieldReference GetBindablePropertyFieldReference(TypeReference typeRef, string propertyName, ModuleDefinition module)
+ {
+ TypeReference declaringTypeReference;
+ FieldReference bpRef = typeRef.GetField(fd => fd.Name == $"{propertyName}Property" && fd.IsStatic && fd.IsPublic, out declaringTypeReference);
+ if (bpRef != null) {
+ bpRef = module.Import(bpRef.ResolveGenericParameters(declaringTypeReference));
+ bpRef.FieldType = module.Import(bpRef.FieldType);
+ }
+ return bpRef;
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Build.Tasks/CompiledConverters/BindingTypeConverter.cs b/Xamarin.Forms.Build.Tasks/CompiledConverters/BindingTypeConverter.cs
new file mode 100644
index 00000000..74990a86
--- /dev/null
+++ b/Xamarin.Forms.Build.Tasks/CompiledConverters/BindingTypeConverter.cs
@@ -0,0 +1,32 @@
+using System.Collections.Generic;
+using System.Linq;
+
+using Mono.Cecil;
+using Mono.Cecil.Cil;
+
+using Xamarin.Forms.Xaml;
+
+using static System.String;
+
+namespace Xamarin.Forms.Core.XamlC
+{
+ class BindingTypeConverter : ICompiledTypeConverter
+ {
+ public IEnumerable<Instruction> ConvertFromString(string value, ModuleDefinition module, BaseNode node)
+ {
+ if (IsNullOrEmpty(value))
+ throw new XamlParseException($"Cannot convert \"{value}\" into {typeof(Binding)}", node);
+
+ var bindingCtor = module.Import(typeof(Binding)).Resolve().Methods.FirstOrDefault(md => md.IsConstructor && md.Parameters.Count == 6);
+ var bindingCtorRef = module.Import(bindingCtor);
+
+ yield return Instruction.Create(OpCodes.Ldstr, value);
+ yield return Instruction.Create(OpCodes.Ldc_I4, (int)BindingMode.Default);
+ yield return Instruction.Create(OpCodes.Ldnull);
+ yield return Instruction.Create(OpCodes.Ldnull);
+ yield return Instruction.Create(OpCodes.Ldnull);
+ yield return Instruction.Create(OpCodes.Ldnull);
+ yield return Instruction.Create(OpCodes.Newobj, bindingCtorRef);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Build.Tasks/CompiledConverters/BoundsTypeConverter.cs b/Xamarin.Forms.Build.Tasks/CompiledConverters/BoundsTypeConverter.cs
new file mode 100644
index 00000000..1cc64fc5
--- /dev/null
+++ b/Xamarin.Forms.Build.Tasks/CompiledConverters/BoundsTypeConverter.cs
@@ -0,0 +1,73 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+
+using Mono.Cecil;
+using Mono.Cecil.Cil;
+
+using Xamarin.Forms.Xaml;
+
+namespace Xamarin.Forms.Core.XamlC
+{
+ class BoundsTypeConverter : ICompiledTypeConverter
+ {
+ IEnumerable<Instruction> ICompiledTypeConverter.ConvertFromString(string value, ModuleDefinition module, BaseNode node)
+ {
+ if (string.IsNullOrEmpty(value))
+ throw new XamlParseException($"Cannot convert \"{value}\" into {typeof(Rectangle)}", node);
+
+ double x = -1, y = -1, w = -1, h = -1;
+ bool hasX, hasY, hasW, hasH;
+ var xywh = value.Split(',');
+
+ if (xywh.Length != 2 && xywh.Length != 4)
+ throw new XamlParseException($"Cannot convert \"{value}\" into {typeof(Rectangle)}", node);
+
+ hasX = (xywh.Length == 2 || xywh.Length == 4) && double.TryParse(xywh [0], NumberStyles.Number, CultureInfo.InvariantCulture, out x);
+ hasY = (xywh.Length == 2 || xywh.Length == 4) && double.TryParse(xywh [1], NumberStyles.Number, CultureInfo.InvariantCulture, out y);
+ hasW = xywh.Length == 4 && double.TryParse(xywh [2], NumberStyles.Number, CultureInfo.InvariantCulture, out w);
+ hasH = xywh.Length == 4 && double.TryParse(xywh [3], NumberStyles.Number, CultureInfo.InvariantCulture, out h);
+
+ if (!hasW && xywh.Length == 4 && string.Compare("AutoSize", xywh [2].Trim(), StringComparison.OrdinalIgnoreCase) == 0) {
+ hasW = true;
+ w = AbsoluteLayout.AutoSize;
+ }
+
+ if (!hasH && xywh.Length == 4 && string.Compare("AutoSize", xywh [3].Trim(), StringComparison.OrdinalIgnoreCase) == 0) {
+ hasH = true;
+ h = AbsoluteLayout.AutoSize;
+ }
+
+ if (hasX && hasY && xywh.Length == 2) {
+ hasW = true;
+ w = AbsoluteLayout.AutoSize;
+ hasH = true;
+ h = AbsoluteLayout.AutoSize;
+ }
+
+ if (!hasX || !hasY || !hasW || !hasH)
+ throw new XamlParseException($"Cannot convert \"{value}\" into {typeof(Rectangle)}", node);
+
+ return GenerateIL(x, y, w, h, module);
+ }
+
+ IEnumerable<Instruction> GenerateIL(double x, double y, double w, double h, ModuleDefinition module)
+ {
+// IL_0000: ldc.r8 3.1000000000000001
+// IL_0009: ldc.r8 4.2000000000000002
+// IL_0012: ldc.r8 5.2999999999999998
+// IL_001b: ldc.r8 6.4000000000000004
+// IL_0024: newobj instance void valuetype Test.Rectangle::'.ctor'(float64, float64, float64, float64)
+
+ yield return Instruction.Create(OpCodes.Ldc_R8, x);
+ yield return Instruction.Create(OpCodes.Ldc_R8, y);
+ yield return Instruction.Create(OpCodes.Ldc_R8, w);
+ yield return Instruction.Create(OpCodes.Ldc_R8, h);
+
+ var rectangleCtor = module.Import(typeof(Rectangle)).Resolve().Methods.FirstOrDefault(md => md.IsConstructor && md.Parameters.Count == 4);
+ var rectangleCtorRef = module.Import(rectangleCtor);
+ yield return Instruction.Create(OpCodes.Newobj, rectangleCtorRef);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Build.Tasks/CompiledConverters/ColorTypeConverter.cs b/Xamarin.Forms.Build.Tasks/CompiledConverters/ColorTypeConverter.cs
new file mode 100644
index 00000000..39527954
--- /dev/null
+++ b/Xamarin.Forms.Build.Tasks/CompiledConverters/ColorTypeConverter.cs
@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+using Mono.Cecil;
+using Mono.Cecil.Cil;
+
+using Xamarin.Forms.Xaml;
+
+namespace Xamarin.Forms.Core.XamlC
+{
+ class ColorTypeConverter : ICompiledTypeConverter
+ {
+ public IEnumerable<Instruction> ConvertFromString(string value, ModuleDefinition module, BaseNode node)
+ {
+ do {
+ if (string.IsNullOrEmpty(value))
+ break;
+
+ value = value.Trim();
+
+ if (value.StartsWith("#", StringComparison.Ordinal)) {
+ var color = Color.FromHex(value);
+ yield return Instruction.Create(OpCodes.Ldc_R8, color.R);
+ yield return Instruction.Create(OpCodes.Ldc_R8, color.G);
+ yield return Instruction.Create(OpCodes.Ldc_R8, color.B);
+ yield return Instruction.Create(OpCodes.Ldc_R8, color.A);
+ var colorCtor = module.Import(typeof(Color)).Resolve().Methods.FirstOrDefault(
+ md => md.IsConstructor && md.Parameters.Count == 4 &&
+ md.Parameters.All(p => p.ParameterType.FullName == "System.Double"));
+ var colorCtorRef = module.Import(colorCtor);
+ yield return Instruction.Create(OpCodes.Newobj, colorCtorRef);
+ yield break;
+ }
+ var parts = value.Split('.');
+ if (parts.Length == 1 || (parts.Length == 2 && parts [0] == "Color")) {
+ var color = parts [parts.Length - 1];
+
+ var field = module.Import(typeof(Color)).Resolve().Fields.SingleOrDefault(fd => fd.Name == color && fd.IsStatic);
+ if (field != null) {
+ yield return Instruction.Create(OpCodes.Ldsfld, module.Import(field));
+ yield break;
+ }
+ var propertyGetter = module.Import(typeof(Color)).Resolve().Properties.SingleOrDefault(pd => pd.Name == color && pd.GetMethod.IsStatic)?.GetMethod;
+ if (propertyGetter != null) {
+ yield return Instruction.Create(OpCodes.Call, module.Import(propertyGetter));
+ yield break;
+ }
+ }
+ } while (false);
+
+ throw new XamlParseException($"Cannot convert \"{value}\" into {typeof(Color)}", node);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Build.Tasks/CompiledConverters/ICompiledTypeConverter.cs b/Xamarin.Forms.Build.Tasks/CompiledConverters/ICompiledTypeConverter.cs
new file mode 100644
index 00000000..5ed88d0a
--- /dev/null
+++ b/Xamarin.Forms.Build.Tasks/CompiledConverters/ICompiledTypeConverter.cs
@@ -0,0 +1,12 @@
+using System.Collections.Generic;
+using Mono.Cecil.Cil;
+using Mono.Cecil;
+using System.Xml;
+
+namespace Xamarin.Forms.Xaml
+{
+ interface ICompiledTypeConverter
+ {
+ IEnumerable<Instruction> ConvertFromString(string value, ModuleDefinition module, BaseNode node);
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Build.Tasks/CompiledConverters/LayoutOptionsConverter.cs b/Xamarin.Forms.Build.Tasks/CompiledConverters/LayoutOptionsConverter.cs
new file mode 100644
index 00000000..e252ed9d
--- /dev/null
+++ b/Xamarin.Forms.Build.Tasks/CompiledConverters/LayoutOptionsConverter.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+using Mono.Cecil;
+using Mono.Cecil.Cil;
+
+using Xamarin.Forms.Xaml;
+
+namespace Xamarin.Forms.Core.XamlC
+{
+ class LayoutOptionsConverter : ICompiledTypeConverter
+ {
+ public IEnumerable<Instruction> ConvertFromString(string value, ModuleDefinition module, BaseNode node)
+ {
+ do {
+ if (string.IsNullOrEmpty(value))
+ break;
+
+ value = value.Trim();
+
+ var parts = value.Split('.');
+ if (parts.Length == 1 || (parts.Length == 2 && parts [0] == "LayoutOptions")) {
+ var options = parts [parts.Length - 1];
+
+ var field = module.Import(typeof(LayoutOptions)).Resolve().Fields.SingleOrDefault(fd => fd.Name == options && fd.IsStatic);
+ if (field != null) {
+ yield return Instruction.Create(OpCodes.Ldsfld, module.Import(field));
+ yield break;
+ }
+ }
+ } while (false);
+
+ throw new XamlParseException(String.Format("Cannot convert \"{0}\" into {1}", value, typeof(LayoutOptions)), node);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Build.Tasks/CompiledConverters/RectangleTypeConverter.cs b/Xamarin.Forms.Build.Tasks/CompiledConverters/RectangleTypeConverter.cs
new file mode 100644
index 00000000..af480667
--- /dev/null
+++ b/Xamarin.Forms.Build.Tasks/CompiledConverters/RectangleTypeConverter.cs
@@ -0,0 +1,49 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+
+using Mono.Cecil;
+using Mono.Cecil.Cil;
+
+using Xamarin.Forms.Xaml;
+
+namespace Xamarin.Forms.Core.XamlC
+{
+ class RectangleTypeConverter : ICompiledTypeConverter
+ {
+ public IEnumerable<Instruction> ConvertFromString(string value, ModuleDefinition module, BaseNode node)
+ {
+ if (string.IsNullOrEmpty(value))
+ throw new XamlParseException($"Cannot convert \"{value}\" into {typeof(Rectangle)}", node);
+ double x, y, w, h;
+ var xywh = value.Split(',');
+ if (xywh.Length != 4 ||
+ !double.TryParse(xywh [0], NumberStyles.Number, CultureInfo.InvariantCulture, out x) ||
+ !double.TryParse(xywh [1], NumberStyles.Number, CultureInfo.InvariantCulture, out y) ||
+ !double.TryParse(xywh [2], NumberStyles.Number, CultureInfo.InvariantCulture, out w) ||
+ !double.TryParse(xywh [3], NumberStyles.Number, CultureInfo.InvariantCulture, out h))
+ throw new XamlParseException($"Cannot convert \"{value}\" into {typeof(Rectangle)}", node);
+
+ return GenerateIL(x, y, w, h, module);
+ }
+
+ IEnumerable<Instruction> GenerateIL(double x, double y, double w, double h, ModuleDefinition module)
+ {
+// IL_0000: ldc.r8 3.1000000000000001
+// IL_0009: ldc.r8 4.2000000000000002
+// IL_0012: ldc.r8 5.2999999999999998
+// IL_001b: ldc.r8 6.4000000000000004
+// IL_0024: newobj instance void valuetype Test.Rectangle::'.ctor'(float64, float64, float64, float64)
+
+ yield return Instruction.Create(OpCodes.Ldc_R8, x);
+ yield return Instruction.Create(OpCodes.Ldc_R8, y);
+ yield return Instruction.Create(OpCodes.Ldc_R8, w);
+ yield return Instruction.Create(OpCodes.Ldc_R8, h);
+
+ var rectangleCtor = module.Import(typeof(Rectangle)).Resolve().Methods.FirstOrDefault(md => md.IsConstructor && md.Parameters.Count == 4);
+ var rectangleCtorRef = module.Import(rectangleCtor);
+ yield return Instruction.Create(OpCodes.Newobj, rectangleCtorRef);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Build.Tasks/CompiledMarkupExtensions/StaticExtension.cs b/Xamarin.Forms.Build.Tasks/CompiledMarkupExtensions/StaticExtension.cs
index 82654969..14797c53 100644
--- a/Xamarin.Forms.Build.Tasks/CompiledMarkupExtensions/StaticExtension.cs
+++ b/Xamarin.Forms.Build.Tasks/CompiledMarkupExtensions/StaticExtension.cs
@@ -32,16 +32,52 @@ namespace Xamarin.Forms.Build.Tasks
var propertyDef = GetPropertyDefinition(typeRef, membername, module);
if (fieldRef == null && propertyDef == null)
- throw new XamlParseException(Format("x:Static: unable to find a public static field or property named {0} in {1}", membername, typename), node as IXmlLineInfo);
+ throw new XamlParseException($"x:Static: unable to find a public static field, static property, const or enum value named {membername} in {typename}", node as IXmlLineInfo);
+ var fieldDef = fieldRef?.Resolve();
if (fieldRef != null) {
memberRef = fieldRef.FieldType;
- return new [] { Instruction.Create(OpCodes.Ldsfld, fieldRef) };
+ if (!fieldDef.HasConstant)
+ return new [] { Instruction.Create(OpCodes.Ldsfld, fieldRef) };
+
+ //Constants can be numbers, Boolean values, strings, or a null reference. (https://msdn.microsoft.com/en-us/library/e6w8fe1b.aspx)
+ if (memberRef == module.TypeSystem.Boolean)
+ return new [] { Instruction.Create(((bool)fieldDef.Constant) ? OpCodes.Ldc_I4_1 : OpCodes.Ldc_I4_0) };
+ if (memberRef == module.TypeSystem.String)
+ return new [] { Instruction.Create(OpCodes.Ldstr, (string)fieldDef.Constant) };
+ if (fieldDef.Constant == null)
+ return new [] { Instruction.Create(OpCodes.Ldnull) };
+ if (memberRef == module.TypeSystem.Char)
+ return new [] { Instruction.Create(OpCodes.Ldc_I4, (char)fieldDef.Constant) };
+ if (memberRef == module.TypeSystem.Single)
+ return new [] { Instruction.Create(OpCodes.Ldc_R4, (float)fieldDef.Constant) };
+ if (memberRef == module.TypeSystem.Double)
+ return new [] { Instruction.Create(OpCodes.Ldc_R8, (double)fieldDef.Constant) };
+ if (memberRef == module.TypeSystem.Byte || memberRef == module.TypeSystem.Int16 || memberRef == module.TypeSystem.Int32)
+ return new [] { Instruction.Create(OpCodes.Ldc_I4, (int)fieldDef.Constant) };
+ if (memberRef == module.TypeSystem.SByte || memberRef == module.TypeSystem.UInt16 || memberRef == module.TypeSystem.UInt32)
+ return new [] { Instruction.Create(OpCodes.Ldc_I4, (uint)fieldDef.Constant) };
+ if (memberRef == module.TypeSystem.Int64)
+ return new [] { Instruction.Create(OpCodes.Ldc_I8, (long)fieldDef.Constant) };
+ if (memberRef == module.TypeSystem.UInt64)
+ return new [] { Instruction.Create(OpCodes.Ldc_I8, (ulong)fieldDef.Constant) };
+
+ //enum values
+ if (memberRef.Resolve().IsEnum) {
+ if (fieldDef.Constant is long)
+ return new [] { Instruction.Create(OpCodes.Ldc_I8, (long)fieldDef.Constant) };
+ if (fieldDef.Constant is ulong)
+ return new [] { Instruction.Create(OpCodes.Ldc_I8, (ulong)fieldDef.Constant) };
+ if (fieldDef.Constant is uint)
+ return new [] { Instruction.Create(OpCodes.Ldc_I4, (uint)fieldDef.Constant) };
+ //everything else will cast just fine to an int
+ return new [] { Instruction.Create(OpCodes.Ldc_I4, (int)fieldDef.Constant) };
+ }
}
memberRef = propertyDef.PropertyType;
var getterDef = propertyDef.GetMethod;
- return new [] { Instruction.Create(OpCodes.Call, getterDef)};
+ return new [] { Instruction.Create(OpCodes.Call, getterDef) };
}
@@ -49,7 +85,7 @@ namespace Xamarin.Forms.Build.Tasks
{
var split = xmlType.Split(':');
if (split.Length > 2)
- throw new Xaml.XamlParseException(string.Format("Type \"{0}\" is invalid", xmlType), node as IXmlLineInfo);
+ throw new XamlParseException($"Type \"{xmlType}\" is invalid", node as IXmlLineInfo);
string prefix, name;
if (split.Length == 2) {
diff --git a/Xamarin.Forms.Build.Tasks/CreateObjectVisitor.cs b/Xamarin.Forms.Build.Tasks/CreateObjectVisitor.cs
index 449b887f..33a9a7f5 100644
--- a/Xamarin.Forms.Build.Tasks/CreateObjectVisitor.cs
+++ b/Xamarin.Forms.Build.Tasks/CreateObjectVisitor.cs
@@ -121,7 +121,7 @@ namespace Xamarin.Forms.Build.Tasks
}
if (parameterizedCtorInfo != null && ValidateCtorArguments(parameterizedCtorInfo, node)) {
ctorInfo = parameterizedCtorInfo;
- // IL_0000: ldstr "foo"
+// IL_0000: ldstr "foo"
Context.IL.Append(PushCtorArguments(parameterizedCtorInfo, node));
}
ctorInfo = ctorInfo ?? typedef.Methods.FirstOrDefault(md => md.IsConstructor && !md.HasParameters && !md.IsStatic);
@@ -198,9 +198,9 @@ namespace Xamarin.Forms.Build.Tasks
type = type.Contains(":") ? type.Split(':') [1].Trim() : type;
Context.TypeExtensions [node] = new XmlType(namespaceuri, type, null).GetTypeReference(Module, node);
- node.Properties.Clear();
- node.CollectionItems.Clear();
-
+ if (!node.SkipProperties.Contains(new XmlName("", "TypeName")))
+ node.SkipProperties.Add(new XmlName("", "TypeName"));
+
var vardefref = new VariableDefinitionReference(vardef);
Context.IL.Append(SetPropertiesVisitor.ProvideValue(vardefref, Context, Module, node));
if (vardef != vardefref.VariableDefinition) {
@@ -213,8 +213,8 @@ namespace Xamarin.Forms.Build.Tasks
public void Visit(RootNode node, INode parentNode)
{
- // IL_0013: ldarg.0
- // IL_0014: stloc.3
+// IL_0013: ldarg.0
+// IL_0014: stloc.3
var ilnode = (ILRootNode)node;
var typeref = ilnode.TypeReference;
@@ -256,7 +256,8 @@ namespace Xamarin.Forms.Build.Tasks
.ConstructorArguments.First()
.Value as string;
var node = enode.Properties[new XmlName("", propname)];
- enode.Properties.Remove(new XmlName("", propname));
+ if (!enode.SkipProperties.Contains(new XmlName("", propname)))
+ enode.SkipProperties.Add(new XmlName("", propname));
VariableDefinition vardef;
ValueNode vnode = null;
diff --git a/Xamarin.Forms.Build.Tasks/ExpandMarkupsVisitor.cs b/Xamarin.Forms.Build.Tasks/ExpandMarkupsVisitor.cs
index feafe214..26e241ab 100644
--- a/Xamarin.Forms.Build.Tasks/ExpandMarkupsVisitor.cs
+++ b/Xamarin.Forms.Build.Tasks/ExpandMarkupsVisitor.cs
@@ -49,6 +49,8 @@ namespace Xamarin.Forms.Build.Tasks
return;
if (skips.Contains(propertyName))
return;
+ if (parentNode is IElementNode && ((IElementNode)parentNode).SkipProperties.Contains (propertyName))
+ return;
var markupString = markupnode.MarkupString;
var node = ParseExpression(ref markupString, Context, markupnode.NamespaceResolver, markupnode) as IElementNode;
if (node != null)
diff --git a/Xamarin.Forms.Build.Tasks/MethodReferenceExtensions.cs b/Xamarin.Forms.Build.Tasks/MethodReferenceExtensions.cs
index 6240a201..3baa230c 100644
--- a/Xamarin.Forms.Build.Tasks/MethodReferenceExtensions.cs
+++ b/Xamarin.Forms.Build.Tasks/MethodReferenceExtensions.cs
@@ -1,6 +1,5 @@
using System;
using Mono.Cecil;
-using Mono.Cecil.Rocks;
namespace Xamarin.Forms.Build.Tasks
{
diff --git a/Xamarin.Forms.Build.Tasks/NodeILExtensions.cs b/Xamarin.Forms.Build.Tasks/NodeILExtensions.cs
index 35016694..a7fed895 100644
--- a/Xamarin.Forms.Build.Tasks/NodeILExtensions.cs
+++ b/Xamarin.Forms.Build.Tasks/NodeILExtensions.cs
@@ -37,10 +37,8 @@ namespace Xamarin.Forms.Build.Tasks
IEnumerable<Instruction> pushServiceProvider, bool boxValueTypes, bool unboxValueTypes)
{
var module = context.Body.Method.Module;
- var targetTypeRef = GetBPReturnType(context, bpRef, node);
-
- TypeReference typeConverter;
- bpRef.HasTypeConverter(module, out typeConverter);
+ var targetTypeRef = bpRef.GetBindablePropertyType(node, module);
+ var typeConverter = bpRef.GetBindablePropertyTypeConverter(module);
return node.PushConvertedValue(context, targetTypeRef, typeConverter, pushServiceProvider, boxValueTypes,
unboxValueTypes);
@@ -53,6 +51,21 @@ namespace Xamarin.Forms.Build.Tasks
var module = context.Body.Method.Module;
var str = (string)node.Value;
+ //If the TypeConverter has a ProvideCompiledAttribute that can be resolved, shortcut this
+ var compiledConverterName = typeConverter?.GetCustomAttribute (module.Import(typeof(ProvideCompiledAttribute)))?.ConstructorArguments?.First().Value as string;
+ Type compiledConverterType;
+ if (compiledConverterName != null && (compiledConverterType = Type.GetType (compiledConverterName)) != null) {
+ var compiledConverter = Activator.CreateInstance (compiledConverterType);
+ var converter = typeof(ICompiledTypeConverter).GetMethods ().FirstOrDefault (md => md.Name == "ConvertFromString");
+ var instructions = (IEnumerable<Instruction>)converter.Invoke (compiledConverter, new object[] {
+ node.Value as string, context.Body.Method.Module, node as BaseNode});
+ foreach (var i in instructions)
+ yield return i;
+ if (targetTypeRef.IsValueType && boxValueTypes)
+ yield return Instruction.Create (OpCodes.Box, module.Import (targetTypeRef));
+ yield break;
+ }
+
//If there's a [TypeConverter], use it
if (typeConverter != null)
{
@@ -186,101 +199,6 @@ namespace Xamarin.Forms.Build.Tasks
throw new XamlParseException(string.Format("Enum value not found for {0}", value), lineInfo);
}
- static bool HasTypeConverter(this FieldReference bpRef, ModuleDefinition module,
- out TypeReference typeConverterReference)
- {
- typeConverterReference = null;
-
- var declaringType = bpRef.DeclaringType;
- var bpName = bpRef.Name;
- var pName = bpName.EndsWith("Property", StringComparison.Ordinal) ? bpName.Substring(0, bpName.Length - 8) : bpName;
- var property = declaringType.Resolve().Properties.FirstOrDefault(p => p.Name == pName);
- CustomAttribute attr = null;
-
- if (property != null)
- {
- if (property.HasCustomAttributes)
- {
- attr =
- property.CustomAttributes.FirstOrDefault(
- cad => TypeConverterAttribute.TypeConvertersType.Contains(cad.AttributeType.FullName));
- }
- if (attr == null && property.PropertyType.Resolve().HasCustomAttributes)
- {
- attr =
- property.PropertyType.Resolve()
- .CustomAttributes.FirstOrDefault(
- cad => TypeConverterAttribute.TypeConvertersType.Contains(cad.AttributeType.FullName));
- }
-
- if (attr == null)
- return false;
-
- typeConverterReference = attr.ConstructorArguments[0].Value as TypeReference;
- return true;
- }
-
- var getters = bpRef.DeclaringType.GetMethods(md => md.Name == "Get" + pName &&
- md.IsStatic &&
- md.Parameters.Count() == 1 &&
- md.Parameters[0].ParameterType.FullName == "Xamarin.Forms.BindableObject", module).SingleOrDefault();
- if (getters != null)
- {
- if (getters.Item1.HasCustomAttributes)
- {
- attr =
- getters.Item1.CustomAttributes.FirstOrDefault(
- cad => TypeConverterAttribute.TypeConvertersType.Contains(cad.AttributeType.FullName));
- }
- else if (getters.Item1.ReturnType.Resolve().HasCustomAttributes)
- {
- attr =
- getters.Item1.ReturnType.Resolve()
- .CustomAttributes.FirstOrDefault(
- cad => TypeConverterAttribute.TypeConvertersType.Contains(cad.AttributeType.FullName));
- }
-
- if (attr == null)
- return false;
-
- typeConverterReference = attr.ConstructorArguments[0].Value as TypeReference;
- return true;
- }
-
- return false;
- }
-
- static TypeReference GetBPReturnType(ILContext context, FieldReference bpRef, IXmlLineInfo lineInfo)
- {
- //Find a property with a matching name
- var name = bpRef.Name;
- if (!name.EndsWith("Property", StringComparison.Ordinal))
- return context.Body.Method.Module.TypeSystem.Object;
- name = name.Substring(0, name.Length - 8);
-
- //First, check for a property
- TypeReference declaringTypeRef;
- var property = bpRef.DeclaringType.GetProperty(pd => pd.Name == name, out declaringTypeRef);
- if (property != null)
- return property.PropertyType;
-
- //Then check for getter or setter (attached BPs)
- var getters =
- bpRef.DeclaringType.GetMethods(md => md.Name == "Get" + name &&
- md.IsStatic &&
- md.Parameters.Count() == 1 &&
- md.Parameters [0].ParameterType.FullName == "Xamarin.Forms.BindableObject", context.Body.Method.Module)
- .SingleOrDefault();
- if (getters != null)
- return getters.Item1.ReturnType;
-
- //throws
- throw new XamlParseException(
- string.Format(
- "Can not find a Property named \"{0}\" or a static method named \"Get{0}\" for BindableProperty \"{1}\"", name,
- bpRef.Name), lineInfo);
- }
-
public static IEnumerable<Instruction> PushXmlLineInfo(this INode node, ILContext context)
{
var module = context.Body.Method.Module;
@@ -389,14 +307,37 @@ namespace Xamarin.Forms.Build.Tasks
}
}
- public static IEnumerable<Instruction> PushServiceProvider(this INode node, ILContext context)
+ static IEnumerable<Instruction> PushTargetProperty(FieldReference bpRef, PropertyReference propertyRef, TypeReference declaringTypeReference, ModuleDefinition module)
+ {
+ if (bpRef != null) {
+ yield return Instruction.Create(OpCodes.Ldsfld, bpRef);
+ yield break;
+ }
+ if (propertyRef != null) {
+// IL_0000: ldtoken [mscorlib]System.String
+// IL_0005: call class [mscorlib]System.Type class [mscorlib] System.Type::GetTypeFromHandle(valuetype [mscorlib] System.RuntimeTypeHandle)
+// IL_000a: ldstr "Foo"
+// IL_000f: callvirt instance class [mscorlib] System.Reflection.PropertyInfo class [mscorlib] System.Type::GetProperty(string)
+ var getTypeFromHandle = module.Import(typeof(Type).GetMethod("GetTypeFromHandle", new [] { typeof(RuntimeTypeHandle) }));
+ var getPropertyInfo = module.Import(typeof(Type).GetMethod("GetProperty", new [] { typeof(string) }));
+ yield return Instruction.Create(OpCodes.Ldtoken, module.Import(declaringTypeReference ?? propertyRef.DeclaringType));
+ yield return Instruction.Create(OpCodes.Call, module.Import(getTypeFromHandle));
+ yield return Instruction.Create(OpCodes.Ldstr, propertyRef.Name);
+ yield return Instruction.Create(OpCodes.Callvirt, module.Import(getPropertyInfo));
+ yield break;
+ }
+ yield return Instruction.Create(OpCodes.Ldnull);
+ yield break;
+ }
+
+ public static IEnumerable<Instruction> PushServiceProvider(this INode node, ILContext context, FieldReference bpRef = null, PropertyReference propertyRef = null, TypeReference declaringTypeReference = null)
{
var module = context.Body.Method.Module;
#if NOSERVICEPROVIDER
yield return Instruction.Create (OpCodes.Ldnull);
yield break;
- #endif
+#endif
var ctorinfo = typeof (XamlServiceProvider).GetConstructor(new Type[] { });
var ctor = module.Import(ctorinfo);
@@ -421,8 +362,11 @@ namespace Xamarin.Forms.Build.Tasks
foreach (var instruction in pushParentIl)
yield return instruction;
+ foreach (var instruction in PushTargetProperty(bpRef, propertyRef, declaringTypeReference, module))
+ yield return instruction;
+
var targetProviderCtor =
- module.Import(typeof (SimpleValueTargetProvider).GetConstructor(new[] { typeof (object[]) }));
+ module.Import(typeof (SimpleValueTargetProvider).GetConstructor(new[] { typeof (object[]), typeof(object) }));
yield return Instruction.Create(OpCodes.Newobj, targetProviderCtor);
yield return Instruction.Create(OpCodes.Callvirt, addService);
}
diff --git a/Xamarin.Forms.Build.Tasks/Properties/AssemblyInfo.cs b/Xamarin.Forms.Build.Tasks/Properties/AssemblyInfo.cs
index d2220667..ea4bda34 100644
--- a/Xamarin.Forms.Build.Tasks/Properties/AssemblyInfo.cs
+++ b/Xamarin.Forms.Build.Tasks/Properties/AssemblyInfo.cs
@@ -26,7 +26,5 @@ using System.Runtime.CompilerServices;
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
-/* ===== InternalsVisibleTo() has been moved to Xamarin.Forms.Core/Properties/ExposeInternalsToXamarin.cs file
[assembly: InternalsVisibleTo("xamlg")]
-[assembly: InternalsVisibleTo("Xamarin.Forms.Xaml.UnitTests")]
-*/ \ No newline at end of file
+[assembly: InternalsVisibleTo("Xamarin.Forms.Xaml.UnitTests")] \ No newline at end of file
diff --git a/Xamarin.Forms.Build.Tasks/PropertyDefinitionExtensions.cs b/Xamarin.Forms.Build.Tasks/PropertyDefinitionExtensions.cs
index 472a5658..7a56c9d1 100644
--- a/Xamarin.Forms.Build.Tasks/PropertyDefinitionExtensions.cs
+++ b/Xamarin.Forms.Build.Tasks/PropertyDefinitionExtensions.cs
@@ -1,32 +1,14 @@
+using System;
using Mono.Cecil;
namespace Xamarin.Forms.Build.Tasks
{
static class PropertyDefinitionExtensions
{
- // public static PropertyDefinition MakeGeneric (this PropertyDefinition self, GenericInstanceType declaringTypeReference)
- // {
- // if (declaringTypeReference == null)
- // throw new ArgumentNullException ("declaringTypeReference");
- // if (self == null)
- // throw new ArgumentNullException ("self");
- //
- // var propertyType = declaringTypeReference.GenericArguments[((GenericParameter)self.PropertyType).Position];
- // self.PropertyType = propertyType;
- // self.SetMethod = self.SetMethod.MakeGeneric (propertyType).Resolve ();
- // self.GetMethod.ReturnType = propertyType;
- //
- // return self;
- // }
-
- public static TypeReference ResolveGenericPropertyType(this PropertyDefinition self,
- TypeReference declaringTypeReference)
+ public static TypeReference ResolveGenericPropertyType(this PropertyDefinition self, TypeReference declaringTypeReference)
{
if (self.PropertyType.IsGenericParameter)
- {
- return
- ((GenericInstanceType)declaringTypeReference).GenericArguments[((GenericParameter)self.PropertyType).Position];
- }
+ return ((GenericInstanceType)declaringTypeReference).GenericArguments [((GenericParameter)self.PropertyType).Position];
return self.PropertyType;
}
}
diff --git a/Xamarin.Forms.Build.Tasks/SetPropertiesVisitor.cs b/Xamarin.Forms.Build.Tasks/SetPropertiesVisitor.cs
index 5e11fe1d..f481cbee 100644
--- a/Xamarin.Forms.Build.Tasks/SetPropertiesVisitor.cs
+++ b/Xamarin.Forms.Build.Tasks/SetPropertiesVisitor.cs
@@ -3,9 +3,11 @@ using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Xml;
+
using Mono.Cecil;
using Mono.Cecil.Cil;
using Mono.Cecil.Rocks;
+
using Xamarin.Forms.Internals;
using Xamarin.Forms.Xaml;
@@ -15,7 +17,7 @@ namespace Xamarin.Forms.Build.Tasks
{
static int dtcount;
- readonly IList<XmlName> skips = new List<XmlName>
+ static readonly IList<XmlName> skips = new List<XmlName>
{
XmlName.xKey,
XmlName.xTypeArguments,
@@ -32,21 +34,12 @@ namespace Xamarin.Forms.Build.Tasks
}
public ILContext Context { get; }
+ public bool StopOnResourceDictionary { get; }
+ public bool VisitChildrenFirst { get; } = true;
+ public bool StopOnDataTemplate { get; } = true;
ModuleDefinition Module { get; }
- public bool VisitChildrenFirst
- {
- get { return true; }
- }
-
- public bool StopOnDataTemplate
- {
- get { return true; }
- }
-
- public bool StopOnResourceDictionary { get; }
-
public void Visit(ValueNode node, INode parentNode)
{
//TODO support Label text as element
@@ -67,10 +60,12 @@ namespace Xamarin.Forms.Build.Tasks
if (skips.Contains(propertyName))
return;
+ if (parentNode is IElementNode && ((IElementNode)parentNode).SkipProperties.Contains (propertyName))
+ return;
if (propertyName.NamespaceURI == "http://schemas.openxmlformats.org/markup-compatibility/2006" &&
propertyName.LocalName == "Ignorable")
return;
- SetPropertyValue(Context.Variables[(IElementNode)parentNode], propertyName, node, Context, node);
+ Context.IL.Append(SetPropertyValue(Context.Variables [(IElementNode)parentNode], propertyName, node, Context, node));
}
public void Visit(MarkupNode node, INode parentNode)
@@ -88,10 +83,21 @@ namespace Xamarin.Forms.Build.Tasks
parentNode = parentNode.Parent;
}
+ if ((propertyName != XmlName.Empty || TryGetPropertyName(node, parentNode, out propertyName)) && skips.Contains(propertyName))
+ return;
+
//if this node is an IMarkupExtension, invoke ProvideValue() and replace the variable
var vardef = Context.Variables[node];
var vardefref = new VariableDefinitionReference(vardef);
- Context.IL.Append(ProvideValue(vardefref, Context, Module, node));
+ var localName = propertyName.LocalName;
+ TypeReference declaringTypeReference = null;
+ FieldReference bpRef = null;
+ PropertyDefinition propertyRef = null;
+ if (parentNode is IElementNode && propertyName != XmlName.Empty) {
+ bpRef = GetBindablePropertyReference(Context.Variables [(IElementNode)parentNode], propertyName.NamespaceURI, ref localName, Context, node);
+ propertyRef = Context.Variables [(IElementNode)parentNode].VariableType.GetProperty(pd => pd.Name == localName, out declaringTypeReference);
+ }
+ Context.IL.Append(ProvideValue(vardefref, Context, Module, node, bpRef:bpRef, propertyRef:propertyRef, propertyDeclaringTypeRef: declaringTypeReference));
if (vardef != vardefref.VariableDefinition)
{
vardef = vardefref.VariableDefinition;
@@ -99,15 +105,17 @@ namespace Xamarin.Forms.Build.Tasks
Context.Variables[node] = vardef;
}
- if (propertyName != XmlName.Empty || TryGetPropertyName(node, parentNode, out propertyName))
+ if (propertyName != XmlName.Empty)
{
if (skips.Contains(propertyName))
return;
+ if (parentNode is IElementNode && ((IElementNode)parentNode).SkipProperties.Contains (propertyName))
+ return;
if (propertyName == XmlName._CreateContent)
SetDataTemplate((IElementNode)parentNode, node, Context, node);
else
- SetPropertyValue(Context.Variables[(IElementNode)parentNode], propertyName, node, Context, node);
+ Context.IL.Append(SetPropertyValue(Context.Variables[(IElementNode)parentNode], propertyName, node, Context, node));
}
else if (IsCollectionItem(node, parentNode) && parentNode is IElementNode)
{
@@ -135,7 +143,9 @@ namespace Xamarin.Forms.Build.Tasks
var name = new XmlName(node.NamespaceURI, contentProperty);
if (skips.Contains(name))
return;
- SetPropertyValue(Context.Variables[(IElementNode)parentNode], name, node, Context, node);
+ if (parentNode is IElementNode && ((IElementNode)parentNode).SkipProperties.Contains (propertyName))
+ return;
+ Context.IL.Append(SetPropertyValue(Context.Variables[(IElementNode)parentNode], name, node, Context, node));
}
}
else if (IsCollectionItem(node, parentNode) && parentNode is ListNode)
@@ -150,7 +160,8 @@ namespace Xamarin.Forms.Build.Tasks
if (skips.Contains(parentList.XmlName))
return;
-
+ if (parentNode is IElementNode && ((IElementNode)parentNode).SkipProperties.Contains (propertyName))
+ return;
var elementType = parent.VariableType;
var localname = parentList.XmlName.LocalName;
@@ -176,7 +187,9 @@ namespace Xamarin.Forms.Build.Tasks
Context.IL.Emit(OpCodes.Callvirt, adderRef);
if (adderRef.ReturnType.FullName != "System.Void")
Context.IL.Emit(OpCodes.Pop);
- }
+ } else
+ throw new XamlParseException(string.Format("Property {0} not found", localname), node);
+
}
}
@@ -226,7 +239,7 @@ namespace Xamarin.Forms.Build.Tasks
}
public static IEnumerable<Instruction> ProvideValue(VariableDefinitionReference vardefref, ILContext context,
- ModuleDefinition module, ElementNode node)
+ ModuleDefinition module, ElementNode node, FieldReference bpRef = null, PropertyReference propertyRef = null, TypeReference propertyDeclaringTypeRef = null)
{
GenericInstanceType markupExtension;
IList<TypeReference> genericArguments;
@@ -247,7 +260,7 @@ namespace Xamarin.Forms.Build.Tasks
else
vardefref.VariableDefinition = new VariableDefinition(module.Import(genericArguments.First()));
yield return Instruction.Create(OpCodes.Ldloc, context.Variables[node]);
- foreach (var instruction in node.PushServiceProvider(context))
+ foreach (var instruction in node.PushServiceProvider(context, bpRef, propertyRef, propertyDeclaringTypeRef))
yield return instruction;
yield return Instruction.Create(OpCodes.Callvirt, provideValue);
@@ -266,7 +279,7 @@ namespace Xamarin.Forms.Build.Tasks
vardefref.VariableDefinition = new VariableDefinition(module.Import(genericArguments.First()));
yield return Instruction.Create(OpCodes.Ldloc, context.Variables[node]);
- foreach (var instruction in node.PushServiceProvider(context))
+ foreach (var instruction in node.PushServiceProvider(context, bpRef, propertyRef, propertyDeclaringTypeRef))
yield return instruction;
yield return Instruction.Create(OpCodes.Callvirt, provideValue);
yield return Instruction.Create(OpCodes.Stloc, vardefref.VariableDefinition);
@@ -279,7 +292,7 @@ namespace Xamarin.Forms.Build.Tasks
vardefref.VariableDefinition = new VariableDefinition(module.TypeSystem.Object);
yield return Instruction.Create(OpCodes.Ldloc, context.Variables[node]);
- foreach (var instruction in node.PushServiceProvider(context))
+ foreach (var instruction in node.PushServiceProvider(context, bpRef, propertyRef, propertyDeclaringTypeRef))
yield return instruction;
yield return Instruction.Create(OpCodes.Callvirt, provideValue);
yield return Instruction.Create(OpCodes.Stloc, vardefref.VariableDefinition);
@@ -292,262 +305,351 @@ namespace Xamarin.Forms.Build.Tasks
vardefref.VariableDefinition = new VariableDefinition(module.TypeSystem.Object);
yield return Instruction.Create(OpCodes.Ldloc, context.Variables[node]);
- foreach (var instruction in node.PushServiceProvider(context))
+ foreach (var instruction in node.PushServiceProvider(context, bpRef, propertyRef, propertyDeclaringTypeRef))
yield return instruction;
yield return Instruction.Create(OpCodes.Callvirt, provideValue);
yield return Instruction.Create(OpCodes.Stloc, vardefref.VariableDefinition);
}
}
- public static void SetPropertyValue(VariableDefinition parent, XmlName propertyName, INode valueNode,
- ILContext context, IXmlLineInfo iXmlLineInfo)
+ public static IEnumerable<Instruction> SetPropertyValue(VariableDefinition parent, XmlName propertyName, INode valueNode, ILContext context, IXmlLineInfo iXmlLineInfo)
{
- var elementType = parent.VariableType;
+ var module = context.Body.Method.Module;
var localName = propertyName.LocalName;
+ var bpRef = GetBindablePropertyReference(parent, propertyName.NamespaceURI, ref localName, context, iXmlLineInfo);
+
+ //If the target is an event, connect
+ if (CanConnectEvent(parent, localName))
+ return ConnectEvent(parent, localName, valueNode, iXmlLineInfo, context);
+
+ //If Value is DynamicResource, SetDynamicResource
+ if (CanSetDynamicResource(bpRef, valueNode, context))
+ return SetDynamicResource(parent, bpRef, valueNode as IElementNode, iXmlLineInfo, context);
+
+ //If Value is a BindingBase and target is a BP, SetBinding
+ if (CanSetBinding(bpRef, valueNode, context))
+ return SetBinding(parent, bpRef, valueNode as IElementNode, iXmlLineInfo, context);
+
+ //If it's a BP, SetValue ()
+ if (CanSetValue(bpRef, valueNode, iXmlLineInfo, context))
+ return SetValue(parent, bpRef, valueNode, iXmlLineInfo, context);
+
+ //If it's a property, set it
+ if (CanSet(parent, localName, valueNode, context))
+ return Set(parent, localName, valueNode, iXmlLineInfo, context);
+
+ //If it's an already initialized property, add to it
+ if (CanAdd(parent, localName, valueNode, context))
+ return Add(parent, localName, valueNode, iXmlLineInfo, context);
+
+ throw new XamlParseException($"No property, bindable property, or event found for '{localName}'", iXmlLineInfo);
+ }
+
+ static FieldReference GetBindablePropertyReference(VariableDefinition parent, string namespaceURI, ref string localName, ILContext context, IXmlLineInfo iXmlLineInfo)
+ {
var module = context.Body.Method.Module;
- var br = Instruction.Create(OpCodes.Nop);
TypeReference declaringTypeReference;
- var handled = false;
//If it's an attached BP, update elementType and propertyName
- GetNameAndTypeRef(ref elementType, propertyName.NamespaceURI, ref localName, context, iXmlLineInfo);
+ var bpOwnerType = parent.VariableType;
+ GetNameAndTypeRef(ref bpOwnerType, namespaceURI, ref localName, context, iXmlLineInfo);
+ var name = $"{localName}Property";
+ FieldReference bpRef = bpOwnerType.GetField(fd => fd.Name == name &&
+ fd.IsStatic &&
+ fd.IsPublic, out declaringTypeReference);
+ if (bpRef != null) {
+ bpRef = module.Import(bpRef.ResolveGenericParameters(declaringTypeReference));
+ bpRef.FieldType = module.Import(bpRef.FieldType);
+ }
+ return bpRef;
+ }
+
+ static bool CanConnectEvent(VariableDefinition parent, string localName)
+ {
+ return parent.VariableType.GetEvent(ed => ed.Name == localName) != null;
+ }
+
+ static IEnumerable<Instruction> ConnectEvent(VariableDefinition parent, string localName, INode valueNode, IXmlLineInfo iXmlLineInfo, ILContext context)
+ {
+ var elementType = parent.VariableType;
+ var module = context.Body.Method.Module;
+ var eventinfo = elementType.GetEvent(ed => ed.Name == localName);
- //If the target is an event, connect
// IL_0007: ldloc.0
// IL_0008: ldarg.0
//
// IL_0009: ldftn instance void class Xamarin.Forms.Xaml.XamlcTests.MyPage::OnButtonClicked(object, class [mscorlib]System.EventArgs)
- //OR, if the handler is virtual
+//OR, if the handler is virtual
// IL_000x: ldarg.0
// IL_0009: ldvirtftn instance void class Xamarin.Forms.Xaml.XamlcTests.MyPage::OnButtonClicked(object, class [mscorlib]System.EventArgs)
//
// IL_000f: newobj instance void class [mscorlib]System.EventHandler::'.ctor'(object, native int)
// IL_0014: callvirt instance void class [Xamarin.Forms.Core]Xamarin.Forms.Button::add_Clicked(class [mscorlib]System.EventHandler)
- var eventinfo = elementType.GetEvent(ed => ed.Name == localName);
- if (eventinfo != null)
- {
- var value = ((ValueNode)valueNode).Value;
+ var value = ((ValueNode)valueNode).Value;
- context.IL.Emit(OpCodes.Ldloc, parent);
- if (context.Root is VariableDefinition)
- context.IL.Emit(OpCodes.Ldloc, context.Root as VariableDefinition);
- else if (context.Root is FieldDefinition)
- {
- context.IL.Emit(OpCodes.Ldarg_0);
- context.IL.Emit(OpCodes.Ldfld, context.Root as FieldDefinition);
- }
- else
- throw new InvalidProgramException();
- var declaringType = context.Body.Method.DeclaringType;
- if (declaringType.IsNested)
- declaringType = declaringType.DeclaringType;
- var handler = declaringType.AllMethods().FirstOrDefault(md => md.Name == value as string);
- if (handler == null)
- {
- throw new XamlParseException(
- string.Format("EventHandler \"{0}\" not found in type \"{1}\"", value, context.Body.Method.DeclaringType.FullName),
- iXmlLineInfo);
- }
- if (handler.IsVirtual)
- {
- context.IL.Emit(OpCodes.Ldarg_0);
- context.IL.Emit(OpCodes.Ldvirtftn, handler);
- }
- else
- context.IL.Emit(OpCodes.Ldftn, handler);
+ yield return Instruction.Create(OpCodes.Ldloc, parent);
+ if (context.Root is VariableDefinition)
+ yield return Instruction.Create(OpCodes.Ldloc, context.Root as VariableDefinition);
+ else if (context.Root is FieldDefinition) {
+ yield return Instruction.Create(OpCodes.Ldarg_0);
+ yield return Instruction.Create(OpCodes.Ldfld, context.Root as FieldDefinition);
+ } else
+ throw new InvalidProgramException();
+ var declaringType = context.Body.Method.DeclaringType;
+ while (declaringType.IsNested)
+ declaringType = declaringType.DeclaringType;
+ var handler = declaringType.AllMethods().FirstOrDefault(md => md.Name == value as string);
+ if (handler == null)
+ throw new XamlParseException($"EventHandler \"{value}\" not found in type \"{context.Body.Method.DeclaringType.FullName}\"", iXmlLineInfo);
+ if (handler.IsVirtual) {
+ yield return Instruction.Create(OpCodes.Ldarg_0);
+ yield return Instruction.Create(OpCodes.Ldvirtftn, handler);
+ } else
+ yield return Instruction.Create(OpCodes.Ldftn, handler);
+
+ //FIXME: eventually get the right ctor instead fo the First() one, just in case another one could exists (not even sure it's possible).
+ var ctor = module.Import(eventinfo.EventType.Resolve().GetConstructors().First());
+ ctor = ctor.ResolveGenericParameters(eventinfo.EventType, module);
+ yield return Instruction.Create(OpCodes.Newobj, module.Import(ctor));
+ yield return Instruction.Create(OpCodes.Callvirt, module.Import(eventinfo.AddMethod));
+ }
- //FIXME: eventually get the right ctor instead fo the First() one, just in case another one could exists (not even sure it's possible).
- var ctor = module.Import(eventinfo.EventType.Resolve().GetConstructors().First());
- ctor = ctor.ResolveGenericParameters(eventinfo.EventType, module);
- context.IL.Emit(OpCodes.Newobj, module.Import(ctor));
- context.IL.Emit(OpCodes.Callvirt, module.Import(eventinfo.AddMethod));
- return;
- }
+ static bool CanSetDynamicResource(FieldReference bpRef, INode valueNode, ILContext context)
+ {
+ if (bpRef == null)
+ return false;
+ var elementNode = valueNode as IElementNode;
+ if (elementNode == null)
+ return false;
+
+ VariableDefinition varValue;
+ if (!context.Variables.TryGetValue(valueNode as IElementNode, out varValue))
+ return false;
+ return varValue.VariableType.FullName == typeof(DynamicResource).FullName;
+ }
- FieldReference bpRef = elementType.GetField(fd => fd.Name == localName + "Property" && fd.IsStatic && fd.IsPublic,
- out declaringTypeReference);
- if (bpRef != null)
- {
- bpRef = module.Import(bpRef.ResolveGenericParameters(declaringTypeReference));
- bpRef.FieldType = module.Import(bpRef.FieldType);
- }
+ static IEnumerable<Instruction> SetDynamicResource(VariableDefinition parent, FieldReference bpRef, IElementNode elementNode, IXmlLineInfo iXmlLineInfo, ILContext context)
+ {
+ var module = context.Body.Method.Module;
+ var varValue = context.Variables [elementNode];
+ var setDynamicResource = module.Import(typeof(IDynamicResourceHandler)).Resolve().Methods.First(m => m.Name == "SetDynamicResource");
+ var getKey = typeof(DynamicResource).GetProperty("Key").GetMethod;
+
+ yield return Instruction.Create(OpCodes.Ldloc, parent);
+ yield return Instruction.Create(OpCodes.Ldsfld, bpRef);
+ yield return Instruction.Create(OpCodes.Ldloc, varValue);
+ yield return Instruction.Create(OpCodes.Callvirt, module.Import(getKey));
+ yield return Instruction.Create(OpCodes.Callvirt, module.Import(setDynamicResource));
+ }
+
+ static bool CanSetBinding(FieldReference bpRef, INode valueNode, ILContext context)
+ {
+ var module = context.Body.Method.Module;
+
+ if (bpRef == null)
+ return false;
+ var elementNode = valueNode as IElementNode;
+ if (elementNode == null)
+ return false;
- //If Value is DynamicResource, SetDynamicResource
VariableDefinition varValue;
- if (bpRef != null && valueNode is IElementNode &&
- context.Variables.TryGetValue(valueNode as IElementNode, out varValue) &&
- varValue.VariableType.FullName == typeof (DynamicResource).FullName)
- {
- var setDynamicResource =
- module.Import(typeof (IDynamicResourceHandler)).Resolve().Methods.First(m => m.Name == "SetDynamicResource");
- var getKey = typeof (DynamicResource).GetProperty("Key").GetMethod;
-
- context.IL.Emit(OpCodes.Ldloc, parent);
- context.IL.Emit(OpCodes.Ldsfld, bpRef);
- context.IL.Emit(OpCodes.Ldloc, varValue);
- context.IL.Emit(OpCodes.Callvirt, module.Import(getKey));
- context.IL.Emit(OpCodes.Callvirt, module.Import(setDynamicResource));
- return;
- }
+ if (!context.Variables.TryGetValue(valueNode as IElementNode, out varValue))
+ return false;
+ return varValue.VariableType.InheritsFromOrImplements(module.Import(typeof(BindingBase)));
+ }
- //If Value is a BindingBase and target is a BP, SetBinding
- if (bpRef != null && valueNode is IElementNode &&
- context.Variables.TryGetValue(valueNode as IElementNode, out varValue) &&
- varValue.VariableType.InheritsFromOrImplements(module.Import(typeof (BindingBase))))
- {
- //TODO: check if parent is a BP
- var setBinding = typeof (BindableObject).GetMethod("SetBinding",
- new[] { typeof (BindableProperty), typeof (BindingBase) });
-
- context.IL.Emit(OpCodes.Ldloc, parent);
- context.IL.Emit(OpCodes.Ldsfld, bpRef);
- context.IL.Emit(OpCodes.Ldloc, varValue);
- context.IL.Emit(OpCodes.Callvirt, module.Import(setBinding));
- return;
- }
+ static IEnumerable<Instruction> SetBinding(VariableDefinition parent, FieldReference bpRef, IElementNode elementNode, IXmlLineInfo iXmlLineInfo, ILContext context)
+ {
+ var module = context.Body.Method.Module;
+ var varValue = context.Variables [elementNode];
+
+ //TODO: check if parent is a BP
+ var setBinding = typeof(BindableObject).GetMethod("SetBinding", new [] { typeof(BindableProperty), typeof(BindingBase) });
+
+ yield return Instruction.Create(OpCodes.Ldloc, parent);
+ yield return Instruction.Create(OpCodes.Ldsfld, bpRef);
+ yield return Instruction.Create(OpCodes.Ldloc, varValue);
+ yield return Instruction.Create(OpCodes.Callvirt, module.Import(setBinding));
+ }
+
+ static bool CanSetValue(FieldReference bpRef, INode node, IXmlLineInfo iXmlLineInfo, ILContext context)
+ {
+ var module = context.Body.Method.Module;
+
+ if (bpRef == null)
+ return false;
+
+ if (node is ValueNode)
+ return true;
+
+ var elementNode = node as IElementNode;
+ if (elementNode == null)
+ return false;
+
+ VariableDefinition varValue;
+ if (!context.Variables.TryGetValue(elementNode, out varValue))
+ return false;
+
+ var bpTypeRef = bpRef.GetBindablePropertyType(iXmlLineInfo, module);
+ return varValue.VariableType.InheritsFromOrImplements(bpTypeRef);
+ }
+
+ static IEnumerable<Instruction> SetValue(VariableDefinition parent, FieldReference bpRef, INode node, IXmlLineInfo iXmlLineInfo, ILContext context)
+ {
+ var setValue = typeof(BindableObject).GetMethod("SetValue", new [] { typeof(BindableProperty), typeof(object) });
+ var valueNode = node as ValueNode;
+ var elementNode = node as IElementNode;
+ var module = context.Body.Method.Module;
- //If it's a BP, SetValue ()
// IL_0007: ldloc.0
// IL_0008: ldsfld class [Xamarin.Forms.Core]Xamarin.Forms.BindableProperty [Xamarin.Forms.Core]Xamarin.Forms.Label::TextProperty
// IL_000d: ldstr "foo"
// IL_0012: callvirt instance void class [Xamarin.Forms.Core]Xamarin.Forms.BindableObject::SetValue(class [Xamarin.Forms.Core]Xamarin.Forms.BindableProperty, object)
- if (bpRef != null)
- {
- //TODO: check if parent is a BP
- var setValue = typeof (BindableObject).GetMethod("SetValue", new[] { typeof (BindableProperty), typeof (object) });
- if (valueNode is ValueNode)
- {
- context.IL.Emit(OpCodes.Ldloc, parent);
- context.IL.Emit(OpCodes.Ldsfld, bpRef);
- context.IL.Append(((ValueNode)valueNode).PushConvertedValue(context, bpRef, valueNode.PushServiceProvider(context),
- true, false));
- context.IL.Emit(OpCodes.Callvirt, module.Import(setValue));
- return;
- }
- if (valueNode is IElementNode)
- {
- var getPropertyReturnType = module.Import(typeof (BindableProperty).GetProperty("ReturnType").GetGetMethod());
- //FIXME: this should check for inheritance too
- var isInstanceOfType = module.Import(typeof (Type).GetMethod("IsInstanceOfType", new[] { typeof (object) }));
- var brfalse = Instruction.Create(OpCodes.Nop);
-
- context.IL.Emit(OpCodes.Ldsfld, bpRef);
- context.IL.Emit(OpCodes.Call, getPropertyReturnType);
- context.IL.Emit(OpCodes.Ldloc, context.Variables[valueNode as IElementNode]);
- if (context.Variables[valueNode as IElementNode].VariableType.IsValueType)
- context.IL.Emit(OpCodes.Box, context.Variables[valueNode as IElementNode].VariableType);
- context.IL.Emit(OpCodes.Callvirt, isInstanceOfType);
- context.IL.Emit(OpCodes.Brfalse, brfalse);
- context.IL.Emit(OpCodes.Ldloc, parent);
- context.IL.Emit(OpCodes.Ldsfld, bpRef);
- context.IL.Emit(OpCodes.Ldloc, context.Variables[(IElementNode)valueNode]);
- if (context.Variables[valueNode as IElementNode].VariableType.IsValueType)
- context.IL.Emit(OpCodes.Box, context.Variables[valueNode as IElementNode].VariableType);
- context.IL.Emit(OpCodes.Callvirt, module.Import(setValue));
- context.IL.Emit(OpCodes.Br, br);
- context.IL.Append(brfalse);
- handled = true;
- }
+ yield return Instruction.Create(OpCodes.Ldloc, parent);
+ yield return Instruction.Create(OpCodes.Ldsfld, bpRef);
+
+ if (valueNode != null) {
+ foreach (var instruction in valueNode.PushConvertedValue(context, bpRef, valueNode.PushServiceProvider(context, bpRef:bpRef), true, false))
+ yield return instruction;
+ } else if (elementNode != null) {
+ yield return Instruction.Create(OpCodes.Ldloc, context.Variables [elementNode]);
+ if (context.Variables [elementNode].VariableType.IsValueType)
+ yield return Instruction.Create(OpCodes.Box, context.Variables [elementNode].VariableType);
}
- //If it's a property, set it
-// IL_0007: ldloc.0
+ yield return Instruction.Create(OpCodes.Callvirt, module.Import(setValue));
+ }
+
+ static bool CanSet(VariableDefinition parent, string localName, INode node, ILContext context)
+ {
+ var module = context.Body.Method.Module;
+ TypeReference declaringTypeReference;
+ var property = parent.VariableType.GetProperty(pd => pd.Name == localName, out declaringTypeReference);
+ if (property == null)
+ return false;
+ var propertySetter = property.SetMethod;
+ if (propertySetter == null || !propertySetter.IsPublic || propertySetter.IsStatic)
+ return false;
+
+ if (node is ValueNode)
+ return true;
+
+ var elementNode = node as IElementNode;
+ if (elementNode == null)
+ return false;
+
+ var vardef = context.Variables [elementNode];
+ var propertyType = property.ResolveGenericPropertyType(declaringTypeReference);
+ var implicitOperator = vardef.VariableType.GetImplicitOperatorTo(propertyType, module);
+
+ if (implicitOperator != null)
+ return true;
+ if (vardef.VariableType.InheritsFromOrImplements(propertyType))
+ return true;
+ if (propertyType.FullName == "System.Object")
+ return true;
+
+ //I'd like to get rid of this condition. This comment used to be //TODO replace latest check by a runtime type check
+ if (vardef.VariableType.FullName == "System.Object")
+ return true;
+
+ return false;
+ }
+
+ static IEnumerable<Instruction> Set(VariableDefinition parent, string localName, INode node, IXmlLineInfo iXmlLineInfo, ILContext context)
+ {
+ var module = context.Body.Method.Module;
+ TypeReference declaringTypeReference;
+ var property = parent.VariableType.GetProperty(pd => pd.Name == localName, out declaringTypeReference);
+ var propertySetter = property.SetMethod;
+
+// IL_0007: ldloc.0
// IL_0008: ldstr "foo"
// IL_000d: callvirt instance void class [Xamarin.Forms.Core]Xamarin.Forms.Label::set_Text(string)
- PropertyDefinition property = elementType.GetProperty(pd => pd.Name == localName, out declaringTypeReference);
- MethodDefinition propertySetter;
- if (property != null && (propertySetter = property.SetMethod) != null && propertySetter.IsPublic)
- {
- module.Import(elementType.Resolve());
- var propertySetterRef =
- module.Import(module.Import(propertySetter).ResolveGenericParameters(declaringTypeReference, module));
- propertySetterRef.ImportTypes(module);
- var propertyType = property.ResolveGenericPropertyType(declaringTypeReference);
- ValueNode vnode = null;
-
- if ((vnode = valueNode as ValueNode) != null)
- {
- context.IL.Emit(OpCodes.Ldloc, parent);
- context.IL.Append(vnode.PushConvertedValue(context,
- propertyType,
- new ICustomAttributeProvider[] { property, propertyType.Resolve() },
- valueNode.PushServiceProvider(context), false, true));
- context.IL.Emit(OpCodes.Callvirt, propertySetterRef);
-
- context.IL.Append(br);
- return;
- }
- if (valueNode is IElementNode)
- {
- var vardef = context.Variables[(ElementNode)valueNode];
- var implicitOperator = vardef.VariableType.GetImplicitOperatorTo(propertyType, module);
- //TODO replace latest check by a runtime type check
- if (implicitOperator != null || vardef.VariableType.InheritsFromOrImplements(propertyType) ||
- propertyType.FullName == "System.Object" || vardef.VariableType.FullName == "System.Object")
- {
- context.IL.Emit(OpCodes.Ldloc, parent);
- context.IL.Emit(OpCodes.Ldloc, vardef);
- if (implicitOperator != null)
- {
-// IL_000f: call !0 class [Xamarin.Forms.Core]Xamarin.Forms.OnPlatform`1<bool>::op_Implicit(class [Xamarin.Forms.Core]Xamarin.Forms.OnPlatform`1<!0>)
- context.IL.Emit(OpCodes.Call, module.Import(implicitOperator));
- }
- else if (!vardef.VariableType.IsValueType && propertyType.IsValueType)
- context.IL.Emit(OpCodes.Unbox_Any, module.Import(propertyType));
- else if (vardef.VariableType.IsValueType && propertyType.FullName == "System.Object")
- context.IL.Emit(OpCodes.Box, vardef.VariableType);
- context.IL.Emit(OpCodes.Callvirt, propertySetterRef);
- context.IL.Append(br);
- return;
- }
- handled = true;
- }
- }
+ module.Import(parent.VariableType.Resolve());
+ var propertySetterRef = module.Import(module.Import(propertySetter).ResolveGenericParameters(declaringTypeReference, module));
+ propertySetterRef.ImportTypes(module);
+ var propertyType = property.ResolveGenericPropertyType(declaringTypeReference);
+ var valueNode = node as ValueNode;
+ var elementNode = node as IElementNode;
- //If it's an already initialized property, add to it
- MethodDefinition propertyGetter;
- //TODO: check if property is assigned
- if (property != null && (propertyGetter = property.GetMethod) != null && propertyGetter.IsPublic)
- {
- var propertyGetterRef = module.Import(propertyGetter);
- propertyGetterRef = module.Import(propertyGetterRef.ResolveGenericParameters(declaringTypeReference, module));
- var propertyType = propertyGetterRef.ReturnType.ResolveGenericParameters(declaringTypeReference);
- var vardef = context.Variables [(ElementNode)valueNode];
-
- //TODO check md.Parameters[0] type
- var adderTuple =
- propertyType.GetMethods(md => md.Name == "Add" && md.Parameters.Count == 1, module).FirstOrDefault();
- if (adderTuple != null)
- {
- var adderRef = module.Import(adderTuple.Item1);
- adderRef = module.Import(adderRef.ResolveGenericParameters(adderTuple.Item2, module));
- var childType = GetParameterType(adderRef.Parameters [0]);
- var implicitOperator = vardef.VariableType.GetImplicitOperatorTo(childType, module);
+ yield return Instruction.Create(OpCodes.Ldloc, parent);
- if (valueNode is IElementNode)
- {
- context.IL.Emit(OpCodes.Ldloc, parent);
- context.IL.Emit(OpCodes.Callvirt, propertyGetterRef);
- context.IL.Emit(OpCodes.Ldloc, vardef);
- if (implicitOperator != null)
- context.IL.Emit(OpCodes.Call, module.Import(implicitOperator));
- context.IL.Emit(OpCodes.Callvirt, adderRef);
- if (adderRef.ReturnType.FullName != "System.Void")
- context.IL.Emit(OpCodes.Pop);
- context.IL.Append(br);
- return;
- }
- }
- }
- if (!handled)
- {
- throw new XamlParseException(string.Format("No property, bindable property, or event found for '{0}'", localName),
- iXmlLineInfo);
+ if (valueNode != null) {
+ foreach (var instruction in valueNode.PushConvertedValue(context, propertyType, new ICustomAttributeProvider [] { property, propertyType.Resolve() }, valueNode.PushServiceProvider(context, propertyRef:property), false, true))
+ yield return instruction;
+ yield return Instruction.Create(OpCodes.Callvirt, propertySetterRef);
+ } else if (elementNode != null) {
+ var vardef = context.Variables [elementNode];
+ var implicitOperator = vardef.VariableType.GetImplicitOperatorTo(propertyType, module);
+ yield return Instruction.Create(OpCodes.Ldloc, vardef);
+ if (implicitOperator != null) {
+// IL_000f: call !0 class [Xamarin.Forms.Core]Xamarin.Forms.OnPlatform`1<bool>::op_Implicit(class [Xamarin.Forms.Core]Xamarin.Forms.OnPlatform`1<!0>)
+ yield return Instruction.Create(OpCodes.Call, module.Import(implicitOperator));
+ } else if (!vardef.VariableType.IsValueType && propertyType.IsValueType)
+ yield return Instruction.Create(OpCodes.Unbox_Any, module.Import(propertyType));
+ else if (vardef.VariableType.IsValueType && propertyType.FullName == "System.Object")
+ yield return Instruction.Create(OpCodes.Box, vardef.VariableType);
+ yield return Instruction.Create(OpCodes.Callvirt, propertySetterRef);
}
- context.IL.Append(br);
+ }
+
+ static bool CanAdd(VariableDefinition parent, string localName, INode node, ILContext context)
+ {
+ var module = context.Body.Method.Module;
+ TypeReference declaringTypeReference;
+ var property = parent.VariableType.GetProperty(pd => pd.Name == localName, out declaringTypeReference);
+ if (property == null)
+ return false;
+ var propertyGetter = property.GetMethod;
+ if (propertyGetter == null || !propertyGetter.IsPublic || propertyGetter.IsStatic)
+ return false;
+ var elementNode = node as IElementNode;
+ if (elementNode == null)
+ return false;
+
+ var vardef = context.Variables [elementNode];
+ var propertyGetterRef = module.Import(propertyGetter);
+ propertyGetterRef = module.Import(propertyGetterRef.ResolveGenericParameters(declaringTypeReference, module));
+ var propertyType = propertyGetterRef.ReturnType.ResolveGenericParameters(declaringTypeReference);
+
+ //TODO check md.Parameters[0] type
+ var adderTuple = propertyType.GetMethods(md => md.Name == "Add" && md.Parameters.Count == 1, module).FirstOrDefault();
+ if (adderTuple == null)
+ return false;
+
+ return true;
+ }
+
+ static IEnumerable<Instruction> Add(VariableDefinition parent, string localName, INode node, IXmlLineInfo iXmlLineInfo, ILContext context)
+ {
+ var module = context.Body.Method.Module;
+ TypeReference declaringTypeReference;
+ var property = parent.VariableType.GetProperty(pd => pd.Name == localName, out declaringTypeReference);
+ var propertyGetter = property.GetMethod;
+ var elementNode = node as IElementNode;
+ var vardef = context.Variables [elementNode];
+ var propertyGetterRef = module.Import(propertyGetter);
+ propertyGetterRef = module.Import(propertyGetterRef.ResolveGenericParameters(declaringTypeReference, module));
+ var propertyType = propertyGetterRef.ReturnType.ResolveGenericParameters(declaringTypeReference);
+ //TODO check md.Parameters[0] type
+ var adderTuple = propertyType.GetMethods(md => md.Name == "Add" && md.Parameters.Count == 1, module).FirstOrDefault();
+ var adderRef = module.Import(adderTuple.Item1);
+ adderRef = module.Import(adderRef.ResolveGenericParameters(adderTuple.Item2, module));
+ var childType = GetParameterType(adderRef.Parameters [0]);
+ var implicitOperator = vardef.VariableType.GetImplicitOperatorTo(childType, module);
+
+ yield return Instruction.Create(OpCodes.Ldloc, parent);
+ yield return Instruction.Create(OpCodes.Callvirt, propertyGetterRef);
+ yield return Instruction.Create(OpCodes.Ldloc, vardef);
+ if (implicitOperator != null)
+ yield return Instruction.Create(OpCodes.Call, module.Import(implicitOperator));
+ yield return Instruction.Create(OpCodes.Callvirt, adderRef);
+ if (adderRef.ReturnType.FullName != "System.Void")
+ yield return Instruction.Create(OpCodes.Pop);
}
public static TypeReference GetParameterType(ParameterDefinition param)
diff --git a/Xamarin.Forms.Build.Tasks/SetResourcesVisitor.cs b/Xamarin.Forms.Build.Tasks/SetResourcesVisitor.cs
index 25efa439..95a93393 100644
--- a/Xamarin.Forms.Build.Tasks/SetResourcesVisitor.cs
+++ b/Xamarin.Forms.Build.Tasks/SetResourcesVisitor.cs
@@ -57,7 +57,7 @@ namespace Xamarin.Forms.Build.Tasks
return;
if (propertyName.LocalName != "MergedWith")
return;
- SetPropertiesVisitor.SetPropertyValue(Context.Variables[(IElementNode)parentNode], propertyName, node, Context, node);
+ Context.IL.Append(SetPropertiesVisitor.SetPropertyValue(Context.Variables[(IElementNode)parentNode], propertyName, node, Context, node));
}
public void Visit(MarkupNode node, INode parentNode)
@@ -118,10 +118,10 @@ namespace Xamarin.Forms.Build.Tasks
Context.Variables[node] = vardef;
}
- // IL_0013: ldloc.0
- // IL_0014: ldstr "key"
- // IL_0019: ldstr "foo"
- // IL_001e: callvirt instance void class [Xamarin.Forms.Core]Xamarin.Forms.ResourceDictionary::Add(string, object)
+// IL_0013: ldloc.0
+// IL_0014: ldstr "key"
+// IL_0019: ldstr "foo"
+// IL_001e: callvirt instance void class [Xamarin.Forms.Core]Xamarin.Forms.ResourceDictionary::Add(string, object)
Context.IL.Emit(OpCodes.Ldloc, parentVar);
Context.IL.Emit(OpCodes.Ldstr, (node.Properties[XmlName.xKey] as ValueNode).Value as string);
var varDef = Context.Variables[node];
@@ -143,7 +143,7 @@ namespace Xamarin.Forms.Build.Tasks
(propertyName.LocalName == "Resources" || propertyName.LocalName.EndsWith(".Resources", StringComparison.Ordinal)) &&
(Context.Variables[node].VariableType.FullName == "Xamarin.Forms.ResourceDictionary" ||
Context.Variables[node].VariableType.Resolve().BaseType.FullName == "Xamarin.Forms.ResourceDictionary"))
- SetPropertiesVisitor.SetPropertyValue(Context.Variables[(IElementNode)parentNode], propertyName, node, Context, node);
+ Context.IL.Append(SetPropertiesVisitor.SetPropertyValue(Context.Variables[(IElementNode)parentNode], propertyName, node, Context, node));
}
public void Visit(RootNode node, INode parentNode)
diff --git a/Xamarin.Forms.Build.Tasks/Xamarin.Forms.Build.Tasks.csproj b/Xamarin.Forms.Build.Tasks/Xamarin.Forms.Build.Tasks.csproj
index e3e89a1e..b7250038 100644
--- a/Xamarin.Forms.Build.Tasks/Xamarin.Forms.Build.Tasks.csproj
+++ b/Xamarin.Forms.Build.Tasks/Xamarin.Forms.Build.Tasks.csproj
@@ -31,7 +31,7 @@
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- <NoWarn>0108;0612;0436;0168;0219</NoWarn>
+ <NoWarn></NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Turkey|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
@@ -42,9 +42,8 @@
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- <NoWarn>0108;0612;0436;0168;0219</NoWarn>
+ <NoWarn></NoWarn>
</PropertyGroup>
- <Import Project="..\Xamarin.Forms.Core\SignWithXamarinKey.props" />
<ItemGroup>
<Reference Include="System" />
<Reference Include="Microsoft.Build.Framework" />
@@ -67,9 +66,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="..\Xamarin.Forms.Core\Properties\ExposeInternalsToXamarin.cs">
- <Link>Properties\ExposeInternalsToXamarin.cs</Link>
- </Compile>
<Compile Include="XamlGTask.cs" />
<Compile Include="ILContext.cs" />
<Compile Include="CreateObjectVisitor.cs" />
@@ -94,6 +90,14 @@
<Compile Include="MethodDefinitionExtensions.cs" />
<Compile Include="CompiledMarkupExtensions\StaticExtension.cs" />
<Compile Include="CompiledMarkupExtensions\ICompiledMarkupExtension.cs" />
+ <Compile Include="BindablePropertyReferenceExtensions.cs" />
+ <Compile Include="CompiledConverters\BindablePropertyConverter.cs" />
+ <Compile Include="CompiledConverters\BindingTypeConverter.cs" />
+ <Compile Include="CompiledConverters\BoundsTypeConverter.cs" />
+ <Compile Include="CompiledConverters\ColorTypeConverter.cs" />
+ <Compile Include="CompiledConverters\ICompiledTypeConverter.cs" />
+ <Compile Include="CompiledConverters\LayoutOptionsConverter.cs" />
+ <Compile Include="CompiledConverters\RectangleTypeConverter.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Target Name="AfterBuild">
@@ -129,4 +133,7 @@
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
+ <ItemGroup>
+ <Folder Include="CompiledConverters\" />
+ </ItemGroup>
</Project>
diff --git a/Xamarin.Forms.Build.Tasks/XamlCTask.cs b/Xamarin.Forms.Build.Tasks/XamlCTask.cs
index b119b4e9..206fc452 100644
--- a/Xamarin.Forms.Build.Tasks/XamlCTask.cs
+++ b/Xamarin.Forms.Build.Tasks/XamlCTask.cs
@@ -40,12 +40,26 @@ namespace Xamarin.Forms.Build.Tasks
protected bool InMsBuild { get; set; }
+ internal string Type { get; set; }
+
public override bool Execute()
{
InMsBuild = true;
return Compile();
}
+ protected void LogException(string subcategory, string errorCode, string helpKeyword, string file, Exception e)
+ {
+ var xpe = e as XamlParseException;
+ var xe = e as XmlException;
+ if (xpe != null)
+ LogError(subcategory, errorCode, helpKeyword, file, xpe.XmlInfo.LineNumber, xpe.XmlInfo.LinePosition, 0, 0, xpe.Message, xpe.HelpLink, xpe.Source);
+ else if (xe != null)
+ LogError(subcategory, errorCode, helpKeyword, file, xe.LineNumber, xe.LinePosition, 0, 0, xe.Message, xe.HelpLink, xe.Source);
+ else
+ LogError(subcategory, errorCode, helpKeyword, file, 0, 0, 0, 0, e.Message, e.HelpLink, e.Source);
+ }
+
protected void LogError(string subcategory, string errorCode, string helpKeyword, string file, int lineNumber,
int columnNumber, int endLineNumber, int endColumnNumber, string message, params object[] messageArgs)
{
@@ -109,12 +123,12 @@ namespace Xamarin.Forms.Build.Tasks
InMsBuild = false,
DependencyPaths = dependencyPaths,
ReferencePath = referencePath,
- OutputGeneratedILAsCode = outputCSharp
+ OutputGeneratedILAsCode = outputCSharp,
};
xamlc.Compile();
}
- public bool Compile()
+ public bool Compile(IList<Exception> thrownExceptions = null)
{
LogLine(1, "Compiling Xaml");
LogLine(1, "\nAssembly: {0}", Assembly);
@@ -150,8 +164,6 @@ namespace Xamarin.Forms.Build.Tasks
var searchpath = Path.GetDirectoryName(p);
LogLine(3, "Adding searchpath {0}", searchpath);
resolver.AddSearchDirectory(searchpath);
- // LogLine (3, "Referencing {0}", p);
- // resolver.AddAssembly (p);
}
}
@@ -218,6 +230,10 @@ namespace Xamarin.Forms.Build.Tasks
if ((options & XamlCompilationOptions.Compile) == XamlCompilationOptions.Compile)
skiptype = false;
}
+
+ if (Type != null)
+ skiptype = !(Type == classname);
+
if (skiptype)
{
LogLine(2, "Has XamlCompilationAttribute set to Skip and not Compile... skipped");
@@ -252,87 +268,14 @@ namespace Xamarin.Forms.Build.Tasks
hasCompiledXamlResources = true;
- try
- {
- LogString(2, " Replacing {0}.InitializeComponent ()... ", typeDef.Name);
- var body = new MethodBody(initComp);
- var il = body.GetILProcessor();
- il.Emit(OpCodes.Nop);
-
- // Generating branching code for the Previewer
- // IL_0007: call class [mscorlib]System.Func`2<class [mscorlib]System.Type,string> class [Xamarin.Forms.Xaml.Internals]Xamarin.Forms.Xaml.XamlLoader::get_XamlFileProvider()
- // IL_000c: brfalse IL_0031
- // IL_0011: call class [mscorlib]System.Func`2<class [mscorlib]System.Type,string> class [Xamarin.Forms.Xaml.Internals]Xamarin.Forms.Xaml.XamlLoader::get_XamlFileProvider()
- // IL_0016: ldarg.0
- // IL_0017: call instance class [mscorlib]System.Type object::GetType()
- // IL_001c: callvirt instance !1 class [mscorlib]System.Func`2<class [mscorlib]System.Type, string>::Invoke(!0)
- // IL_0021: brfalse IL_0031
- // IL_0026: ldarg.0
- // IL_0027: call instance void class Xamarin.Forms.Xaml.UnitTests.XamlLoaderGetXamlForTypeTests::__InitComponentRuntime()
- // IL_002c: ret
- // IL_0031: nop
-
- var nop = Instruction.Create(OpCodes.Nop);
- var getXamlFileProvider = body.Method.Module.Import(body.Method.Module.Import(typeof(Xamarin.Forms.Xaml.Internals.XamlLoader))
- .Resolve()
- .Properties.FirstOrDefault(pd => pd.Name == "XamlFileProvider")
- .GetMethod);
- il.Emit(OpCodes.Call, getXamlFileProvider);
- il.Emit(OpCodes.Brfalse, nop);
- il.Emit(OpCodes.Call, getXamlFileProvider);
- il.Emit(OpCodes.Ldarg_0);
- var getType = body.Method.Module.Import(body.Method.Module.Import(typeof(object))
- .Resolve()
- .Methods.FirstOrDefault(md => md.Name == "GetType"));
- il.Emit(OpCodes.Call, getType);
- var func = body.Method.Module.Import(body.Method.Module.Import(typeof(Func<Type, string>))
- .Resolve()
- .Methods.FirstOrDefault(md => md.Name == "Invoke"));
- func = func.ResolveGenericParameters(body.Method.Module.Import(typeof(Func<Type, string>)), body.Method.Module);
- il.Emit(OpCodes.Callvirt, func);
- il.Emit(OpCodes.Brfalse, nop);
- il.Emit(OpCodes.Ldarg_0);
- il.Emit(OpCodes.Call, initCompRuntime);
- il.Emit(OpCodes.Ret);
- il.Append(nop);
-
- var visitorContext = new ILContext(il, body);
-
- rootnode.Accept(new XamlNodeVisitor((node, parent) => node.Parent = parent), null);
- rootnode.Accept(new ExpandMarkupsVisitor(visitorContext), null);
- rootnode.Accept(new PruneIgnoredNodesVisitor(), null);
- rootnode.Accept(new CreateObjectVisitor(visitorContext), null);
- rootnode.Accept(new SetNamescopesAndRegisterNamesVisitor(visitorContext), null);
- rootnode.Accept(new SetFieldVisitor(visitorContext), null);
- rootnode.Accept(new SetResourcesVisitor(visitorContext), null);
- rootnode.Accept(new SetPropertiesVisitor(visitorContext, true), null);
-
- il.Emit(OpCodes.Ret);
- initComp.Body = body;
- }
- catch (XamlParseException xpe)
- {
- LogLine(2, "failed.");
- LogError(null, null, null, resource.Name, xpe.XmlInfo.LineNumber, xpe.XmlInfo.LinePosition, 0, 0, xpe.Message,
- xpe.HelpLink, xpe.Source);
- LogLine(4, xpe.StackTrace);
- success = false;
- continue;
- }
- catch (XmlException xe)
- {
- LogLine(2, "failed.");
- LogError(null, null, null, resource.Name, xe.LineNumber, xe.LinePosition, 0, 0, xe.Message, xe.HelpLink, xe.Source);
- LogLine(4, xe.StackTrace);
+ LogString(2, " Replacing {0}.InitializeComponent ()... ", typeDef.Name);
+ Exception e;
+ if (!TryCoreCompile(initComp, initCompRuntime, rootnode, out e)) {
success = false;
- continue;
- }
- catch (Exception e)
- {
LogLine(2, "failed.");
- LogError(null, null, null, resource.Name, 0, 0, 0, 0, e.Message, e.HelpLink, e.Source);
+ thrownExceptions?.Add(e);
+ LogException(null, null, null, resource.Name, e);
LogLine(4, e.StackTrace);
- success = false;
continue;
}
LogLine(2, "done.");
@@ -395,7 +338,8 @@ namespace Xamarin.Forms.Build.Tasks
catch (Exception e)
{
LogLine(1, "failed.");
- LogError(null, null, null, null, 0, 0, 0, 0, e.Message, e.HelpLink, e.Source);
+ LogException(null, null, null, null, e);
+ thrownExceptions?.Add(e);
LogLine(4, e.StackTrace);
success = false;
}
@@ -403,6 +347,73 @@ namespace Xamarin.Forms.Build.Tasks
return success;
}
+ bool TryCoreCompile(MethodDefinition initComp, MethodDefinition initCompRuntime, ILRootNode rootnode, out Exception exception)
+ {
+ try {
+ var body = new MethodBody(initComp);
+ var il = body.GetILProcessor();
+ il.Emit(OpCodes.Nop);
+
+ if (initCompRuntime != null) {
+ // Generating branching code for the Previewer
+ // IL_0007: call class [mscorlib]System.Func`2<class [mscorlib]System.Type,string> class [Xamarin.Forms.Xaml.Internals]Xamarin.Forms.Xaml.XamlLoader::get_XamlFileProvider()
+ // IL_000c: brfalse IL_0031
+ // IL_0011: call class [mscorlib]System.Func`2<class [mscorlib]System.Type,string> class [Xamarin.Forms.Xaml.Internals]Xamarin.Forms.Xaml.XamlLoader::get_XamlFileProvider()
+ // IL_0016: ldarg.0
+ // IL_0017: call instance class [mscorlib]System.Type object::GetType()
+ // IL_001c: callvirt instance !1 class [mscorlib]System.Func`2<class [mscorlib]System.Type, string>::Invoke(!0)
+ // IL_0021: brfalse IL_0031
+ // IL_0026: ldarg.0
+ // IL_0027: call instance void class Xamarin.Forms.Xaml.UnitTests.XamlLoaderGetXamlForTypeTests::__InitComponentRuntime()
+ // IL_002c: ret
+ // IL_0031: nop
+
+ var nop = Instruction.Create(OpCodes.Nop);
+ var getXamlFileProvider = body.Method.Module.Import(body.Method.Module.Import(typeof(Xamarin.Forms.Xaml.Internals.XamlLoader))
+ .Resolve()
+ .Properties.FirstOrDefault(pd => pd.Name == "XamlFileProvider")
+ .GetMethod);
+ il.Emit(OpCodes.Call, getXamlFileProvider);
+ il.Emit(OpCodes.Brfalse, nop);
+ il.Emit(OpCodes.Call, getXamlFileProvider);
+ il.Emit(OpCodes.Ldarg_0);
+ var getType = body.Method.Module.Import(body.Method.Module.Import(typeof(object))
+ .Resolve()
+ .Methods.FirstOrDefault(md => md.Name == "GetType"));
+ il.Emit(OpCodes.Call, getType);
+ var func = body.Method.Module.Import(body.Method.Module.Import(typeof(Func<Type, string>))
+ .Resolve()
+ .Methods.FirstOrDefault(md => md.Name == "Invoke"));
+ func = func.ResolveGenericParameters(body.Method.Module.Import(typeof(Func<Type, string>)), body.Method.Module);
+ il.Emit(OpCodes.Callvirt, func);
+ il.Emit(OpCodes.Brfalse, nop);
+ il.Emit(OpCodes.Ldarg_0);
+ il.Emit(OpCodes.Call, initCompRuntime);
+ il.Emit(OpCodes.Ret);
+ il.Append(nop);
+ }
+
+ var visitorContext = new ILContext(il, body);
+
+ rootnode.Accept(new XamlNodeVisitor((node, parent) => node.Parent = parent), null);
+ rootnode.Accept(new ExpandMarkupsVisitor(visitorContext), null);
+ rootnode.Accept(new PruneIgnoredNodesVisitor(), null);
+ rootnode.Accept(new CreateObjectVisitor(visitorContext), null);
+ rootnode.Accept(new SetNamescopesAndRegisterNamesVisitor(visitorContext), null);
+ rootnode.Accept(new SetFieldVisitor(visitorContext), null);
+ rootnode.Accept(new SetResourcesVisitor(visitorContext), null);
+ rootnode.Accept(new SetPropertiesVisitor(visitorContext, true), null);
+
+ il.Emit(OpCodes.Ret);
+ initComp.Body = body;
+ exception = null;
+ return true;
+ } catch (Exception e) {
+ exception = e;
+ return false;
+ }
+ }
+
protected static MethodDefinition DuplicateMethodDef(TypeDefinition typeDef, MethodDefinition methodDef, string newName)
{
var dup = new MethodDefinition(newName, methodDef.Attributes, methodDef.ReturnType);
diff --git a/Xamarin.Forms.Build.Tasks/XamlGTask.cs b/Xamarin.Forms.Build.Tasks/XamlGTask.cs
index 72375d6b..79a49c46 100644
--- a/Xamarin.Forms.Build.Tasks/XamlGTask.cs
+++ b/Xamarin.Forms.Build.Tasks/XamlGTask.cs
@@ -90,8 +90,8 @@ namespace Xamarin.Forms.Build.Tasks
return;
}
- string rootAsm;
- XmlnsHelper.ParseXmlns(rootClass.Value, out rootType, out rootNs, out rootAsm);
+ string rootAsm, targetPlatform;
+ XmlnsHelper.ParseXmlns(rootClass.Value, out rootType, out rootNs, out rootAsm, out targetPlatform);
namesAndTypes = GetNamesAndTypes(root, nsmgr);
var typeArguments = root.Attributes["TypeArguments", "http://schemas.microsoft.com/winfx/2009/xaml"];
diff --git a/Xamarin.Forms.Build.Tasks/XmlTypeExtensions.cs b/Xamarin.Forms.Build.Tasks/XmlTypeExtensions.cs
index e0810633..db182847 100644
--- a/Xamarin.Forms.Build.Tasks/XmlTypeExtensions.cs
+++ b/Xamarin.Forms.Build.Tasks/XmlTypeExtensions.cs
@@ -10,6 +10,11 @@ namespace Xamarin.Forms.Build.Tasks
{
static class XmlTypeExtensions
{
+ public static TypeReference GetTypeReference (string namespaceURI, string typename, ModuleDefinition module, IXmlLineInfo xmlInfo)
+ {
+ return new XmlType (namespaceURI, typename, null).GetTypeReference (module, xmlInfo);
+ }
+
public static TypeReference GetTypeReference(this XmlType xmlType, ModuleDefinition module, IXmlLineInfo xmlInfo)
{
var namespaceURI = xmlType.NamespaceUri;
@@ -36,8 +41,9 @@ namespace Xamarin.Forms.Build.Tasks
string ns;
string typename;
string asmstring;
+ string targetPlatform;
- XmlnsHelper.ParseXmlns(namespaceURI, out typename, out ns, out asmstring);
+ XmlnsHelper.ParseXmlns(namespaceURI, out typename, out ns, out asmstring, out targetPlatform);
asmstring = asmstring ?? module.Assembly.Name.Name;
lookupAssemblies.Add(new Tuple<string, string>(asmstring, ns));
}
diff --git a/Xamarin.Forms.ControlGallery.Android/Activity1.cs b/Xamarin.Forms.ControlGallery.Android/Activity1.cs
index bc1772c6..35f877dc 100644
--- a/Xamarin.Forms.ControlGallery.Android/Activity1.cs
+++ b/Xamarin.Forms.ControlGallery.Android/Activity1.cs
@@ -20,6 +20,7 @@ using System.IO;
using System.IO.IsolatedStorage;
using Droid = Android;
+using System.Globalization;
[assembly: Dependency (typeof (CacheService))]
@@ -337,6 +338,14 @@ namespace Xamarin.Forms.ControlGallery.Android
if (nncgPage != null) {
AddNativeControls (nncgPage);
}
+
+ var nncgPage1 = args.Page as NativeBindingGalleryPage;
+
+ if (nncgPage1 != null)
+ {
+ AddNativeBindings(nncgPage1);
+ }
+
};
}
@@ -408,6 +417,58 @@ namespace Xamarin.Forms.ControlGallery.Android
var size = new Size (nativeView.MeasuredWidth, nativeView.MeasuredHeight);
return new SizeRequest (size);
}
+
+ void AddNativeBindings(NativeBindingGalleryPage page)
+ {
+ if (page.NativeControlsAdded)
+ return;
+
+ StackLayout sl = page.Layout;
+
+ var textView = new TextView(this)
+ {
+ TextSize = 14,
+ Text = "This will be text"
+ };
+
+ var viewGroup = new LinearLayout(this);
+ viewGroup.AddView(textView);
+
+ var buttonColor = new global::Android.Widget.Button(this) { Text = "Change label Color" };
+ buttonColor.Click += (sender, e) => textView.SetTextColor(Color.Blue.ToAndroid());
+
+ var colorPicker = new ColorPickerView(this, 200, 200);
+
+ textView.SetBinding(nameof(textView.Text), new Binding("NativeLabel"));
+ //this doesn't work because there's not TextColor property
+ //textView.SetBinding("TextColor", new Binding("NativeLabelColor", converter: new ColorConverter()));
+ colorPicker.SetBinding(nameof(colorPicker.SelectedColor), new Binding("NativeLabelColor", BindingMode.TwoWay, new ColorConverter()), "ColorPicked");
+
+ sl?.Children.Add(viewGroup);
+ sl?.Children.Add(buttonColor.ToView());
+ sl?.Children.Add(colorPicker);
+
+ page.NativeControlsAdded = true;
+ }
+
+ public class ColorConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value is Color)
+ return ((Color)value).ToAndroid();
+
+ return null;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value is global::Android.Graphics.Color)
+ return ((global::Android.Graphics.Color)value).ToColor();
+
+ return null;
+ }
+ }
}
#endif
}
diff --git a/Xamarin.Forms.ControlGallery.Android/ColorPicker.cs b/Xamarin.Forms.ControlGallery.Android/ColorPicker.cs
new file mode 100644
index 00000000..8e047870
--- /dev/null
+++ b/Xamarin.Forms.ControlGallery.Android/ColorPicker.cs
@@ -0,0 +1,160 @@
+using System;
+using System.ComponentModel;
+using Android.Content;
+using Android.Views;
+using Android.Widget;
+using Xamarin.Forms.Platform.Android;
+using Droid = Android;
+
+namespace Xamarin.Forms.ControlGallery.Android
+{
+ public class ColorPickerView : ViewGroup
+ //, INotifyPropertyChanged
+ {
+ static readonly int[] COLORS = new[] {
+ new Droid.Graphics.Color(255,0,0,255).ToArgb(), new Droid.Graphics.Color(255,0,255,255).ToArgb(), new Droid.Graphics.Color(0,0,255,255).ToArgb(),
+ new Droid.Graphics.Color(0,255,255,255).ToArgb(), new Droid.Graphics.Color(0,255,0,255).ToArgb(), new Droid.Graphics.Color(255,255,0,255).ToArgb(),
+ new Droid.Graphics.Color(255,0,0,255).ToArgb()
+ };
+ Droid.Graphics.Point currentPoint;
+ ColorPointer colorPointer;
+ ImageView imageViewSelectedColor;
+ ImageView imageViewPallete;
+ Droid.Graphics.Color selectedColor;
+ Droid.Graphics.Color previewColor;
+
+ //public event PropertyChangedEventHandler PropertyChanged;
+ public event EventHandler ColorPicked;
+
+ public ColorPickerView(Context context, int minWidth, int minHeight) : base(context)
+ {
+ SelectedColor = Color.Black.ToAndroid();
+
+ SetMinimumHeight(minHeight);
+ SetMinimumWidth(minWidth);
+
+ imageViewPallete = new ImageView(context);
+ imageViewPallete.DrawingCacheEnabled = true;
+ imageViewPallete.Background = new Droid.Graphics.Drawables.GradientDrawable(Droid.Graphics.Drawables.GradientDrawable.Orientation.LeftRight, COLORS);
+
+ imageViewPallete.Touch += (object sender, TouchEventArgs e) =>
+ {
+ if (e.Event.Action == MotionEventActions.Down || e.Event.Action == MotionEventActions.Move)
+ {
+ currentPoint = new Droid.Graphics.Point((int)e.Event.GetX(), (int)e.Event.GetY());
+
+ previewColor = GetCurrentColor(imageViewPallete.GetDrawingCache(false), (int)e.Event.GetX(), (int)e.Event.GetY());
+ }
+ if (e.Event.Action == MotionEventActions.Up)
+ {
+ SelectedColor = previewColor;
+ }
+ };
+
+ imageViewSelectedColor = new ImageView(context);
+ colorPointer = new ColorPointer(context);
+
+ AddView(imageViewPallete);
+ AddView(imageViewSelectedColor);
+ AddView(colorPointer);
+ }
+
+ public Droid.Graphics.Color SelectedColor
+ {
+ get
+ {
+ return selectedColor;
+ }
+
+ set
+ {
+ if (selectedColor == value)
+ return;
+
+ selectedColor = value;
+ UpdateUi();
+ OnPropertyChanged();
+ OnColorPicked();
+ }
+ }
+
+ protected override void OnLayout(bool changed, int left, int top, int right, int bottom)
+ {
+ var half = (bottom - top) / 2;
+ var margin = 20;
+
+ var palleteY = top + half;
+
+ imageViewSelectedColor.Layout(left, top, right, bottom - half - margin);
+ imageViewPallete.Layout(left, palleteY, right, bottom);
+ colorPointer.Layout(left, palleteY, right, bottom);
+ }
+
+ void UpdateUi()
+ {
+ imageViewSelectedColor?.SetBackgroundColor(selectedColor);
+ colorPointer?.UpdatePoint(currentPoint);
+ }
+
+ Droid.Graphics.Color GetCurrentColor(Droid.Graphics.Bitmap bitmap, int x, int y)
+ {
+ if (bitmap == null)
+ return new Droid.Graphics.Color(255, 255, 255, 255);
+
+ if (x < 0)
+ x = 0;
+ if (y < 0)
+ y = 0;
+ if (x >= bitmap.Width)
+ x = bitmap.Width - 1;
+ if (y >= bitmap.Height)
+ y = bitmap.Height - 1;
+
+ int color = bitmap.GetPixel(x, y);
+ return new Droid.Graphics.Color(color);
+ }
+
+ void OnPropertyChanged([System.Runtime.CompilerServices.CallerMemberName] string propertyName = null)
+ {
+ //PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+
+ void OnColorPicked()
+ {
+ ColorPicked?.Invoke(this, new EventArgs());
+ }
+ }
+
+ public class ColorPointer : Droid.Views.View
+ {
+ Droid.Graphics.Paint colorPointerPaint;
+ Droid.Graphics.Point currentPoint;
+ Droid.Graphics.Point nextPoint;
+
+ public ColorPointer(Context context) : base(context)
+ {
+
+ colorPointerPaint = new Droid.Graphics.Paint();
+ colorPointerPaint.SetStyle(Droid.Graphics.Paint.Style.Stroke);
+ colorPointerPaint.StrokeWidth = 5f;
+ colorPointerPaint.SetARGB(255, 0, 0, 0);
+
+ }
+
+ public void UpdatePoint(Droid.Graphics.Point p)
+ {
+ if (p == null)
+ return;
+
+ if (currentPoint == null)
+ currentPoint = nextPoint;
+
+ nextPoint = p;
+ }
+
+ protected override void OnDraw(Droid.Graphics.Canvas canvas)
+ {
+ base.OnDraw(canvas);
+ }
+ }
+}
diff --git a/Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs b/Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs
index 7f86a85d..a550212c 100644
--- a/Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs
+++ b/Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs
@@ -16,6 +16,7 @@ using Android.Content;
using Android.Runtime;
using Android.Util;
using AButton = Android.Widget.Button;
+using AView = Android.Views.View;
using Android.OS;
using System.Reflection;
@@ -44,7 +45,7 @@ namespace Xamarin.Forms.ControlGallery.Android
}
_page = newElement as MasterDetailPage;
- _page.PropertyChanged += Page_PropertyChanged;
+ _page.PropertyChanged += Page_PropertyChanged;
_page.LayoutChanged += Page_LayoutChanged;
}
@@ -416,10 +417,23 @@ namespace Xamarin.Forms.ControlGallery.Android
return view;
}
}
- public abstract class CustomContentRenderer : ViewRenderer
+
+ [Preserve]
+ public class CustomContentRenderer : ViewRenderer
{
+ [Preserve]
+ public CustomContentRenderer()
+ {
+ AutoPackage = true;
+ }
+
+ protected override AView CreateNativeControl()
+ {
+ return new AView(Context);
+ }
}
+ [Preserve]
public class CustomNativeButton : AButton
{
public CustomNativeButton(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
diff --git a/Xamarin.Forms.ControlGallery.Android/Properties/AndroidManifest.xml b/Xamarin.Forms.ControlGallery.Android/Properties/AndroidManifest.xml
index 512c737a..9bbcafdf 100644
--- a/Xamarin.Forms.ControlGallery.Android/Properties/AndroidManifest.xml
+++ b/Xamarin.Forms.ControlGallery.Android/Properties/AndroidManifest.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="AndroidControlGallery.AndroidControlGallery" android:installLocation="auto">
- <uses-sdk android:minSdkVersion="15" android:targetSdkVersion="23" />
+ <uses-sdk android:minSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
diff --git a/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj b/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj
index 25f896f8..d42dbf37 100644
--- a/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj
+++ b/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj
@@ -163,9 +163,8 @@
<HintPath>..\packages\Xamarin.GooglePlayServices.Maps.29.0.0.1\lib\MonoAndroid41\Xamarin.GooglePlayServices.Maps.dll</HintPath>
<Private>True</Private>
</Reference>
- <Reference Include="Xamarin.Insights, Version=1.11.0.0, Culture=neutral, processorArchitecture=MSIL">
- <HintPath>..\packages\Xamarin.Insights.1.11.4\lib\MonoAndroid10\Xamarin.Insights.dll</HintPath>
- <Private>True</Private>
+ <Reference Include="Xamarin.Insights">
+ <HintPath>..\packages\Xamarin.Insights.1.12.3\lib\MonoAndroid10\Xamarin.Insights.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@@ -175,6 +174,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resources\Resource.Designer.cs" />
<Compile Include="CustomRenderers.cs" />
+ <Compile Include="ColorPicker.cs" />
</ItemGroup>
<ItemGroup>
<AndroidAsset Include="Assets\default.css" />
@@ -262,19 +262,10 @@
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Import Project="..\packages\Xamarin.Insights.1.11.4\build\MonoAndroid10\Xamarin.Insights.targets" Condition="Exists('..\packages\Xamarin.Insights.1.11.4\build\MonoAndroid10\Xamarin.Insights.targets')" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
- <Import Project="..\packages\Xamarin.Insights.1.11.4\build\MonoAndroid10\Xamarin.Insights.targets" Condition="Exists('..\packages\Xamarin.Insights.1.11.4\build\MonoAndroid10\Xamarin.Insights.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
- <Error Condition="!Exists('..\packages\Xamarin.Insights.1.11.4\build\MonoAndroid10\Xamarin.Insights.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Insights.1.11.4\build\MonoAndroid10\Xamarin.Insights.targets'))" />
<Error Condition="!Exists('..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets'))" />
</Target>
<Target Name="BeforeBuild">
@@ -284,4 +275,5 @@
<Copy SourceFiles="@(MapsKey)" DestinationFiles="Properties\MapsKey.cs" Condition="!Exists('Properties\MapsKey.cs')" />
</Target>
<Import Project="..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets')" />
+ <Import Project="..\packages\Xamarin.Insights.1.12.3\build\MonoAndroid10\Xamarin.Insights.targets" Condition="Exists('..\packages\Xamarin.Insights.1.12.3\build\MonoAndroid10\Xamarin.Insights.targets')" />
</Project> \ No newline at end of file
diff --git a/Xamarin.Forms.ControlGallery.Android/packages.config b/Xamarin.Forms.ControlGallery.Android/packages.config
index 936300d5..3dfba0a7 100644
--- a/Xamarin.Forms.ControlGallery.Android/packages.config
+++ b/Xamarin.Forms.ControlGallery.Android/packages.config
@@ -11,5 +11,5 @@
<package id="Xamarin.GooglePlayServices.Base" version="29.0.0.1" targetFramework="monoandroid60" />
<package id="Xamarin.GooglePlayServices.Basement" version="29.0.0.1" targetFramework="monoandroid60" />
<package id="Xamarin.GooglePlayServices.Maps" version="29.0.0.1" targetFramework="monoandroid60" />
- <package id="Xamarin.Insights" version="1.11.4" targetFramework="MonoAndroid60" />
+ <package id="Xamarin.Insights" version="1.12.3" targetFramework="monoandroid70" />
</packages> \ No newline at end of file
diff --git a/Xamarin.Forms.ControlGallery.WP8/App.xaml.cs b/Xamarin.Forms.ControlGallery.WP8/App.xaml.cs
index 513632c9..5b836786 100644
--- a/Xamarin.Forms.ControlGallery.WP8/App.xaml.cs
+++ b/Xamarin.Forms.ControlGallery.WP8/App.xaml.cs
@@ -24,10 +24,7 @@ namespace Xamarin.Forms.ControlGallery.WP8
/// Constructor for the Application object.
/// </summary>
public App()
- {
- if (!Debugger.IsAttached)
- Insights.Initialize (Controls.App.InsightsApiKey);
-
+ {
FormsMaps.Init (Controls.App.Config["WP8AppId"], Controls.App.Config["WP8AuthToken"]);
// Global handler for uncaught exceptions.
diff --git a/Xamarin.Forms.ControlGallery.WP8/Xamarin.Forms.ControlGallery.WP8.csproj b/Xamarin.Forms.ControlGallery.WP8/Xamarin.Forms.ControlGallery.WP8.csproj
index f4f1ec8a..a2d9b942 100644
--- a/Xamarin.Forms.ControlGallery.WP8/Xamarin.Forms.ControlGallery.WP8.csproj
+++ b/Xamarin.Forms.ControlGallery.WP8/Xamarin.Forms.ControlGallery.WP8.csproj
@@ -241,8 +241,8 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
- <Reference Include="Xamarin.Insights, Version=1.11.0.0, Culture=neutral, processorArchitecture=MSIL">
- <HintPath>..\packages\Xamarin.Insights.1.11.4\lib\WP80\Xamarin.Insights.dll</HintPath>
+ <Reference Include="Xamarin.Insights, Version=1.12.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <HintPath>..\packages\Xamarin.Insights.1.12.3\lib\portable-win+net45+wp80+windows8+wpa+MonoAndroid10+MonoTouch10\Xamarin.Insights.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
@@ -262,7 +262,7 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
- <Error Condition="!Exists('..\packages\Xamarin.Insights.1.11.4\build\WP80\Xamarin.Insights.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Insights.1.11.4\build\WP80\Xamarin.Insights.targets'))" />
+ <Error Condition="!Exists('..\packages\Xamarin.Insights.1.12.3\build\portable-win+net45+wp80+windows8+wpa+MonoAndroid10+MonoTouch10\Xamarin.Insights.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Insights.1.12.3\build\portable-win+net45+wp80+windows8+wpa+MonoAndroid10+MonoTouch10\Xamarin.Insights.targets'))" />
</Target>
- <Import Project="..\packages\Xamarin.Insights.1.11.4\build\WP80\Xamarin.Insights.targets" Condition="Exists('..\packages\Xamarin.Insights.1.11.4\build\WP80\Xamarin.Insights.targets')" />
+ <Import Project="..\packages\Xamarin.Insights.1.12.3\build\portable-win+net45+wp80+windows8+wpa+MonoAndroid10+MonoTouch10\Xamarin.Insights.targets" Condition="Exists('..\packages\Xamarin.Insights.1.12.3\build\portable-win+net45+wp80+windows8+wpa+MonoAndroid10+MonoTouch10\Xamarin.Insights.targets')" />
</Project> \ No newline at end of file
diff --git a/Xamarin.Forms.ControlGallery.WP8/packages.config b/Xamarin.Forms.ControlGallery.WP8/packages.config
index aa654dda..68c9cf0a 100644
--- a/Xamarin.Forms.ControlGallery.WP8/packages.config
+++ b/Xamarin.Forms.ControlGallery.WP8/packages.config
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Xamarin.Insights" version="1.11.4" targetFramework="wp8" />
+ <package id="Xamarin.Insights" version="1.12.3" targetFramework="wp8" />
</packages> \ No newline at end of file
diff --git a/Xamarin.Forms.ControlGallery.WindowsUniversal/MainPage.xaml.cs b/Xamarin.Forms.ControlGallery.WindowsUniversal/MainPage.xaml.cs
index 7e16e83c..84767a55 100644
--- a/Xamarin.Forms.ControlGallery.WindowsUniversal/MainPage.xaml.cs
+++ b/Xamarin.Forms.ControlGallery.WindowsUniversal/MainPage.xaml.cs
@@ -1,6 +1,7 @@
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
using System;
+using System.Globalization;
using Windows.Foundation;
using Windows.Graphics.Display;
using Windows.UI.ViewManagement;
@@ -33,6 +34,12 @@ namespace Xamarin.Forms.ControlGallery.WindowsUniversal
if (nncgPage != null) {
AddNativeControls (nncgPage);
}
+
+ var nncgPage1 = args.Page as NativeBindingGalleryPage;
+
+ if (nncgPage1 != null) {
+ AddNativeBindings(nncgPage1);
+ }
};
}
@@ -105,5 +112,71 @@ namespace Xamarin.Forms.ControlGallery.WindowsUniversal
page.NativeControlsAdded = true;
}
- }
+
+ void AddNativeBindings(NativeBindingGalleryPage page)
+ {
+ if (page.NativeControlsAdded)
+ return;
+
+ StackLayout sl = page.Layout;
+
+ var txbLabel = new TextBlock {
+ FontSize = 14,
+ FontFamily = new FontFamily("HelveticaNeue")
+ };
+
+ var txbBox = new TextBox {
+ FontSize = 14,
+ FontFamily = new FontFamily("HelveticaNeue")
+ };
+
+ var btnColor = new Windows.UI.Xaml.Controls.Button { Content = "Toggle Label Color", Height = 80 };
+ btnColor.Click += (sender, args) => txbLabel.Foreground = new SolidColorBrush(Windows.UI.Colors.Pink);
+
+ var btnTextBox = new Windows.UI.Xaml.Controls.Button { Content = "Change text textbox", Height = 80 };
+ btnTextBox.Click += (sender, args) => txbBox.Text = "Hello 2 way native";
+
+ txbLabel.SetBinding("Text", new Binding("NativeLabel"));
+ txbBox.SetBinding("Text", new Binding("NativeLabel", BindingMode.TwoWay), "TextChanged");
+ txbLabel.SetBinding("Foreground", new Binding("NativeLabelColor", BindingMode.TwoWay, new ColorToBrushNativeBindingConverter()));
+
+ var grd = new StackPanel();
+ grd.Children.Add(txbLabel);
+ grd.Children.Add(btnColor);
+
+ sl?.Children.Add(grd.ToView());
+
+ sl?.Children.Add(txbBox);
+ sl?.Children.Add(btnTextBox.ToView());
+
+ page.NativeControlsAdded = true;
+ }
+
+ class ColorToBrushNativeBindingConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value is Color)
+ return new SolidColorBrush(ToWindowsColor((Color)value));
+
+ return null;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value is SolidColorBrush)
+ return ToColor(((SolidColorBrush)value).Color);
+
+ return null;
+ }
+ public static Windows.UI.Color ToWindowsColor(Color color)
+ {
+ return Windows.UI.Color.FromArgb((byte)(color.A * 255), (byte)(color.R * 255), (byte)(color.G * 255), (byte)(color.B * 255));
+ }
+ public static Color ToColor(Windows.UI.Color color)
+ {
+ return Color.FromRgba(color.R, color.G, color.B, color.A);
+ }
+ }
+ }
}
diff --git a/Xamarin.Forms.ControlGallery.iOS/AppDelegate.cs b/Xamarin.Forms.ControlGallery.iOS/AppDelegate.cs
index 8f064d34..7614796a 100644
--- a/Xamarin.Forms.ControlGallery.iOS/AppDelegate.cs
+++ b/Xamarin.Forms.ControlGallery.iOS/AppDelegate.cs
@@ -1,90 +1,87 @@
using System;
-using System.Collections.Generic;
using System.Drawing;
-using System.Linq;
-using System.Runtime.Remoting.Lifetime;
+using System.Globalization;
using System.IO;
-#if __UNIFIED__
-using UIKit;
-using Foundation;
+using AdvancedColorPicker;
using CoreGraphics;
-#else
-using MonoTouch.UIKit;
-using MonoTouch.Foundation;
-#endif
+using Foundation;
+using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.ControlGallery.iOS;
using Xamarin.Forms.Controls;
-using Xamarin.Forms.Maps.iOS;
using Xamarin.Forms.Platform.iOS;
-[assembly: Dependency (typeof (TestCloudService))]
-[assembly: Dependency (typeof (StringProvider))]
-[assembly: Dependency (typeof (CacheService))]
-[assembly: ExportRenderer (typeof (DisposePage), typeof(DisposePageRenderer))]
-[assembly: ExportRenderer (typeof (DisposeLabel), typeof(DisposeLabelRenderer))]
+[assembly: Dependency(typeof(TestCloudService))]
+[assembly: Dependency(typeof(StringProvider))]
+[assembly: Dependency(typeof(CacheService))]
+[assembly: ExportRenderer(typeof(DisposePage), typeof(DisposePageRenderer))]
+[assembly: ExportRenderer(typeof(DisposeLabel), typeof(DisposeLabelRenderer))]
namespace Xamarin.Forms.ControlGallery.iOS
{
public class CacheService : ICacheService
{
- public void ClearImageCache ()
+ public void ClearImageCache()
{
- var documents = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments);
- var cache = Path.Combine (documents, ".config", ".isolated-storage", "ImageLoaderCache");
- foreach (var file in Directory.GetFiles (cache)) {
- File.Delete (file);
+ var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
+ var cache = Path.Combine(documents, ".config", ".isolated-storage", "ImageLoaderCache");
+ foreach (var file in Directory.GetFiles(cache))
+ {
+ File.Delete(file);
}
}
}
public class DisposePageRenderer : PageRenderer
{
- protected override void Dispose (bool disposing)
+ protected override void Dispose(bool disposing)
{
- if (disposing) {
- ((DisposePage) Element).SendRendererDisposed ();
+ if (disposing)
+ {
+ ((DisposePage)Element).SendRendererDisposed();
}
- base.Dispose (disposing);
+ base.Dispose(disposing);
}
}
public class DisposeLabelRenderer : LabelRenderer
{
- protected override void Dispose (bool disposing)
+ protected override void Dispose(bool disposing)
{
- if (disposing) {
- ((DisposeLabel) Element).SendRendererDisposed ();
+ if (disposing)
+ {
+ ((DisposeLabel)Element).SendRendererDisposed();
}
- base.Dispose (disposing);
+ base.Dispose(disposing);
}
}
public class StringProvider : IStringProvider
{
- public string CoreGalleryTitle {
+ public string CoreGalleryTitle
+ {
get { return "iOS Core Gallery"; }
}
}
public class TestCloudService : ITestCloudService
{
- public bool IsOnTestCloud ()
+ public bool IsOnTestCloud()
{
- var isInTestCloud = Environment.GetEnvironmentVariable ("XAMARIN_TEST_CLOUD");
-
+ var isInTestCloud = Environment.GetEnvironmentVariable("XAMARIN_TEST_CLOUD");
+
return isInTestCloud != null && isInTestCloud.Equals("1");
}
- public string GetTestCloudDeviceName ()
+ public string GetTestCloudDeviceName()
{
- return Environment.GetEnvironmentVariable ("XTC_DEVICE_NAME");
+ return Environment.GetEnvironmentVariable("XTC_DEVICE_NAME");
}
public string GetTestCloudDevice()
{
- return Environment.GetEnvironmentVariable ("XTC_DEVICE");
+ return Environment.GetEnvironmentVariable("XTC_DEVICE");
}
}
@@ -132,47 +129,58 @@ namespace Xamarin.Forms.ControlGallery.iOS
}
#else
- [Register ("AppDelegate")]
+ [Register("AppDelegate")]
public partial class AppDelegate : FormsApplicationDelegate
{
- public override bool FinishedLaunching (UIApplication uiApplication, NSDictionary launchOptions)
+ public override bool FinishedLaunching(UIApplication uiApplication, NSDictionary launchOptions)
{
- App.IOSVersion = int.Parse (UIDevice.CurrentDevice.SystemVersion.Substring (0, 1));
+ App.IOSVersion = int.Parse(UIDevice.CurrentDevice.SystemVersion.Substring(0, 1));
- #if !_CLASSIC_
- Xamarin.Calabash.Start ();
- #endif
- Forms.Init ();
- FormsMaps.Init ();
- Forms.ViewInitialized += (object sender, ViewInitializedEventArgs e) => {
+ Xamarin.Calabash.Start();
+ Forms.Init();
+ FormsMaps.Init();
+ Forms.ViewInitialized += (object sender, ViewInitializedEventArgs e) =>
+ {
// http://developer.xamarin.com/recipes/testcloud/set-accessibilityidentifier-ios/
- if (null != e.View.AutomationId && null != e.NativeView) {
- // e.NativeView.AccessibilityIdentifier = e.View.StyleId;
+ if (null != e.View.AutomationId && null != e.NativeView)
+ {
+ // e.NativeView.AccessibilityIdentifier = e.View.StyleId;
}
};
- var app = new App ();
+ var app = new App();
var mdp = app.MainPage as MasterDetailPage;
var detail = mdp?.Detail as NavigationPage;
- if (detail != null) {
- detail.Pushed += (sender, args) => {
+ if (detail != null)
+ {
+ detail.Pushed += (sender, args) =>
+ {
var nncgPage = args.Page as NestedNativeControlGalleryPage;
- if (nncgPage != null) {
- AddNativeControls (nncgPage);
+ if (nncgPage != null)
+ {
+ AddNativeControls(nncgPage);
+ }
+
+ var nncgPage1 = args.Page as NativeBindingGalleryPage;
+
+ if (nncgPage1 != null)
+ {
+ AddNativeBindings(nncgPage1);
}
};
- }
+ }
- LoadApplication (app);
- return base.FinishedLaunching (uiApplication, launchOptions);
+ LoadApplication(app);
+ return base.FinishedLaunching(uiApplication, launchOptions);
}
- void AddNativeControls (NestedNativeControlGalleryPage page)
+ void AddNativeControls(NestedNativeControlGalleryPage page)
{
- if (page.NativeControlsAdded) {
+ if (page.NativeControlsAdded)
+ {
return;
}
@@ -183,94 +191,153 @@ namespace Xamarin.Forms.ControlGallery.iOS
var longerText =
"I am a native UILabel with considerably more text. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.";
- var uilabel = new UILabel {
+ var uilabel = new UILabel
+ {
MinimumFontSize = 14f,
Text = originalText,
Lines = 0,
LineBreakMode = UILineBreakMode.WordWrap,
- Font = UIFont.FromName ("Helvetica", 24f)
+ Font = UIFont.FromName("Helvetica", 24f)
};
- sl?.Children.Add (uilabel);
+ sl?.Children.Add(uilabel);
// Create and add a native Button
- var uibutton = new UIButton (UIButtonType.RoundedRect);
- uibutton.SetTitle ("Toggle Text Amount", UIControlState.Normal);
- uibutton.Font = UIFont.FromName ("Helvetica", 14f);
-
+ var uibutton = new UIButton(UIButtonType.RoundedRect);
+ uibutton.SetTitle("Toggle Text Amount", UIControlState.Normal);
+ uibutton.Font = UIFont.FromName("Helvetica", 14f);
+
- uibutton.TouchUpInside += (sender, args) => {
+ uibutton.TouchUpInside += (sender, args) =>
+ {
uilabel.Text = uilabel.Text == originalText ? longerText : originalText;
- uilabel.SizeToFit ();
+ uilabel.SizeToFit();
};
- sl?.Children.Add (uibutton.ToView ());
+ sl?.Children.Add(uibutton.ToView());
// Create some control which we know don't behave correctly with regard to measurement
- var difficultControl0 = new BrokenNativeControl {
+ var difficultControl0 = new BrokenNativeControl
+ {
MinimumFontSize = 14f,
- Font = UIFont.FromName ("Helvetica", 14f),
+ Font = UIFont.FromName("Helvetica", 14f),
Lines = 0,
LineBreakMode = UILineBreakMode.WordWrap,
Text = "Doesn't play nice with sizing. That's why there's a big gap around it."
};
- var difficultControl1 = new BrokenNativeControl {
+ var difficultControl1 = new BrokenNativeControl
+ {
MinimumFontSize = 14f,
- Font = UIFont.FromName ("Helvetica", 14f),
+ Font = UIFont.FromName("Helvetica", 14f),
Lines = 0,
LineBreakMode = UILineBreakMode.WordWrap,
Text = "Custom size fix specified. No gaps."
};
- var explanation0 = new UILabel {
+ var explanation0 = new UILabel
+ {
MinimumFontSize = 14f,
Text = "The next control is a customized label with a bad SizeThatFits implementation.",
Lines = 0,
LineBreakMode = UILineBreakMode.WordWrap,
- Font = UIFont.FromName ("Helvetica", 24f)
+ Font = UIFont.FromName("Helvetica", 24f)
};
- var explanation1 = new UILabel {
+ var explanation1 = new UILabel
+ {
MinimumFontSize = 14f,
Text = "The next control is the same broken class as above, but we pass in an override to the GetDesiredSize method.",
Lines = 0,
LineBreakMode = UILineBreakMode.WordWrap,
- Font = UIFont.FromName ("Helvetica", 24f)
+ Font = UIFont.FromName("Helvetica", 24f)
};
// Add a misbehaving control
- sl?.Children.Add (explanation0);
- sl?.Children.Add (difficultControl0);
+ sl?.Children.Add(explanation0);
+ sl?.Children.Add(difficultControl0);
// Add the misbehaving control with a custom delegate for FixSize
- sl?.Children.Add (explanation1);
- sl?.Children.Add (difficultControl1, FixSize);
+ sl?.Children.Add(explanation1);
+ sl?.Children.Add(difficultControl1, FixSize);
page.NativeControlsAdded = true;
}
- SizeRequest? FixSize (NativeViewWrapperRenderer renderer, double width, double height)
+ SizeRequest? FixSize(NativeViewWrapperRenderer renderer, double width, double height)
{
var uiView = renderer.Control;
var view = renderer.Element;
- if (uiView == null || view == null) {
+ if (uiView == null || view == null)
+ {
return null;
}
-#if __UNIFIED__
- var constraint = new CGSize (width, height);
-#else
- var constraint = new SizeF ((float)width, (float)height);
-#endif
-
+ var constraint = new CGSize(width, height);
+
// Let the BrokenNativeControl determine its size (which we know will be wrong)
- var badRect = uiView.SizeThatFits (constraint);
+ var badRect = uiView.SizeThatFits(constraint);
// And we'll use the width (which is fine) and substitute our own height
- return new SizeRequest (new Size (badRect.Width, 20));
+ return new SizeRequest(new Size(badRect.Width, 20));
+ }
+
+ void AddNativeBindings(NativeBindingGalleryPage page)
+ {
+ if (page.NativeControlsAdded)
+ return;
+
+ StackLayout sl = page.Layout;
+
+ int width = (int)sl.Width;
+ int heightCustomLabelView = 100;
+
+ var uilabel = new UILabel(new RectangleF(0, 0, width, heightCustomLabelView))
+ {
+ MinimumFontSize = 14f,
+ Lines = 0,
+ LineBreakMode = UILineBreakMode.WordWrap,
+ Font = UIFont.FromName("Helvetica", 24f),
+ Text = "DefaultText"
+ };
+
+ var uibuttonColor = new UIButton(UIButtonType.RoundedRect);
+ uibuttonColor.SetTitle("Toggle Text Color Binding", UIControlState.Normal);
+ uibuttonColor.Font = UIFont.FromName("Helvetica", 14f);
+ uibuttonColor.TouchUpInside += (sender, args) => uilabel.TextColor = UIColor.Blue;
+
+ var nativeColorConverter = new ColorConverter();
+
+ uilabel.SetBinding("Text", new Binding("NativeLabel"));
+ uilabel.SetBinding(nameof(uilabel.TextColor), new Binding("NativeLabelColor", converter: nativeColorConverter));
+
+ var uiView = new UIView(new RectangleF(0, 0, width, heightCustomLabelView));
+ uiView.Add(uilabel);
+ sl?.Children.Add(uiView);
+ sl?.Children.Add(uibuttonColor.ToView());
+ var colorPicker = new ColorPickerView(new CGRect(0, 0, width, 300));
+ colorPicker.SetBinding("SelectedColor", new Binding("NativeLabelColor", BindingMode.TwoWay, nativeColorConverter), "ColorPicked");
+ sl?.Children.Add(colorPicker);
+ page.NativeControlsAdded = true;
+ }
+ }
+
+ public class ColorConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value is Color)
+ return ((Color)value).ToUIColor();
+ return value;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value is UIColor)
+ return ((UIColor)value).ToColor();
+ return value;
}
}
-#endif
}
+#endif
diff --git a/Xamarin.Forms.ControlGallery.iOS/BrokenNativeControl.cs b/Xamarin.Forms.ControlGallery.iOS/BrokenNativeControl.cs
index 37fe4c5f..f8163c19 100644
--- a/Xamarin.Forms.ControlGallery.iOS/BrokenNativeControl.cs
+++ b/Xamarin.Forms.ControlGallery.iOS/BrokenNativeControl.cs
@@ -1,10 +1,5 @@
-#if __UNIFIED__
using CoreGraphics;
using UIKit;
-#else
-using System.Drawing;
-using MonoTouch.UIKit;
-#endif
namespace Xamarin.Forms.ControlGallery.iOS
{
@@ -16,19 +11,12 @@ namespace Xamarin.Forms.ControlGallery.iOS
public override string Text
{
get { return base.Text; }
- set { base.Text = value.ToUpper (); }
+ set { base.Text = value.ToUpper(); }
}
-#if __UNIFIED__
- public override CGSize SizeThatFits (CGSize size)
+ public override CGSize SizeThatFits(CGSize size)
{
return new CGSize(size.Width, 150);
}
-#else
- public override SizeF SizeThatFits (SizeF size)
- {
- return new SizeF (size.Width, 150);
- }
-#endif
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.ControlGallery.iOS/CustomRenderers.cs b/Xamarin.Forms.ControlGallery.iOS/CustomRenderers.cs
index 92b58455..6b2ab38f 100644
--- a/Xamarin.Forms.ControlGallery.iOS/CustomRenderers.cs
+++ b/Xamarin.Forms.ControlGallery.iOS/CustomRenderers.cs
@@ -1,27 +1,15 @@
using System;
-using Xamarin.Forms.Controls;
-using Xamarin.Forms;
-using Xamarin.Forms.Platform.iOS;
-using Xamarin.Forms.ControlGallery.iOS;
using System.Collections.Generic;
-using System.Linq;
-using System.Drawing;
-using System.Collections;
-
-#if __UNIFIED__
-using UIKit;
-using MapKit;
using CoreLocation;
using Foundation;
+using MapKit;
+using UIKit;
+using Xamarin.Forms;
+using Xamarin.Forms.ControlGallery.iOS;
+using Xamarin.Forms.Controls;
+using Xamarin.Forms.Platform.iOS;
using RectangleF = CoreGraphics.CGRect;
-#else
-using MonoTouch.UIKit;
-using MonoTouch.Foundation;
-using MonoTouch.MapKit;
-using MonoTouch.CoreLocation;
-#endif
-
[assembly: ExportRenderer(typeof(Bugzilla21177.CollectionView), typeof(CollectionViewRenderer))]
[assembly: ExportRenderer(typeof(Bugzilla31395.CustomContentView), typeof(CustomContentRenderer))]
[assembly: ExportRenderer(typeof(NativeCell), typeof(NativeiOSCellRenderer))]
@@ -29,6 +17,7 @@ using MonoTouch.CoreLocation;
[assembly: ExportRenderer(typeof(NativeListView), typeof(NativeListViewRenderer))]
[assembly: ExportRenderer(typeof(CustomMapView), typeof(CustomIOSMapRenderer))]
[assembly: ExportRenderer(typeof(TabbedPage), typeof(TabbedPageWithCustomBarColorRenderer))]
+[assembly: ExportRenderer(typeof(Bugzilla43161.AccessoryViewCell), typeof(AccessoryViewCellRenderer))]
namespace Xamarin.Forms.ControlGallery.iOS
{
public class CustomIOSMapRenderer : ViewRenderer<CustomMapView, MKMapView>
@@ -325,7 +314,7 @@ namespace Xamarin.Forms.ControlGallery.iOS
public IEnumerable<DataSource> Items
{
//get{ }
- set { _tableItems = new List<DataSource>(value); }
+ set { _tableItems = new List<DataSource>(value); }
}
public NativeiOSListViewSource(NativeListView2 view)
@@ -338,19 +327,10 @@ namespace Xamarin.Forms.ControlGallery.iOS
/// Called by the TableView to determine how many cells to create for that particular section.
/// </summary>
-#if __UNIFIED__
public override nint RowsInSection(UITableView tableview, nint section)
{
return _tableItems.Count;
}
-#else
- public override int RowsInSection (UITableView tableview, int section)
- {
- return _tableItems.Count;
- }
-
-#endif
-
#region user interaction methods
@@ -418,19 +398,11 @@ namespace Xamarin.Forms.ControlGallery.iOS
_listView = view;
}
-#if __UNIFIED__
public override nint RowsInSection(UITableView tableview, nint section)
{
return _tableItems.Count;
}
-#else
- public override int RowsInSection (UITableView tableview, int section)
- {
- return _tableItems.Count;
- }
-#endif
-
#region user interaction methods
public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
@@ -536,10 +508,9 @@ namespace Xamarin.Forms.ControlGallery.iOS
public override void ViewDidLoad()
{
base.ViewDidLoad();
- CollectionView.RegisterClassForCell(typeof (CollectionViewCell), cellId);
+ CollectionView.RegisterClassForCell(typeof(CollectionViewCell), cellId);
}
-#if __UNIFIED__
public override nint NumberOfSections(UICollectionView collectionView)
{
return 1;
@@ -550,18 +521,6 @@ namespace Xamarin.Forms.ControlGallery.iOS
return items.Count;
}
-#else
- public override int NumberOfSections (UICollectionView collectionView)
- {
- return 1;
- }
-
- public override int GetItemsCount (UICollectionView collectionView, int section)
- {
- return items.Count;
- }
-#endif
-
public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
{
var cell = (CollectionViewCell)collectionView.DequeueReusableCell(cellId, indexPath);
@@ -604,5 +563,21 @@ namespace Xamarin.Forms.ControlGallery.iOS
//UITabBar.Appearance.BarTintColor = UIColor.Purple;
}
}
+
+ public class AccessoryViewCellRenderer : ViewCellRenderer
+ {
+ public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
+ {
+ var cell = base.GetCell(item, reusableCell, tv);
+
+ // remove highlight on selected cell
+ cell.SelectionStyle = UITableViewCellSelectionStyle.None;
+
+ // iOS right arrow
+ cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
+
+ return cell;
+ }
+ }
}
diff --git a/Xamarin.Forms.ControlGallery.iOS/Info.plist b/Xamarin.Forms.ControlGallery.iOS/Info.plist
index 97cdf2e7..706d8bb5 100644
--- a/Xamarin.Forms.ControlGallery.iOS/Info.plist
+++ b/Xamarin.Forms.ControlGallery.iOS/Info.plist
@@ -15,7 +15,12 @@
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
- <array/>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
<key>MinimumOSVersion</key>
<string>6.1</string>
<key>CFBundleDisplayName</key>
@@ -97,5 +102,7 @@
</dict>
</dict>
</dict>
+ <key>CFBundleName</key>
+ <string>XamControl</string>
</dict>
</plist>
diff --git a/Xamarin.Forms.ControlGallery.iOS/Main.cs b/Xamarin.Forms.ControlGallery.iOS/Main.cs
index 921c475e..f4834f9b 100644
--- a/Xamarin.Forms.ControlGallery.iOS/Main.cs
+++ b/Xamarin.Forms.ControlGallery.iOS/Main.cs
@@ -1,30 +1,16 @@
using System.Diagnostics;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Xamarin.Forms.Controls;
-#if __UNIFIED__
using UIKit;
-using Foundation;
-#else
-using MonoTouch.UIKit;
-using MonoTouch.Foundation;
-#endif
+using Xamarin.Forms.Controls;
namespace Xamarin.Forms.ControlGallery.iOS
{
public class Application
{
- // This is the main entry point of the application.
- static void Main (string [] args)
+ static void Main(string[] args)
{
- // if you want to use a different Application Delegate class from "AppDelegate"
- // you can specify it here.
- #if __UNIFIED__
if (!Debugger.IsAttached)
- Insights.Initialize (App.InsightsApiKey);
- #endif
- UIApplication.Main (args, null, "AppDelegate");
+ Insights.Initialize(App.InsightsApiKey);
+ UIApplication.Main(args, null, "AppDelegate");
}
}
}
diff --git a/Xamarin.Forms.ControlGallery.iOS/Xamarin.Forms.ControlGallery.iOS.Classic.csproj b/Xamarin.Forms.ControlGallery.iOS/Xamarin.Forms.ControlGallery.iOS.Classic.csproj
deleted file mode 100644
index 5e539bd3..00000000
--- a/Xamarin.Forms.ControlGallery.iOS/Xamarin.Forms.ControlGallery.iOS.Classic.csproj
+++ /dev/null
@@ -1,232 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
- <ProductVersion>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{DEEC5844-D609-4F35-BCF0-5B71C91C8133}</ProjectGuid>
- <ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <OutputType>Exe</OutputType>
- <RootNamespace>Xamarin.Forms.ControlGallery.iOS</RootNamespace>
- <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
- <AssemblyName>XamarinFormsControlGalleryiOS</AssemblyName>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
- <RestorePackages>true</RestorePackages>
- <UseMSBuildEngine>True</UseMSBuildEngine>
- <DefineConstants>_CLASSIC_</DefineConstants>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>classic_bin\iPhoneSimulator\Debug\</OutputPath>
- <BaseIntermediateOutputPath>classic_obj\</BaseIntermediateOutputPath>
- <DefineConstants>DEBUG;HAVE_OPENTK;_CLASSIC_</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <ConsolePause>false</ConsolePause>
- <MtouchLink>SdkOnly</MtouchLink>
- <MtouchDebug>True</MtouchDebug>
- <MtouchSdkVersion>6.1</MtouchSdkVersion>
- <MtouchProfiling>False</MtouchProfiling>
- <MtouchExtraArgs />
- <MtouchFastDev>False</MtouchFastDev>
- <MtouchArch>Default, i386</MtouchArch>
- <MtouchUseLlvm>False</MtouchUseLlvm>
- <MtouchUseThumb>False</MtouchUseThumb>
- <MtouchUseSGen>False</MtouchUseSGen>
- <MtouchUseRefCounting>False</MtouchUseRefCounting>
- <MtouchOptimizePNGs>False</MtouchOptimizePNGs>
- <MtouchSdkVersion>7.0</MtouchSdkVersion>
- <MtouchEnableGenericValueTypeSharing>True</MtouchEnableGenericValueTypeSharing>
- <MtouchI18n />
- <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
- <DebugType>none</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>classic_bin\iPhoneSimulator\Release</OutputPath>
- <BaseIntermediateOutputPath>classic_obj\</BaseIntermediateOutputPath>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <ConsolePause>false</ConsolePause>
- <MtouchLink>None</MtouchLink>
- <DefineConstants>_CLASSIC_</DefineConstants>
- <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>classic_bin\iPhone\Debug</OutputPath>
- <BaseIntermediateOutputPath>classic_obj\</BaseIntermediateOutputPath>
- <DefineConstants>DEBUG;__MOBILE__;__IOS__;_CLASSIC_</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <ConsolePause>false</ConsolePause>
- <MtouchDebug>True</MtouchDebug>
- <CodesignKey>iPhone Developer</CodesignKey>
- <MtouchSdkVersion>8.1</MtouchSdkVersion>
- <IpaPackageName>
- </IpaPackageName>
- <MtouchLink>SdkOnly</MtouchLink>
- <MtouchProfiling>False</MtouchProfiling>
- <MtouchExtraArgs />
- <MtouchFastDev>False</MtouchFastDev>
- <MtouchEnableGenericValueTypeSharing>True</MtouchEnableGenericValueTypeSharing>
- <MtouchArch>Default, ARMv7</MtouchArch>
- <MtouchUseLlvm>False</MtouchUseLlvm>
- <MtouchUseThumb>False</MtouchUseThumb>
- <MtouchUseSGen>False</MtouchUseSGen>
- <MtouchUseRefCounting>False</MtouchUseRefCounting>
- <MtouchOptimizePNGs>True</MtouchOptimizePNGs>
- <MtouchI18n />
- <BuildIpa>true</BuildIpa>
- <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
- <DebugType>none</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>classic_bin\iPhone\Release</OutputPath>
- <BaseIntermediateOutputPath>classic_obj\</BaseIntermediateOutputPath>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <ConsolePause>false</ConsolePause>
- <CodesignKey>iPhone Developer</CodesignKey>
- <DefineConstants>_CLASSIC_</DefineConstants>
- <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
- <DebugType>none</DebugType>
- <Optimize>True</Optimize>
- <OutputPath>classic_bin\iPhone\Ad-Hoc</OutputPath>
- <BaseIntermediateOutputPath>classic_obj\</BaseIntermediateOutputPath>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <ConsolePause>False</ConsolePause>
- <CodesignKey>iPhone Distribution</CodesignKey>
- <DefineConstants>_CLASSIC_</DefineConstants>
- <BuildIpa>True</BuildIpa>
- <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
- <DebugType>none</DebugType>
- <Optimize>True</Optimize>
- <OutputPath>classic_bin\iPhone\AppStore</OutputPath>
- <BaseIntermediateOutputPath>classic_obj\</BaseIntermediateOutputPath>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <ConsolePause>False</ConsolePause>
- <CodesignKey>iPhone Distribution</CodesignKey>
- <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Turkey|iPhoneSimulator'">
- <DebugSymbols>true</DebugSymbols>
- <OutputPath>bin\iPhoneSimulator\Turkey\</OutputPath>
- <DefineConstants>__MOBILE__;__IOS__;DEBUG;HAVE_OPENTK;_CLASSIC_</DefineConstants>
- <DebugType>full</DebugType>
- <PlatformTarget>AnyCPU</PlatformTarget>
- <UseVSHostingProcess>false</UseVSHostingProcess>
- <ErrorReport>prompt</ErrorReport>
- <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
- <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Turkey|iPhone'">
- <DebugSymbols>true</DebugSymbols>
- <OutputPath>bin\iPhone\Turkey\</OutputPath>
- <DefineConstants>__MOBILE__;__IOS__;DEBUG;__MOBILE__;__IOS__;_CLASSIC_</DefineConstants>
- <DebugType>full</DebugType>
- <PlatformTarget>AnyCPU</PlatformTarget>
- <UseVSHostingProcess>false</UseVSHostingProcess>
- <ErrorReport>prompt</ErrorReport>
- <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
- <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhoneSimulator'">
- <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'AppStore|iPhoneSimulator'">
- <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- </PropertyGroup>
- <ItemGroup>
- <Compile Include="BrokenNativeControl.cs" />
- <Compile Include="Main.cs" />
- <Compile Include="AppDelegate.cs" />
- <None Include="app.config" />
- <None Include="Info.plist" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <None Include="packages.config" />
- <Compile Include="CustomRenderers.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\Stubs\Xamarin.Forms.Platform.iOS.Classic\Xamarin.Forms.Platform.iOS.Classic %28Forwarders%29.csproj">
- <Project>{3e443aef-3ec0-48c4-a524-7c6996339e1b}</Project>
- <Name>Xamarin.Forms.Platform.iOS.Classic %28Forwarders%29</Name>
- </ProjectReference>
- <ProjectReference Include="..\Xamarin.Forms.Controls\Xamarin.Forms.Controls.csproj">
- <Project>{cb9c96ce-125c-4a68-b6a1-c3ff1fbf93e1}</Project>
- <Name>Xamarin.Forms.Controls</Name>
- </ProjectReference>
- <ProjectReference Include="..\Xamarin.Forms.Maps.iOS\Xamarin.Forms.Maps.iOS.Classic.csproj">
- <Project>{ca10facd-22ab-463f-a20e-379c212b0858}</Project>
- <Name>Xamarin.Forms.Maps.iOS.Classic</Name>
- </ProjectReference>
- <ProjectReference Include="..\Xamarin.Forms.Maps\Xamarin.Forms.Maps.csproj">
- <Project>{7d13bac2-c6a4-416a-b07e-c169b199e52b}</Project>
- <Name>Xamarin.Forms.Maps</Name>
- </ProjectReference>
- <ProjectReference Include="..\Xamarin.Forms.Platform.iOS\Xamarin.Forms.Platform.iOS.Classic.csproj">
- <Project>{4a47b5df-ddfc-476b-ac41-5105ff3b9b8b}</Project>
- <Name>Xamarin.Forms.Platform.iOS.Classic</Name>
- </ProjectReference>
- <ProjectReference Include="..\Xamarin.Forms.Core\Xamarin.Forms.Core.csproj">
- <Project>{57B8B73D-C3B5-4C42-869E-7B2F17D354AC}</Project>
- <Name>Xamarin.Forms.Core</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <Content Include="bank%402x.png" />
- <Content Include="bank.png" />
- <Content Include="calculator%402x.png" />
- <Content Include="calculator.png" />
- <Content Include="cover1.jpg" />
- <Content Include="crimson.jpg" />
- <Content Include="Default-568h%402x.png" />
- <BundleResource Include="default.css" />
- <Content Include="Entitlements.plist" />
- <Content Include="Goobuntu-icon.png" />
- <Content Include="Intranet-icon.png" />
- <BundleResource Include="Default%402x.png" />
- <BundleResource Include="local.html" />
- <Content Include="oasis.jpg" />
- <BundleResource Include="oasissmall.jpg" />
- <Content Include="coffee%402x.png" />
- <Content Include="settings%402x.png" />
- <Content Include="menuIcon%402x.png" />
- <Content Include="crimsonsmall.jpg" />
- <Content Include="seth%402x.png" />
- <Content Include="cover1small.jpg" />
- <Content Include="menuIcon.png" />
- <Content Include="seth.png" />
- <BundleResource Include="photo.jpg" />
- <BundleResource Include="WebImages\XamarinLogo.png" />
- <BundleResource Include="Images\FlowerBuds.jpg" />
- <BundleResource Include="Images\FlowerBuds%402x.jpg" />
- <BundleResource Include="Images\Fruits.jpg" />
- <BundleResource Include="Images\Fruits%402x.jpg" />
- <BundleResource Include="Images\Legumes.jpg" />
- <BundleResource Include="Images\Legumes%402x.jpg" />
- <BundleResource Include="Images\Vegetables.jpg" />
- <BundleResource Include="Images\Vegetables%402x.jpg" />
- <BundleResource Include="toolbar_close.png" />
- </ItemGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Xml" />
- <Reference Include="System.Core" />
- <Reference Include="monotouch" />
- </ItemGroup>
- <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets" />
- <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
- </Project>
diff --git a/Xamarin.Forms.ControlGallery.iOS/Xamarin.Forms.ControlGallery.iOS.csproj b/Xamarin.Forms.ControlGallery.iOS/Xamarin.Forms.ControlGallery.iOS.csproj
index d3dc36b2..c1ef6f4c 100644
--- a/Xamarin.Forms.ControlGallery.iOS/Xamarin.Forms.ControlGallery.iOS.csproj
+++ b/Xamarin.Forms.ControlGallery.iOS/Xamarin.Forms.ControlGallery.iOS.csproj
@@ -24,10 +24,10 @@
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<MtouchArch>i386, x86_64</MtouchArch>
- <MtouchLink>None</MtouchLink>
+ <MtouchLink>SdkOnly</MtouchLink>
<MtouchDebug>True</MtouchDebug>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
- <MtouchSdkVersion>9.3</MtouchSdkVersion>
+ <MtouchSdkVersion></MtouchSdkVersion>
<MtouchProfiling>False</MtouchProfiling>
<MtouchFastDev>False</MtouchFastDev>
<MtouchEnableGenericValueTypeSharing>True</MtouchEnableGenericValueTypeSharing>
@@ -69,7 +69,7 @@
<MtouchDebug>True</MtouchDebug>
<CodesignEntitlements>
</CodesignEntitlements>
- <MtouchSdkVersion>8.1</MtouchSdkVersion>
+ <MtouchSdkVersion></MtouchSdkVersion>
<MtouchLink>SdkOnly</MtouchLink>
<MtouchProfiling>False</MtouchProfiling>
<MtouchExtraArgs />
@@ -131,7 +131,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Turkey|iPhoneSimulator'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\iPhoneSimulator\Turkey\</OutputPath>
- <DefineConstants>__UNIFIED__;__MOBILE__;__IOS__;DEBUG</DefineConstants>
+ <DefineConstants>__MOBILE__;__IOS__;DEBUG</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
@@ -235,20 +235,21 @@
<BundleResource Include="test.jpg" />
</ItemGroup>
<ItemGroup>
- <Reference Include="PLCrashReporterUnifiedBinding, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
- <HintPath>..\packages\Xamarin.Insights.1.11.4\lib\Xamarin.iOS10\PLCrashReporterUnifiedBinding.dll</HintPath>
- <Private>True</Private>
- </Reference>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
- <Reference Include="Xamarin.Insights, Version=1.11.0.0, Culture=neutral, processorArchitecture=MSIL">
- <HintPath>..\packages\Xamarin.Insights.1.11.4\lib\Xamarin.iOS10\Xamarin.Insights.dll</HintPath>
- <Private>True</Private>
- </Reference>
<Reference Include="Xamarin.iOS" />
+ <Reference Include="AdvancedColorPicker">
+ <HintPath>..\Components\advancedcolorpicker-2.0\lib\ios-unified\AdvancedColorPicker.dll</HintPath>
+ </Reference>
+ <Reference Include="PLCrashReporterUnifiedBinding">
+ <HintPath>..\packages\Xamarin.Insights.1.12.3\lib\Xamarin.iOS10\PLCrashReporterUnifiedBinding.dll</HintPath>
+ </Reference>
+ <Reference Include="Xamarin.Insights">
+ <HintPath>..\packages\Xamarin.Insights.1.12.3\lib\Xamarin.iOS10\Xamarin.Insights.dll</HintPath>
+ </Reference>
<Reference Include="Calabash">
- <HintPath>..\packages\Xamarin.TestCloud.Agent.0.19.1\lib\Xamarin.iOS10\Calabash.dll</HintPath>
+ <HintPath>..\packages\Xamarin.TestCloud.Agent.0.20.0\lib\Xamarin.iOS10\Calabash.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
@@ -258,7 +259,13 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
- <Error Condition="!Exists('..\packages\Xamarin.Insights.1.11.4\build\Xamarin.iOS10\Xamarin.Insights.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Insights.1.11.4\build\Xamarin.iOS10\Xamarin.Insights.targets'))" />
</Target>
<ItemGroup />
+ <ItemGroup>
+ <XamarinComponentReference Include="advancedcolorpicker">
+ <Version>2.0</Version>
+ <Visible>False</Visible>
+ </XamarinComponentReference>
+ </ItemGroup>
+ <Import Project="..\packages\Xamarin.Insights.1.12.3\build\Xamarin.iOS10\Xamarin.Insights.targets" Condition="Exists('..\packages\Xamarin.Insights.1.12.3\build\Xamarin.iOS10\Xamarin.Insights.targets')" />
</Project> \ No newline at end of file
diff --git a/Xamarin.Forms.ControlGallery.iOS/packages.config b/Xamarin.Forms.ControlGallery.iOS/packages.config
index c372c5ec..6cc3225e 100644
--- a/Xamarin.Forms.ControlGallery.iOS/packages.config
+++ b/Xamarin.Forms.ControlGallery.iOS/packages.config
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Xamarin.Insights" version="1.11.4" targetFramework="xamarinios10" />
- <package id="Xamarin.TestCloud.Agent" version="0.19.1" targetFramework="xamarinios10" />
-</packages>
+ <package id="Xamarin.Insights" version="1.12.3" targetFramework="xamarinios10" />
+ <package id="Xamarin.TestCloud.Agent" version="0.20.0" targetFramework="xamarinios10" />
+</packages> \ No newline at end of file
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla43161.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla43161.cs
new file mode 100644
index 00000000..3a45cc84
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla43161.cs
@@ -0,0 +1,65 @@
+using Xamarin.Forms.CustomAttributes;
+using Xamarin.Forms.Internals;
+using System.Linq;
+
+#if UITEST
+using Xamarin.UITest;
+using NUnit.Framework;
+#endif
+
+namespace Xamarin.Forms.Controls
+{
+
+ [Preserve(AllMembers = true)]
+ [Issue(IssueTracker.Bugzilla, 43161, "[iOS] Setting Accessory in ViewCellRenderer breaks layout", PlatformAffected.iOS)]
+ public class Bugzilla43161 : TestContentPage
+ {
+ const string Instructions = "On iOS, all three of the following ListViews should have ListItems labeled with numbers and a right arrow. If any of the ListViews does not contain numbers, this test has failed.";
+ const string ListView1 = "Accessory with Context Actions";
+ const string ListView2 = "Accessory with RecycleElement";
+ const string ListView3 = "Accessory with RetainElement";
+
+ public class AccessoryViewCell : ViewCell
+ {
+ public AccessoryViewCell()
+ {
+ var label = new Label();
+ label.SetBinding(Label.TextProperty, ".");
+ View = label;
+ }
+ }
+
+ public class AccessoryViewCellWithContextActions : AccessoryViewCell
+ {
+ public AccessoryViewCellWithContextActions()
+ {
+ var label = new Label();
+ label.SetBinding(Label.TextProperty, ".");
+ View = label;
+
+ var delete = new MenuItem { Text = "Delete" };
+ ContextActions.Add(delete);
+ }
+ }
+
+ protected override void Init()
+ {
+ var label = new Label { Text = Instructions };
+ var listView = new ListView { ItemTemplate = new DataTemplate(typeof(AccessoryViewCellWithContextActions)), ItemsSource = Enumerable.Range(0, 9), Header = ListView1 };
+ var listView2 = new ListView(ListViewCachingStrategy.RecycleElement) { ItemTemplate = new DataTemplate(typeof(AccessoryViewCell)), ItemsSource = Enumerable.Range(10, 19), Header = ListView2 };
+ var listView3 = new ListView { ItemTemplate = new DataTemplate(typeof(AccessoryViewCell)), ItemsSource = Enumerable.Range(20, 29), Header = ListView3 };
+
+ Content = new StackLayout { Children = { label, listView, listView2, listView3 } };
+ }
+
+#if (UITEST && __IOS__)
+ [Test]
+ public void Bugzilla43161Test()
+ {
+ RunningApp.WaitForElement(q => q.Marked("0"));
+ RunningApp.WaitForElement(q => q.Marked("10"));
+ RunningApp.WaitForElement(q => q.Marked("20"));
+ }
+#endif
+ }
+}
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/TestPages/ScreenshotConditionalApp.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/TestPages/ScreenshotConditionalApp.cs
index cc98b5d1..7a311466 100644
--- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/TestPages/ScreenshotConditionalApp.cs
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/TestPages/ScreenshotConditionalApp.cs
@@ -73,6 +73,11 @@ namespace Xamarin.Forms.Controls
_app.EnterText(query, text);
}
+ public void ClearText(Func<AppQuery, AppWebQuery> query)
+ {
+ _app.ClearText(query);
+ }
+
public void ClearText(Func<AppQuery, AppQuery> query)
{
_app.ClearText(query);
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
index adf173df..364b3c44 100644
--- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
@@ -181,6 +181,7 @@
<Compile Include="$(MSBuildThisFileDirectory)ImageLoadingErrorHandling.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla33561.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla43214.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla43161.cs" />
<Compile Include="$(MSBuildThisFileDirectory)_Template.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue1028.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue1075.cs" />
diff --git a/Xamarin.Forms.Controls/ControlGalleryPages/NativeBindingGalleryPage.cs b/Xamarin.Forms.Controls/ControlGalleryPages/NativeBindingGalleryPage.cs
new file mode 100644
index 00000000..51d9b970
--- /dev/null
+++ b/Xamarin.Forms.Controls/ControlGalleryPages/NativeBindingGalleryPage.cs
@@ -0,0 +1,101 @@
+using System;
+using Xamarin.Forms.Internals;
+
+namespace Xamarin.Forms.Controls
+{
+ public class NativeBindingGalleryPage : ContentPage
+ {
+ public StackLayout Layout { get; set; }
+ public bool NativeControlsAdded { get; set; }
+
+ NestedNativeViewModel ViewModel { get; set; }
+
+ public NativeBindingGalleryPage()
+ {
+
+ var vm = new NestedNativeViewModel();
+ vm.FormsLabel = "Forms Label Binding";
+ vm.NativeLabel = "Native Label Binding";
+ vm.NativeLabelColor = Color.Red;
+ vm.Age = 45;
+
+ Layout = new StackLayout { Padding = 20, VerticalOptions = LayoutOptions.FillAndExpand };
+
+ var buttonNav = new Button { Text = "New Page" };
+ buttonNav.Clicked += (object sender, EventArgs e) =>
+ {
+ App.Current.MainPage = new ContentPage { Content = new Label { Text = "New page" } };
+ };
+
+ var button = new Button { Text = "Change BindingContext " };
+ button.Clicked += (object sender, EventArgs e) =>
+ {
+ vm = new NestedNativeViewModel();
+ vm.FormsLabel = "Forms Label Binding Changed";
+ vm.NativeLabel = "Native Label Binding Changed";
+ vm.NativeLabelColor = Color.Pink;
+ vm.Age = 10;
+
+ BindingContext = ViewModel = vm; ;
+ };
+
+ var boxView = new BoxView { HeightRequest = 50 };
+ boxView.SetBinding(BoxView.BackgroundColorProperty, "NativeLabelColor");
+
+ var label = new Label();
+ label.SetBinding(Label.TextProperty, "FormsLabel");
+
+ Layout.Children.Add(buttonNav);
+
+ Layout.Children.Add(label);
+
+ Layout.Children.Add(boxView);
+ Layout.Children.Add(button);
+
+ BindingContext = ViewModel = vm; ;
+
+ Content = new ScrollView { Content = Layout };
+ }
+ }
+
+
+ [Preserve(AllMembers = true)]
+ public class NestedNativeViewModel : ViewModelBase
+ {
+ string _formsLabel;
+ public string FormsLabel
+ {
+ get { return _formsLabel; }
+ set { _formsLabel = value; OnPropertyChanged(); }
+ }
+
+ string _nativeLabel;
+ public string NativeLabel
+ {
+ get { return _nativeLabel; }
+ set { _nativeLabel = value; OnPropertyChanged(); }
+ }
+
+ Color _nativeLabelColor;
+ public Color NativeLabelColor
+ {
+ get { return _nativeLabelColor; }
+ set { _nativeLabelColor = value; OnPropertyChanged(); }
+ }
+
+ int _age;
+ public int Age
+ {
+ get { return _age; }
+ set { _age = value; OnPropertyChanged(); }
+ }
+
+ bool _selected;
+ public bool Selected
+ {
+ get { return _selected; }
+ set { _selected = value; OnPropertyChanged(); }
+ }
+ }
+
+}
diff --git a/Xamarin.Forms.Controls/CoreGallery.cs b/Xamarin.Forms.Controls/CoreGallery.cs
index 7986a45c..a7743400 100644
--- a/Xamarin.Forms.Controls/CoreGallery.cs
+++ b/Xamarin.Forms.Controls/CoreGallery.cs
@@ -221,6 +221,8 @@ namespace Xamarin.Forms.Controls
{
var pages = new List<Page> {
new PlatformSpecificsGallery() {Title = "Platform Specifics"},
+ new NativeBindingGalleryPage {Title = "Native Binding Controls Gallery"},
+ new XamlNativeViews {Title = "Xaml Native Views Gallery"},
new AppLinkPageGallery {Title = "App Link Page Gallery"},
new NestedNativeControlGalleryPage {Title = "Nested Native Controls Gallery"},
new CellForceUpdateSizeGalleryPage {Title = "Cell Force Update Size Gallery"},
@@ -446,4 +448,4 @@ namespace Xamarin.Forms.Controls
return new CoreNavigationPage ();
}
}
-} \ No newline at end of file
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/XamlNativeViews.xaml b/Xamarin.Forms.Controls/GalleryPages/XamlNativeViews.xaml
new file mode 100644
index 00000000..142c33b2
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/XamlNativeViews.xaml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ xmlns:ios="clr-namespace:UIKit;assembly=Xamarin.iOS;targetPlatform=iOS"
+ xmlns:androidWidget="clr-namespace:Android.Widget;assembly=Mono.Android;targetPlatform=Android"
+ xmlns:formsandroid="clr-namespace:Xamarin.Forms;assembly=Xamarin.Forms.Platform.Android;targetPlatform=Android"
+ xmlns:win="clr-namespace:Windows.UI.Xaml.Controls;assembly=Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime;targetPlatform=Windows"
+ x:Class="Xamarin.Forms.Controls.XamlNativeViews">
+ <ContentPage.Content>
+ <ios:UILabel Text="{Binding NativeText}" View.HorizontalOptions="Start"/>
+ <androidWidget:TextView Text="{Binding NativeText}" x:Arguments="{x:Static formsandroid:Forms.Context}" />
+ <win:TextBlock Text="{Binding NativeText}"/>
+ </ContentPage.Content>
+</ContentPage> \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/GalleryPages/XamlNativeViews.xaml.cs b/Xamarin.Forms.Controls/GalleryPages/XamlNativeViews.xaml.cs
new file mode 100644
index 00000000..1e40fdb7
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/XamlNativeViews.xaml.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+
+using Xamarin.Forms;
+
+namespace Xamarin.Forms.Controls
+{
+ public partial class XamlNativeViews : ContentPage
+ {
+ public XamlNativeViews()
+ {
+ InitializeComponent();
+ BindingContext = new VM { NativeText = "Text set to Native view using native binding" };
+ }
+ }
+
+ public class VM
+ {
+ public string NativeText { get; set; }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj b/Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj
index 865b7ea9..200e5f8a 100644
--- a/Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj
+++ b/Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj
@@ -11,7 +11,7 @@
<RootNamespace>Xamarin.Forms.Controls</RootNamespace>
<AssemblyName>Xamarin.Forms.Controls</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <TargetFrameworkProfile Condition=" '$(OS)' != 'Unix' ">Profile259</TargetFrameworkProfile>
+ <TargetFrameworkProfile>Profile259</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
@@ -235,12 +235,12 @@
<Compile Include="ControlGalleryPages\AppearingGalleryPage.cs" />
<Compile Include="ControlGalleryPages\AutomationIDGallery.cs" />
<Compile Include="GalleryPages\AppLinkPageGallery.cs" />
+ <Compile Include="ControlGalleryPages\NativeBindingGalleryPage.cs" />
+ <Compile Include="GalleryPages\XamlNativeViews.xaml.cs">
+ <DependentUpon>XamlNativeViews.xaml</DependentUpon>
+ </Compile>
</ItemGroup>
- <Import Condition=" '$(OS)' != 'Unix' " Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
- <Import Condition=" '$(OS)' == 'Unix' " Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <ItemGroup Condition=" '$(OS)' == 'Unix' ">
- <Reference Include="System" />
- </ItemGroup>
+ <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="..\.nuspec\Xamarin.Forms.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
@@ -260,6 +260,9 @@
<EmbeddedResource Include="GalleryPages\StyleXamlGallery.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
+ <EmbeddedResource Include="GalleryPages\XamlNativeViews.xaml">
+ <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+ </EmbeddedResource>
</ItemGroup>
<Import Project="..\Xamarin.Forms.Controls.Issues\Xamarin.Forms.Controls.Issues.Shared\Xamarin.Forms.Controls.Issues.Shared.projitems" Label="Shared" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
@@ -269,7 +272,6 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
- <Error Condition="!Exists('..\packages\Xamarin.Insights.1.11.4\build\portable-win+net45+wp80+windows8+wpa+MonoAndroid10+MonoTouch10\Xamarin.Insights.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Insights.1.11.4\build\portable-win+net45+wp80+windows8+wpa+MonoAndroid10+MonoTouch10\Xamarin.Insights.targets'))" />
</Target>
<ItemGroup>
<EmbeddedResource Include="ControlGalleryPages\LayoutAddPerformance.xaml">
@@ -284,12 +286,6 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
- <Reference Include="Xamarin.Insights, Version=1.11.0.0, Culture=neutral, processorArchitecture=MSIL">
- <HintPath>..\packages\Xamarin.Insights.1.11.4\lib\portable-win+net45+wp80+windows8+wpa+MonoAndroid10+MonoTouch10\Xamarin.Insights.dll</HintPath>
- <Private>True</Private>
- </Reference>
- </ItemGroup>
- <ItemGroup>
<None Include="app.config" />
<EmbeddedResource Include="controlgallery.config" />
<None Include="packages.config" />
@@ -304,11 +300,16 @@
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
- <Import Project="..\packages\Xamarin.Insights.1.11.4\build\portable-win+net45+wp80+windows8+wpa+MonoAndroid10+MonoTouch10\Xamarin.Insights.targets" Condition="Exists('..\packages\Xamarin.Insights.1.11.4\build\portable-win+net45+wp80+windows8+wpa+MonoAndroid10+MonoTouch10\Xamarin.Insights.targets')" />
+ <ItemGroup>
+ <Reference Include="Xamarin.Insights">
+ <HintPath>..\packages\Xamarin.Insights.1.12.3\lib\portable-win+net45+wp80+windows8+wpa+MonoAndroid10+MonoTouch10\Xamarin.Insights.dll</HintPath>
+ </Reference>
+ </ItemGroup>
<Target Name="BeforeBuild">
<CreateItem Include="blank.config">
<Output TaskParameter="Include" ItemName="ConfigFile" />
</CreateItem>
<Copy SourceFiles="@(ConfigFile)" DestinationFiles="controlgallery.config" Condition="!Exists('controlgallery.config')" />
</Target>
-</Project> \ No newline at end of file
+ <Import Project="..\packages\Xamarin.Insights.1.12.3\build\portable-win+net45+wp80+windows8+wpa+MonoAndroid10+MonoTouch10\Xamarin.Insights.targets" Condition="Exists('..\packages\Xamarin.Insights.1.12.3\build\portable-win+net45+wp80+windows8+wpa+MonoAndroid10+MonoTouch10\Xamarin.Insights.targets')" />
+</Project>
diff --git a/Xamarin.Forms.Controls/packages.config b/Xamarin.Forms.Controls/packages.config
index 7692cf94..d5db6b31 100644
--- a/Xamarin.Forms.Controls/packages.config
+++ b/Xamarin.Forms.Controls/packages.config
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Xamarin.Insights" version="1.11.4" targetFramework="portable45-net45+win8+wp8+wpa81" />
+ <package id="Xamarin.Insights" version="1.12.3" targetFramework="portable45-net45+win8+wp8+wpa81" />
</packages> \ No newline at end of file
diff --git a/Xamarin.Forms.Core.Android.UITests/Xamarin.Forms.Core.Android.UITests.csproj b/Xamarin.Forms.Core.Android.UITests/Xamarin.Forms.Core.Android.UITests.csproj
index ee73cf87..789433b5 100644
--- a/Xamarin.Forms.Core.Android.UITests/Xamarin.Forms.Core.Android.UITests.csproj
+++ b/Xamarin.Forms.Core.Android.UITests/Xamarin.Forms.Core.Android.UITests.csproj
@@ -58,7 +58,7 @@
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="Xamarin.UITest">
- <HintPath>..\packages\Xamarin.UITest.1.3.8\lib\Xamarin.UITest.dll</HintPath>
+ <HintPath>..\packages\Xamarin.UITest.2.0.0-beta02\lib\Xamarin.UITest.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
diff --git a/Xamarin.Forms.Core.Android.UITests/packages.config b/Xamarin.Forms.Core.Android.UITests/packages.config
index bd8e626b..bae38c6e 100644
--- a/Xamarin.Forms.Core.Android.UITests/packages.config
+++ b/Xamarin.Forms.Core.Android.UITests/packages.config
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NUnit" version="2.6.4" targetFramework="net45" />
- <package id="Xamarin.UITest" version="1.3.8" targetFramework="net45" />
+ <package id="Xamarin.UITest" version="2.0.0-beta02" targetFramework="net45" />
</packages> \ No newline at end of file
diff --git a/Xamarin.Forms.Core.UnitTests/ButtonUnitTest.cs b/Xamarin.Forms.Core.UnitTests/ButtonUnitTest.cs
index 78d97a86..d590f8c3 100644
--- a/Xamarin.Forms.Core.UnitTests/ButtonUnitTest.cs
+++ b/Xamarin.Forms.Core.UnitTests/ButtonUnitTest.cs
@@ -202,4 +202,4 @@ namespace Xamarin.Forms.Core.UnitTests
Assert.AreEqual(layout1.Spacing, bcl.Spacing);
}
}
-}
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Core.UnitTests/NativeBindingTests.cs b/Xamarin.Forms.Core.UnitTests/NativeBindingTests.cs
new file mode 100644
index 00000000..c13608d8
--- /dev/null
+++ b/Xamarin.Forms.Core.UnitTests/NativeBindingTests.cs
@@ -0,0 +1,496 @@
+using System;
+using System.Collections.Generic;
+using NUnit.Framework;
+using System.ComponentModel;
+using System.Globalization;
+
+namespace Xamarin.Forms.Core.UnitTests
+{
+ public class MockNativeView
+ {
+ public IList<MockNativeView> SubViews { get; set; }
+ public string Foo { get; set; }
+ public int Bar { get; set; }
+ public string Baz { get; set; }
+
+ string cantBeNull = "";
+ public string CantBeNull {
+ get { return cantBeNull; }
+ set {
+ if (value == null)
+ throw new NullReferenceException();
+ cantBeNull = value;
+ }
+ }
+
+ public void FireBazChanged()
+ {
+ BazChanged?.Invoke(this, new TappedEventArgs(null));
+ }
+
+ public event EventHandler<TappedEventArgs> BazChanged;
+
+ public event EventHandler SelectedColorChanged;
+
+ MockNativeColor _selectedColor;
+ public MockNativeColor SelectedColor
+ {
+ get { return _selectedColor; }
+ set
+ {
+ if (_selectedColor == value)
+ return;
+ _selectedColor = value;
+ SelectedColorChanged?.Invoke(this, EventArgs.Empty);
+ }
+ }
+
+ }
+
+ class MockNativeViewWrapper : View
+ {
+ public MockNativeView NativeView { get; }
+
+ public MockNativeViewWrapper(MockNativeView nativeView)
+ {
+ NativeView = nativeView;
+ nativeView.TransferbindablePropertiesToWrapper(this);
+ }
+
+ protected override void OnBindingContextChanged()
+ {
+ NativeView.SetBindingContext(BindingContext, nv => nv.SubViews);
+ base.OnBindingContextChanged();
+ }
+ }
+
+ public class MockNativeColor
+ {
+
+ public MockNativeColor(Color color)
+ {
+ FormsColor = color;
+ }
+
+ public Color FormsColor
+ {
+ get;
+ set;
+ }
+ }
+
+ public static class MockNativeViewExtensions
+ {
+ public static View ToView(this MockNativeView nativeView)
+ {
+ return new MockNativeViewWrapper(nativeView);
+ }
+
+ public static void SetBinding(this MockNativeView target, string targetProperty, BindingBase binding, string updateSourceEventName = null)
+ {
+ NativeBindingHelpers.SetBinding(target, targetProperty, binding, updateSourceEventName);
+ }
+
+ internal static void SetBinding(this MockNativeView target, string targetProperty, BindingBase binding, INotifyPropertyChanged propertyChanged)
+ {
+ NativeBindingHelpers.SetBinding(target, targetProperty, binding, propertyChanged);
+ }
+
+ public static void SetBinding(this MockNativeView target, BindableProperty targetProperty, BindingBase binding)
+ {
+ NativeBindingHelpers.SetBinding(target, targetProperty, binding);
+ }
+
+ public static void SetValue(this MockNativeView target, BindableProperty targetProperty, object value)
+ {
+ NativeBindingHelpers.SetValue(target, targetProperty, value);
+ }
+
+ public static void SetBindingContext(this MockNativeView target, object bindingContext, Func<MockNativeView, IEnumerable<MockNativeView>> getChild = null)
+ {
+ NativeBindingHelpers.SetBindingContext(target, bindingContext, getChild);
+ }
+
+ internal static void TransferbindablePropertiesToWrapper(this MockNativeView target, MockNativeViewWrapper wrapper)
+ {
+ NativeBindingHelpers.TransferBindablePropertiesToWrapper(target, wrapper);
+ }
+ }
+
+ class MockCustomColorConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value is Color)
+ return new MockNativeColor((Color)value);
+ return value;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value is MockNativeColor)
+ return ((MockNativeColor)value).FormsColor;
+ return value;
+ }
+ }
+
+ class MockINPC : INotifyPropertyChanged
+ {
+ public void FireINPC(object sender, string propertyName)
+ {
+ PropertyChanged?.Invoke(sender, new PropertyChangedEventArgs(propertyName));
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+ }
+
+ class MockVMForNativeBinding : INotifyPropertyChanged
+ {
+ string fFoo;
+ public string FFoo {
+ get { return fFoo; }
+ set {
+ fFoo = value;
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("FFoo"));
+ }
+ }
+
+ int bBar;
+ public int BBar {
+ get { return bBar; }
+ set {
+ bBar = value;
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("BBar"));
+ }
+ }
+
+ Color cColor;
+ public Color CColor
+ {
+ get { return cColor; }
+ set
+ {
+ if (cColor == value)
+ return;
+ cColor = value;
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("CColor"));
+ }
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+ }
+
+ [TestFixture]
+ public class NativeBindingTests
+ {
+ [SetUp]
+ public void SetUp()
+ {
+ Device.PlatformServices = new MockPlatformServices();
+
+ //this should collect the ConditionalWeakTable
+ GC.Collect();
+ }
+
+ [Test]
+ public void SetOneWayBinding()
+ {
+ var nativeView = new MockNativeView();
+ Assert.AreEqual(null, nativeView.Foo);
+ Assert.AreEqual(0, nativeView.Bar);
+
+ nativeView.SetBinding("Foo", new Binding("FFoo", mode:BindingMode.OneWay));
+ nativeView.SetBinding("Bar", new Binding("BBar", mode:BindingMode.OneWay));
+ Assert.AreEqual(null, nativeView.Foo);
+ Assert.AreEqual(0, nativeView.Bar);
+
+ nativeView.SetBindingContext(new { FFoo = "Foo", BBar = 42 });
+ Assert.AreEqual("Foo", nativeView.Foo);
+ Assert.AreEqual(42, nativeView.Bar);
+ }
+
+ [Test]
+ public void AttachedPropertiesAreTransferredFromTheBackpack()
+ {
+ var nativeView = new MockNativeView();
+ nativeView.SetValue(Grid.ColumnProperty, 3);
+ nativeView.SetBinding(Grid.RowProperty, new Binding("foo"));
+
+ var view = nativeView.ToView();
+ view.BindingContext = new { foo = 42 };
+ Assert.AreEqual(3, view.GetValue(Grid.ColumnProperty));
+ Assert.AreEqual(42, view.GetValue(Grid.RowProperty));
+ }
+
+ [Test]
+ public void Set2WayBindings()
+ {
+ var nativeView = new MockNativeView();
+ Assert.AreEqual(null, nativeView.Foo);
+ Assert.AreEqual(0, nativeView.Bar);
+
+ var vm = new MockVMForNativeBinding();
+ nativeView.SetBindingContext(vm);
+ var inpc = new MockINPC();
+ nativeView.SetBinding("Foo", new Binding("FFoo", mode:BindingMode.TwoWay), inpc);
+ nativeView.SetBinding("Bar", new Binding("BBar", mode:BindingMode.TwoWay), inpc);
+ Assert.AreEqual(null, nativeView.Foo);
+ Assert.AreEqual(0, nativeView.Bar);
+ Assert.AreEqual(null, vm.FFoo);
+ Assert.AreEqual(0, vm.BBar);
+
+ nativeView.Foo = "oof";
+ inpc.FireINPC(nativeView, "Foo");
+ nativeView.Bar = -42;
+ inpc.FireINPC(nativeView, "Bar");
+ Assert.AreEqual("oof", nativeView.Foo);
+ Assert.AreEqual(-42, nativeView.Bar);
+ Assert.AreEqual("oof", vm.FFoo);
+ Assert.AreEqual(-42, vm.BBar);
+
+ vm.FFoo = "foo";
+ vm.BBar = 42;
+ Assert.AreEqual("foo", nativeView.Foo);
+ Assert.AreEqual(42, nativeView.Bar);
+ Assert.AreEqual("foo", vm.FFoo);
+ Assert.AreEqual(42, vm.BBar);
+ }
+
+ [Test]
+ public void Set2WayBindingsWithUpdateSourceEvent()
+ {
+ var nativeView = new MockNativeView();
+ Assert.AreEqual(null, nativeView.Baz);
+
+ var vm = new MockVMForNativeBinding();
+ nativeView.SetBindingContext(vm);
+
+ nativeView.SetBinding("Baz", new Binding("FFoo", mode: BindingMode.TwoWay), "BazChanged");
+ Assert.AreEqual(null, nativeView.Baz);
+ Assert.AreEqual(null, vm.FFoo);
+
+ nativeView.Baz = "oof";
+ nativeView.FireBazChanged();
+ Assert.AreEqual("oof", nativeView.Baz);
+ Assert.AreEqual("oof", vm.FFoo);
+
+ vm.FFoo = "foo";
+ Assert.AreEqual("foo", nativeView.Baz);
+ Assert.AreEqual("foo", vm.FFoo);
+ }
+
+ [Test]
+ public void Set2WayBindingsWithUpdateSourceEventInBindingObject()
+ {
+ var nativeView = new MockNativeView();
+ Assert.AreEqual(null, nativeView.Baz);
+
+ var vm = new MockVMForNativeBinding();
+ nativeView.SetBindingContext(vm);
+
+ nativeView.SetBinding("Baz", new Binding("FFoo", mode: BindingMode.TwoWay) { UpdateSourceEventName = "BazChanged"});
+ Assert.AreEqual(null, nativeView.Baz);
+ Assert.AreEqual(null, vm.FFoo);
+
+ nativeView.Baz = "oof";
+ nativeView.FireBazChanged();
+ Assert.AreEqual("oof", nativeView.Baz);
+ Assert.AreEqual("oof", vm.FFoo);
+
+ vm.FFoo = "foo";
+ Assert.AreEqual("foo", nativeView.Baz);
+ Assert.AreEqual("foo", vm.FFoo);
+ }
+
+ [Test]
+ public void NativeViewsAreCollected()
+ {
+ WeakReference wr = null;
+
+ int i = 0;
+ Action create = null;
+ create = () => {
+ if (i++ < 1024) {
+ create();
+ return;
+ }
+
+ var nativeView = new MockNativeView();
+ nativeView.SetBinding("fooBar", new Binding("Foo", BindingMode.TwoWay));
+ nativeView.SetBinding("Baz", new Binding("Qux", BindingMode.TwoWay), "BazChanged");
+
+ wr = new WeakReference(nativeView);
+ nativeView = null;
+
+ };
+
+ create();
+
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ GC.Collect();
+
+ Assert.False(wr.IsAlive);
+ }
+
+ [Test]
+ public void ProxiesAreCollected()
+ {
+ WeakReference wr = null;
+
+ int i = 0;
+ Action create = null;
+ create = () => {
+ if (i++ < 1024) {
+ create();
+ return;
+ }
+
+ var nativeView = new MockNativeView();
+ nativeView.SetBinding("fooBar", new Binding("Foo", BindingMode.TwoWay));
+ nativeView.SetBinding("Baz", new Binding("Qux", BindingMode.TwoWay), "BazChanged");
+
+ NativeBindingHelpers.BindableObjectProxy<MockNativeView> proxy;
+ if (!NativeBindingHelpers.BindableObjectProxy<MockNativeView>.BindableObjectProxies.TryGetValue(nativeView, out proxy))
+ Assert.Fail();
+
+ wr = new WeakReference(proxy);
+ nativeView = null;
+ };
+
+ create();
+
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ GC.Collect();
+
+ Assert.False(wr.IsAlive);
+ }
+
+ [Test]
+ public void SetBindingContextToSubviews()
+ {
+ var nativeView = new MockNativeView { SubViews = new List<MockNativeView> ()};
+ var nativeViewChild = new MockNativeView();
+
+ nativeViewChild.SetBinding("Foo", new Binding("FFoo", mode: BindingMode.OneWay));
+ nativeViewChild.SetBinding("Bar", new Binding("BBar", mode: BindingMode.OneWay));
+
+ nativeView.SubViews.Add(nativeViewChild);
+
+ var vm = new MockVMForNativeBinding();
+ nativeView.SetBindingContext(vm, v => v.SubViews);
+
+ Assert.AreEqual(null, nativeViewChild.Foo);
+ Assert.AreEqual(0, nativeViewChild.Bar);
+
+ nativeView.SetBindingContext(new { FFoo = "Foo", BBar = 42 }, v => v.SubViews);
+ Assert.AreEqual("Foo", nativeViewChild.Foo);
+ Assert.AreEqual(42, nativeViewChild.Bar);
+ }
+
+ [Test]
+ public void TestConverterDoesNotThrow()
+ {
+ var nativeView = new MockNativeView();
+ Assert.AreEqual(null, nativeView.Foo);
+ Assert.AreEqual(0, nativeView.Bar);
+ var vm = new MockVMForNativeBinding();
+ var converter = new MockCustomColorConverter();
+ nativeView.SetBinding("SelectedColor", new Binding("CColor", converter: converter));
+ Assert.DoesNotThrow(() => nativeView.SetBindingContext(vm));
+ }
+
+ [Test]
+ public void TestConverterWorks()
+ {
+ var nativeView = new MockNativeView();
+ Assert.AreEqual(null, nativeView.Foo);
+ Assert.AreEqual(0, nativeView.Bar);
+ var vm = new MockVMForNativeBinding();
+ vm.CColor = Color.Red;
+ var converter = new MockCustomColorConverter();
+ nativeView.SetBinding("SelectedColor", new Binding("CColor", converter: converter));
+ nativeView.SetBindingContext(vm);
+ Assert.AreEqual(vm.CColor, nativeView.SelectedColor.FormsColor);
+ }
+
+ [Test]
+ public void TestConverter2WayWorks()
+ {
+ var nativeView = new MockNativeView();
+ Assert.AreEqual(null, nativeView.Foo);
+ Assert.AreEqual(0, nativeView.Bar);
+ var inpc = new MockINPC();
+ var vm = new MockVMForNativeBinding();
+ vm.CColor = Color.Red;
+ var converter = new MockCustomColorConverter();
+ nativeView.SetBinding("SelectedColor", new Binding("CColor", BindingMode.TwoWay, converter), inpc);
+ nativeView.SetBindingContext(vm);
+ Assert.AreEqual(vm.CColor, nativeView.SelectedColor.FormsColor);
+
+ var newFormsColor = Color.Blue;
+ var newColor = new MockNativeColor(newFormsColor);
+ nativeView.SelectedColor = newColor;
+ inpc.FireINPC(nativeView, nameof(nativeView.SelectedColor));
+
+ Assert.AreEqual(newFormsColor, vm.CColor);
+
+ }
+
+ [Test]
+ public void Binding2WayWithConvertersDoNotLoop()
+ {
+ var nativeView = new MockNativeView();
+ int count = 0;
+
+ nativeView.SelectedColorChanged += (o, e) => {
+ if (++count > 5)
+ Assert.Fail("Probable loop detected");
+ };
+
+ var vm = new MockVMForNativeBinding { CColor = Color.Red };
+
+ nativeView.SetBinding("SelectedColor", new Binding("CColor", BindingMode.TwoWay, new MockCustomColorConverter()), "SelectedColorChanged");
+ nativeView.SetBindingContext(vm);
+
+ Assert.AreEqual(count, 1);
+ }
+
+ [Test]
+ public void ThrowsOnMissingProperty()
+ {
+ var nativeView = new MockNativeView();
+ nativeView.SetBinding("Qux", new Binding("Foo"));
+ Assert.Throws<InvalidOperationException>(()=>nativeView.SetBindingContext(new { Foo = 42 }));
+ }
+
+ [Test]
+ public void ThrowsOnMissingEvent()
+ {
+ var nativeView = new MockNativeView();
+ Assert.Throws<ArgumentException>(()=>nativeView.SetBinding("Foo", new Binding("Foo", BindingMode.TwoWay), "missingEvent"));
+ }
+
+ [Test]
+ public void OneWayToSourceAppliedOnSetBC()
+ {
+ var nativeView = new MockNativeView { Foo = "foobar" };
+ nativeView.SetBinding("Foo", new Binding("FFoo", BindingMode.OneWayToSource));
+ var vm = new MockVMForNativeBinding { FFoo = "qux" };
+ nativeView.SetBindingContext(vm);
+ Assert.AreEqual("foobar", vm.FFoo);
+ }
+
+ [Test]
+ public void DoNotApplyNull()
+ {
+ var native = new MockNativeView();
+ Assert.NotNull(native.CantBeNull);
+ native.SetBinding("CantBeNull", new Binding("FFoo", BindingMode.TwoWay));
+ Assert.NotNull(native.CantBeNull);
+ native.SetBindingContext(new { FFoo = "foo" });
+ Assert.AreEqual("foo", native.CantBeNull);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Core.UnitTests/UnitPlatform.cs b/Xamarin.Forms.Core.UnitTests/UnitPlatform.cs
index 8dbf3e04..1d78a7b2 100644
--- a/Xamarin.Forms.Core.UnitTests/UnitPlatform.cs
+++ b/Xamarin.Forms.Core.UnitTests/UnitPlatform.cs
@@ -4,7 +4,6 @@ namespace Xamarin.Forms.Core.UnitTests
{
public class UnitPlatform : IPlatform
{
- Page page;
Func<VisualElement, double, double, SizeRequest> getNativeSizeFunc;
readonly bool useRealisticLabelMeasure;
diff --git a/Xamarin.Forms.Core.UnitTests/Xamarin.Forms.Core.UnitTests.csproj b/Xamarin.Forms.Core.UnitTests/Xamarin.Forms.Core.UnitTests.csproj
index 6bf9d0e9..e4a36d1a 100644
--- a/Xamarin.Forms.Core.UnitTests/Xamarin.Forms.Core.UnitTests.csproj
+++ b/Xamarin.Forms.Core.UnitTests/Xamarin.Forms.Core.UnitTests.csproj
@@ -46,10 +46,10 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NoWarn>0114;0672;0108;0067;0168;0169;0219;0612;0618;1998;4014</NoWarn>
</PropertyGroup>
- <Import Project="..\Xamarin.Forms.Core\SignWithXamarinKey.props" />
<ItemGroup>
- <Reference Include="nunit.framework">
- <HintPath>..\packages\NUnit.2.6.2\lib\nunit.framework.dll</HintPath>
+ <Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
+ <HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
+ <Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
@@ -179,6 +179,7 @@
<Compile Include="TriggerTests.cs" />
<Compile Include="PinchGestureRecognizerTests.cs" />
<Compile Include="AppLinkEntryTests.cs" />
+ <Compile Include="NativeBindingTests.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Xamarin.Forms.Core\Xamarin.Forms.Core.csproj">
@@ -194,9 +195,6 @@
<Name>Xamarin.Forms.Platform</Name>
</ProjectReference>
</ItemGroup>
- <ItemGroup>
- <None Include="packages.config" />
- </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
@@ -206,7 +204,9 @@
<Target Name="AfterBuild">
</Target>
-->
- <ItemGroup />
+ <ItemGroup>
+ <None Include="packages.config" />
+ </ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Images\crimson.jpg">
<LogicalName>Images/crimson.jpg</LogicalName>
diff --git a/Xamarin.Forms.Core.UnitTests/packages.config b/Xamarin.Forms.Core.UnitTests/packages.config
index d27552db..c714ef3a 100644
--- a/Xamarin.Forms.Core.UnitTests/packages.config
+++ b/Xamarin.Forms.Core.UnitTests/packages.config
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="NUnit" version="2.6.2" targetFramework="net45" />
-</packages>
+ <package id="NUnit" version="2.6.4" targetFramework="net45" />
+</packages> \ No newline at end of file
diff --git a/Xamarin.Forms.Core.Windows.UITests/Xamarin.Forms.Core.Windows.UITests.csproj b/Xamarin.Forms.Core.Windows.UITests/Xamarin.Forms.Core.Windows.UITests.csproj
index 5fd01fcf..e7fd3e37 100644
--- a/Xamarin.Forms.Core.Windows.UITests/Xamarin.Forms.Core.Windows.UITests.csproj
+++ b/Xamarin.Forms.Core.Windows.UITests/Xamarin.Forms.Core.Windows.UITests.csproj
@@ -34,8 +34,8 @@
<NoWarn>0114;0108;4014;0649;0169;0168;0219</NoWarn>
</PropertyGroup>
<ItemGroup>
- <Reference Include="nunit.framework, Version=3.0.5813.39031, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
- <HintPath>..\packages\NUnit.3.0.1\lib\net45\nunit.framework.dll</HintPath>
+ <Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
+ <HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
@@ -46,8 +46,8 @@
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
- <Reference Include="Xamarin.UITest, Version=1.3.8.0, Culture=neutral, processorArchitecture=MSIL">
- <HintPath>..\packages\Xamarin.UITest.1.3.8\lib\Xamarin.UITest.dll</HintPath>
+ <Reference Include="Xamarin.UITest, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <HintPath>..\packages\Xamarin.UITest.2.0.0-beta02\lib\Xamarin.UITest.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
diff --git a/Xamarin.Forms.Core.Windows.UITests/packages.config b/Xamarin.Forms.Core.Windows.UITests/packages.config
index 2a195661..bae38c6e 100644
--- a/Xamarin.Forms.Core.Windows.UITests/packages.config
+++ b/Xamarin.Forms.Core.Windows.UITests/packages.config
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="NUnit" version="3.0.1" targetFramework="net45" />
- <package id="Xamarin.UITest" version="1.3.8" targetFramework="net45" />
+ <package id="NUnit" version="2.6.4" targetFramework="net45" />
+ <package id="Xamarin.UITest" version="2.0.0-beta02" targetFramework="net45" />
</packages> \ No newline at end of file
diff --git a/Xamarin.Forms.Core.iOS.UITests/Xamarin.Forms.Core.iOS.UITests.csproj b/Xamarin.Forms.Core.iOS.UITests/Xamarin.Forms.Core.iOS.UITests.csproj
index 9c5ad1bd..79368025 100644
--- a/Xamarin.Forms.Core.iOS.UITests/Xamarin.Forms.Core.iOS.UITests.csproj
+++ b/Xamarin.Forms.Core.iOS.UITests/Xamarin.Forms.Core.iOS.UITests.csproj
@@ -59,7 +59,7 @@
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="Xamarin.UITest">
- <HintPath>..\packages\Xamarin.UITest.1.3.8\lib\Xamarin.UITest.dll</HintPath>
+ <HintPath>..\packages\Xamarin.UITest.2.0.0-beta02\lib\Xamarin.UITest.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
diff --git a/Xamarin.Forms.Core.iOS.UITests/packages.config b/Xamarin.Forms.Core.iOS.UITests/packages.config
index bd8e626b..bae38c6e 100644
--- a/Xamarin.Forms.Core.iOS.UITests/packages.config
+++ b/Xamarin.Forms.Core.iOS.UITests/packages.config
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NUnit" version="2.6.4" targetFramework="net45" />
- <package id="Xamarin.UITest" version="1.3.8" targetFramework="net45" />
+ <package id="Xamarin.UITest" version="2.0.0-beta02" targetFramework="net45" />
</packages> \ No newline at end of file
diff --git a/Xamarin.Forms.Core/BindablePropertyConverter.cs b/Xamarin.Forms.Core/BindablePropertyConverter.cs
index af3fd5b6..a7398e08 100644
--- a/Xamarin.Forms.Core/BindablePropertyConverter.cs
+++ b/Xamarin.Forms.Core/BindablePropertyConverter.cs
@@ -7,6 +7,7 @@ using Xamarin.Forms.Xaml;
namespace Xamarin.Forms
{
+ [Xaml.ProvideCompiled("Xamarin.Forms.Core.XamlC.BindablePropertyConverter")]
public sealed class BindablePropertyConverter : TypeConverter, IExtendedTypeConverter
{
object IExtendedTypeConverter.ConvertFrom(CultureInfo culture, object value, IServiceProvider serviceProvider)
@@ -51,10 +52,7 @@ namespace Xamarin.Forms
type = (parentValuesProvider.TargetObject as Trigger).TargetType;
if (type == null)
- {
- string msg = string.Format("Can't resolve {0}", parts[0]);
- throw new XamlParseException(msg, lineinfo);
- }
+ throw new XamlParseException($"Can't resolve {parts [0]}", lineinfo);
return ConvertFrom(type, parts[0], lineinfo);
}
@@ -67,8 +65,7 @@ namespace Xamarin.Forms
}
return ConvertFrom(type, parts[1], lineinfo);
}
- string emsg = string.Format("Can't resolve {0}. Syntax is [[ns:]Type.]PropertyName.", value);
- throw new XamlParseException(emsg, lineinfo);
+ throw new XamlParseException($"Can't resolve {value}. Syntax is [[prefix:]Type.]PropertyName.", lineinfo);
}
public override object ConvertFromInvariantString(string value)
@@ -83,7 +80,7 @@ namespace Xamarin.Forms
string[] parts = value.Split('.');
if (parts.Length != 2)
{
- Log.Warning(null, "Can't resolve {0}. Accepted syntax is Type.PropertyName.", value);
+ Log.Warning(null, $"Can't resolve {value}. Accepted syntax is Type.PropertyName.");
return null;
}
Type type = Type.GetType("Xamarin.Forms." + parts[0]);
@@ -95,10 +92,10 @@ namespace Xamarin.Forms
string name = propertyName + "Property";
FieldInfo bpinfo = type.GetField(fi => fi.Name == name && fi.IsStatic && fi.IsPublic && fi.FieldType == typeof(BindableProperty));
if (bpinfo == null)
- throw new XamlParseException(string.Format("Can't resolve {0} on {1}", name, type.Name), lineinfo);
+ throw new XamlParseException($"Can't resolve {name} on {type.Name}", lineinfo);
var bp = bpinfo.GetValue(null) as BindableProperty;
if (bp.PropertyName != propertyName)
- throw new XamlParseException(string.Format("The PropertyName of {0}.{1} is not {2}", type.Name, name, propertyName), lineinfo);
+ throw new XamlParseException($"The PropertyName of {type.Name}.{name} is not {propertyName}", lineinfo);
return bp;
}
}
diff --git a/Xamarin.Forms.Core/Binding.cs b/Xamarin.Forms.Core/Binding.cs
index 5fa1dd65..b3baa0df 100644
--- a/Xamarin.Forms.Core/Binding.cs
+++ b/Xamarin.Forms.Core/Binding.cs
@@ -17,6 +17,7 @@ namespace Xamarin.Forms
BindingExpression _expression;
string _path;
object _source;
+ string _updateSourceEventName;
public Binding()
{
@@ -81,6 +82,14 @@ namespace Xamarin.Forms
}
}
+ internal string UpdateSourceEventName {
+ get { return _updateSourceEventName; }
+ set {
+ ThrowIfApplied();
+ _updateSourceEventName = value;
+ }
+ }
+
public static Binding Create<TSource>(Expression<Func<TSource, object>> propertyGetter, BindingMode mode = BindingMode.Default, IValueConverter converter = null, object converterParameter = null,
string stringFormat = null)
{
@@ -115,7 +124,7 @@ namespace Xamarin.Forms
internal override BindingBase Clone()
{
- return new Binding(Path, Mode) { Converter = Converter, ConverterParameter = ConverterParameter, StringFormat = StringFormat, Source = Source };
+ return new Binding(Path, Mode) { Converter = Converter, ConverterParameter = ConverterParameter, StringFormat = StringFormat, Source = Source, UpdateSourceEventName = UpdateSourceEventName };
}
internal override object GetSourceValue(object value, Type targetPropertyType)
diff --git a/Xamarin.Forms.Core/BindingTypeConverter.cs b/Xamarin.Forms.Core/BindingTypeConverter.cs
index 07dda896..2e57ac88 100644
--- a/Xamarin.Forms.Core/BindingTypeConverter.cs
+++ b/Xamarin.Forms.Core/BindingTypeConverter.cs
@@ -1,5 +1,6 @@
namespace Xamarin.Forms
{
+ [Xaml.ProvideCompiled("Xamarin.Forms.Core.XamlC.BindingTypeConverter")]
public sealed class BindingTypeConverter : TypeConverter
{
public override object ConvertFromInvariantString(string value)
diff --git a/Xamarin.Forms.Core/BoundsTypeConverter.cs b/Xamarin.Forms.Core/BoundsTypeConverter.cs
index 549b7b63..68464f8e 100644
--- a/Xamarin.Forms.Core/BoundsTypeConverter.cs
+++ b/Xamarin.Forms.Core/BoundsTypeConverter.cs
@@ -3,7 +3,8 @@ using System.Globalization;
namespace Xamarin.Forms
{
- public class BoundsTypeConverter : TypeConverter
+ [Xaml.ProvideCompiled ("Xamarin.Forms.Core.XamlC.BoundsTypeConverter")]
+ public sealed class BoundsTypeConverter : TypeConverter
{
public override object ConvertFromInvariantString(string value)
{
@@ -36,7 +37,7 @@ namespace Xamarin.Forms
return new Rectangle(x, y, w, h);
}
- throw new InvalidOperationException(string.Format("Cannot convert \"{0}\" into {1}", value, typeof(Rectangle)));
+ throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(Rectangle)}");
}
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Core/ColorTypeConverter.cs b/Xamarin.Forms.Core/ColorTypeConverter.cs
index 612174e9..0eb6fab3 100644
--- a/Xamarin.Forms.Core/ColorTypeConverter.cs
+++ b/Xamarin.Forms.Core/ColorTypeConverter.cs
@@ -1,9 +1,9 @@
using System;
using System.Linq;
-using System.Reflection;
namespace Xamarin.Forms
{
+ [Xaml.ProvideCompiled("Xamarin.Forms.Core.XamlC.ColorTypeConverter")]
public class ColorTypeConverter : TypeConverter
{
public override object ConvertFromInvariantString(string value)
@@ -16,59 +16,39 @@ namespace Xamarin.Forms
if (parts.Length == 1 || (parts.Length == 2 && parts[0] == "Color"))
{
string color = parts[parts.Length - 1];
- switch (color)
- {
- case "Default":
- return Color.Default;
- case "Transparent":
- return Color.Transparent;
- case "Aqua":
- return Color.Aqua;
- case "Black":
- return Color.Black;
- case "Blue":
- return Color.Blue;
- case "Fuchsia":
- return Color.Fuchsia;
- case "Gray":
- return Color.Gray;
- case "Green":
- return Color.Green;
- case "Lime":
- return Color.Lime;
- case "Maroon":
- return Color.Maroon;
- case "Navy":
- return Color.Navy;
- case "Olive":
- return Color.Olive;
- case "Orange":
- return Color.Orange;
- case "Purple":
- return Color.Purple;
- case "Pink":
- return Color.Pink;
- case "Red":
- return Color.Red;
- case "Silver":
- return Color.Silver;
- case "Teal":
- return Color.Teal;
- case "White":
- return Color.White;
- case "Yellow":
- return Color.Yellow;
+ switch (color) {
+ case "Default": return Color.Default;
+ case "Accent": return Color.Accent;
+ case "Transparent": return Color.Transparent;
+ case "Aqua": return Color.Aqua;
+ case "Black": return Color.Black;
+ case "Blue": return Color.Blue;
+ case "Fuchsia": return Color.Fuchsia;
+ case "Gray": return Color.Gray;
+ case "Green": return Color.Green;
+ case "Lime": return Color.Lime;
+ case "Maroon": return Color.Maroon;
+ case "Navy": return Color.Navy;
+ case "Olive": return Color.Olive;
+ case "Orange": return Color.Orange;
+ case "Purple": return Color.Purple;
+ case "Pink": return Color.Pink;
+ case "Red": return Color.Red;
+ case "Silver": return Color.Silver;
+ case "Teal": return Color.Teal;
+ case "White": return Color.White;
+ case "Yellow": return Color.Yellow;
}
- FieldInfo field = typeof(Color).GetFields().FirstOrDefault(fi => fi.IsStatic && fi.Name == color);
+ var field = typeof(Color).GetFields().FirstOrDefault(fi => fi.IsStatic && fi.Name == color);
if (field != null)
return (Color)field.GetValue(null);
- PropertyInfo property = typeof(Color).GetProperties().FirstOrDefault(pi => pi.Name == color && pi.CanRead && pi.GetMethod.IsStatic);
+ var property = typeof(Color).GetProperties().FirstOrDefault(pi => pi.Name == color && pi.CanRead && pi.GetMethod.IsStatic);
if (property != null)
return (Color)property.GetValue(null, null);
}
}
- throw new InvalidOperationException(string.Format("Cannot convert \"{0}\" into {1}", value, typeof(Color)));
+ throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(Color)}");
}
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Core/ConstraintExpression.cs b/Xamarin.Forms.Core/ConstraintExpression.cs
index b2ca4b8f..0e4f5e97 100644
--- a/Xamarin.Forms.Core/ConstraintExpression.cs
+++ b/Xamarin.Forms.Core/ConstraintExpression.cs
@@ -6,7 +6,7 @@ using Xamarin.Forms.Xaml;
namespace Xamarin.Forms
{
- public class ConstraintExpression : IMarkupExtension
+ public class ConstraintExpression : IMarkupExtension<Constraint>
{
public ConstraintExpression()
{
@@ -23,7 +23,12 @@ namespace Xamarin.Forms
public ConstraintType Type { get; set; }
- public object ProvideValue(IServiceProvider serviceProvider)
+ object IMarkupExtension.ProvideValue(IServiceProvider serviceProvider)
+ {
+ return (this as IMarkupExtension<Constraint>).ProvideValue(serviceProvider);
+ }
+
+ public Constraint ProvideValue(IServiceProvider serviceProvider)
{
MethodInfo minfo;
switch (Type)
diff --git a/Xamarin.Forms.Core/Element.cs b/Xamarin.Forms.Core/Element.cs
index 73aaab08..19d7d855 100644
--- a/Xamarin.Forms.Core/Element.cs
+++ b/Xamarin.Forms.Core/Element.cs
@@ -341,10 +341,9 @@ namespace Xamarin.Forms
base.OnBindingContextChanged();
}
- protected void OnChildAdded(Element child, Element parentOverride)
+ protected virtual void OnChildAdded(Element child)
{
- child.Parent = parentOverride ?? this;
-
+ child.Parent = this;
if (Platform != null)
child.Platform = Platform;
@@ -358,11 +357,6 @@ namespace Xamarin.Forms
OnDescendantAdded(element);
}
- protected virtual void OnChildAdded(Element child)
- {
- OnChildAdded(child, null);
- }
-
protected virtual void OnChildRemoved(Element child)
{
child.Parent = null;
diff --git a/Xamarin.Forms.Core/INativeBindingService.cs b/Xamarin.Forms.Core/INativeBindingService.cs
new file mode 100644
index 00000000..d926dae4
--- /dev/null
+++ b/Xamarin.Forms.Core/INativeBindingService.cs
@@ -0,0 +1,10 @@
+namespace Xamarin.Forms.Xaml
+{
+
+ interface INativeBindingService
+ {
+ bool TrySetBinding(object target, string propertyName, BindingBase binding);
+ bool TrySetBinding(object target, BindableProperty property, BindingBase binding);
+ bool TrySetValue(object target, BindableProperty property, object value);
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Core/INativeValueConverterService.cs b/Xamarin.Forms.Core/INativeValueConverterService.cs
new file mode 100644
index 00000000..4309be9a
--- /dev/null
+++ b/Xamarin.Forms.Core/INativeValueConverterService.cs
@@ -0,0 +1,9 @@
+using System;
+
+namespace Xamarin.Forms.Xaml
+{
+ interface INativeValueConverterService
+ {
+ bool ConvertTo(object value, Type toType, out object nativeValue);
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Core/IProvideValueTarget.cs b/Xamarin.Forms.Core/IProvideValueTarget.cs
index b8324b5e..13e4cb08 100644
--- a/Xamarin.Forms.Core/IProvideValueTarget.cs
+++ b/Xamarin.Forms.Core/IProvideValueTarget.cs
@@ -3,7 +3,6 @@ namespace Xamarin.Forms.Xaml
public interface IProvideValueTarget
{
object TargetObject { get; }
-
object TargetProperty { get; }
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Core/LayoutOptionsConverter.cs b/Xamarin.Forms.Core/LayoutOptionsConverter.cs
index 746e56ce..6dae0f02 100644
--- a/Xamarin.Forms.Core/LayoutOptionsConverter.cs
+++ b/Xamarin.Forms.Core/LayoutOptionsConverter.cs
@@ -4,22 +4,32 @@ using System.Reflection;
namespace Xamarin.Forms
{
+ [Xaml.ProvideCompiled("Xamarin.Forms.Core.XamlC.LayoutOptionsConverter")]
public sealed class LayoutOptionsConverter : TypeConverter
{
public override object ConvertFromInvariantString(string value)
{
- if (value != null)
- {
- string[] parts = value.Split('.');
- if (parts.Length > 2 || (parts.Length == 2 && parts[0] != "LayoutOptions"))
- throw new InvalidOperationException(string.Format("Cannot convert \"{0}\" into {1}", value, typeof(LayoutOptions)));
- value = parts[parts.Length - 1];
+ if (value != null) {
+ var parts = value.Split('.');
+ if (parts.Length > 2 || (parts.Length == 2 && parts [0] != "LayoutOptions"))
+ throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(LayoutOptions)}");
+ value = parts [parts.Length - 1];
+ switch (value) {
+ case "Start": return LayoutOptions.Start;
+ case "Center": return LayoutOptions.Center;
+ case "End": return LayoutOptions.End;
+ case "Fill": return LayoutOptions.Fill;
+ case "StartAndExpand": return LayoutOptions.StartAndExpand;
+ case "CenterAndExpand": return LayoutOptions.CenterAndExpand;
+ case "EndAndExpand": return LayoutOptions.EndAndExpand;
+ case "FillAndExpand": return LayoutOptions.FillAndExpand;
+ }
FieldInfo field = typeof(LayoutOptions).GetFields().FirstOrDefault(fi => fi.IsStatic && fi.Name == value);
if (field != null)
return (LayoutOptions)field.GetValue(null);
}
- throw new InvalidOperationException(string.Format("Cannot convert \"{0}\" into {1}", value, typeof(LayoutOptions)));
+ throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(LayoutOptions)}");
}
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Core/NativeBindingHelpers.cs b/Xamarin.Forms.Core/NativeBindingHelpers.cs
new file mode 100644
index 00000000..7e2db65b
--- /dev/null
+++ b/Xamarin.Forms.Core/NativeBindingHelpers.cs
@@ -0,0 +1,196 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using Xamarin.Forms.Internals;
+
+using static System.String;
+
+namespace Xamarin.Forms
+{
+ static class NativeBindingHelpers
+ {
+ public static void SetBinding<TNativeView>(TNativeView target, string targetProperty, BindingBase bindingBase, string updateSourceEventName = null) where TNativeView : class
+ {
+ var binding = bindingBase as Binding;
+ //This will allow setting bindings from Xaml by reusing the MarkupExtension
+ if (IsNullOrEmpty(updateSourceEventName) && binding != null && !IsNullOrEmpty(binding.UpdateSourceEventName))
+ updateSourceEventName = binding.UpdateSourceEventName;
+ INotifyPropertyChanged eventWrapper = null;
+ if (!IsNullOrEmpty(updateSourceEventName))
+ eventWrapper = new EventWrapper(target, targetProperty, updateSourceEventName);
+
+ SetBinding(target, targetProperty, bindingBase, eventWrapper);
+ }
+
+ internal static void SetBinding<TNativeView>(TNativeView target, string targetProperty, BindingBase bindingBase, INotifyPropertyChanged propertyChanged) where TNativeView : class
+ {
+ if (target == null)
+ throw new ArgumentNullException(nameof(target));
+ if (IsNullOrEmpty(targetProperty))
+ throw new ArgumentNullException(nameof(targetProperty));
+
+ var binding = bindingBase as Binding;
+ var proxy = BindableObjectProxy<TNativeView>.BindableObjectProxies.GetValue(target, (TNativeView key) => new BindableObjectProxy<TNativeView>(key));
+ BindableProperty bindableProperty = null;
+ propertyChanged = propertyChanged ?? target as INotifyPropertyChanged;
+ var propertyType = target.GetType().GetProperty(targetProperty)?.PropertyType;
+ var defaultValue = target.GetType().GetProperty(targetProperty)?.GetMethod.Invoke(target, new object [] { });
+ bindableProperty = CreateBindableProperty<TNativeView>(targetProperty, propertyType, defaultValue);
+ if (binding != null && binding.Mode != BindingMode.OneWay && propertyChanged != null)
+ propertyChanged.PropertyChanged += (sender, e) => {
+ if (e.PropertyName != targetProperty)
+ return;
+ SetValueFromNative<TNativeView>(sender as TNativeView, targetProperty, bindableProperty);
+ };
+
+ if (binding != null && binding.Mode != BindingMode.OneWay)
+ SetValueFromNative(target, targetProperty, bindableProperty);
+
+ proxy.SetBinding(bindableProperty, bindingBase);
+ }
+
+ static BindableProperty CreateBindableProperty<TNativeView>(string targetProperty, Type propertyType = null, object defaultValue = null) where TNativeView : class
+ {
+ propertyType = propertyType ?? typeof(object);
+ defaultValue = defaultValue ?? (propertyType.GetTypeInfo().IsValueType ? Activator.CreateInstance(propertyType) : null);
+ return BindableProperty.Create(
+ targetProperty,
+ propertyType,
+ typeof(BindableObjectProxy<TNativeView>),
+ defaultValue: defaultValue,
+ defaultBindingMode: BindingMode.Default,
+ propertyChanged: (bindable, oldValue, newValue) => {
+ TNativeView nativeView;
+ if ((bindable as BindableObjectProxy<TNativeView>).TargetReference.TryGetTarget(out nativeView))
+ SetNativeValue(nativeView, targetProperty, newValue);
+ }
+ );
+ }
+
+ static void SetNativeValue<TNativeView>(TNativeView target, string targetProperty, object newValue) where TNativeView : class
+ {
+ var mi = target.GetType().GetProperty(targetProperty)?.SetMethod;
+ if (mi == null)
+ throw new InvalidOperationException(Format("Native Binding on {0}.{1} failed due to missing or inaccessible property", target.GetType(), targetProperty));
+ mi.Invoke(target, new[] { newValue });
+ }
+
+ static void SetValueFromNative<TNativeView>(TNativeView target, string targetProperty, BindableProperty bindableProperty) where TNativeView : class
+ {
+ BindableObjectProxy<TNativeView> proxy;
+ if (!BindableObjectProxy<TNativeView>.BindableObjectProxies.TryGetValue(target, out proxy))
+ return;
+ SetValueFromRenderer(proxy, bindableProperty, target.GetType().GetProperty(targetProperty)?.GetMethod.Invoke(target, new object [] { }));
+ }
+
+ static void SetValueFromRenderer(BindableObject bindable, BindableProperty property, object value)
+ {
+ bindable.SetValueCore(property, value);
+ }
+
+ public static void SetBinding<TNativeView>(TNativeView target, BindableProperty targetProperty, BindingBase binding) where TNativeView : class
+ {
+ if (target == null)
+ throw new ArgumentNullException(nameof(target));
+ if (targetProperty == null)
+ throw new ArgumentNullException(nameof(targetProperty));
+ if (binding == null)
+ throw new ArgumentNullException(nameof(binding));
+
+ var proxy = BindableObjectProxy<TNativeView>.BindableObjectProxies.GetValue(target, (TNativeView key) => new BindableObjectProxy<TNativeView>(key));
+ proxy.BindingsBackpack.Add(new KeyValuePair<BindableProperty, BindingBase>(targetProperty, binding));
+ }
+
+ public static void SetValue<TNativeView>(TNativeView target, BindableProperty targetProperty, object value) where TNativeView : class
+ {
+ if (target == null)
+ throw new ArgumentNullException(nameof(target));
+ if (targetProperty == null)
+ throw new ArgumentNullException(nameof(targetProperty));
+
+ var proxy = BindableObjectProxy<TNativeView>.BindableObjectProxies.GetValue(target, (TNativeView key) => new BindableObjectProxy<TNativeView>(key));
+ proxy.ValuesBackpack.Add(new KeyValuePair<BindableProperty, object>(targetProperty, value));
+ }
+
+ public static void SetBindingContext<TNativeView>(TNativeView target, object bindingContext, Func<TNativeView, IEnumerable<TNativeView>> getChild = null) where TNativeView : class
+ {
+ if (target == null)
+ throw new ArgumentNullException(nameof(target));
+
+ var proxy = BindableObjectProxy<TNativeView>.BindableObjectProxies.GetValue(target, (TNativeView key) => new BindableObjectProxy<TNativeView>(key));
+ proxy.BindingContext = bindingContext;
+ if (getChild == null)
+ return;
+ var children = getChild(target);
+ if (children == null)
+ return;
+ foreach (var child in children)
+ if (child != null)
+ SetBindingContext(child, bindingContext, getChild);
+ }
+
+ internal static void TransferBindablePropertiesToWrapper<TNativeView, TNativeWrapper>(TNativeView nativeView, TNativeWrapper wrapper)
+ where TNativeView : class
+ where TNativeWrapper : View
+ {
+ BindableObjectProxy<TNativeView> proxy;
+ if (!BindableObjectProxy<TNativeView>.BindableObjectProxies.TryGetValue(nativeView, out proxy))
+ return;
+ proxy.TransferAttachedPropertiesTo(wrapper);
+ }
+
+ class EventWrapper : INotifyPropertyChanged
+ {
+ string TargetProperty { get; set; }
+ static readonly MethodInfo s_handlerinfo = typeof(EventWrapper).GetRuntimeMethods().Single(mi => mi.Name == "OnPropertyChanged" && mi.IsPublic == false);
+
+ public EventWrapper(object target, string targetProperty, string updateSourceEventName)
+ {
+ TargetProperty = targetProperty;
+ Delegate handlerDelegate = null;
+ EventInfo updateSourceEvent=null;
+ try {
+ updateSourceEvent = target.GetType().GetRuntimeEvent(updateSourceEventName);
+ handlerDelegate = s_handlerinfo.CreateDelegate(updateSourceEvent.EventHandlerType, this);
+ } catch (Exception){
+ throw new ArgumentException(Format("No declared or accessible event {0} on {1}",updateSourceEventName,target.GetType()), nameof(updateSourceEventName));
+ }
+ if (updateSourceEvent != null && handlerDelegate != null)
+ updateSourceEvent.AddEventHandler(target, handlerDelegate);
+ }
+
+ [Preserve]
+ void OnPropertyChanged(object sender, EventArgs e)
+ {
+ PropertyChanged?.Invoke(sender, new PropertyChangedEventArgs(TargetProperty));
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+ }
+
+ //This needs to be internal for testing purposes
+ internal class BindableObjectProxy<TNativeView> : BindableObject where TNativeView : class
+ {
+ public static ConditionalWeakTable<TNativeView, BindableObjectProxy<TNativeView>> BindableObjectProxies { get; } = new ConditionalWeakTable<TNativeView, BindableObjectProxy<TNativeView>>();
+ public WeakReference<TNativeView> TargetReference { get; set; }
+ public IList<KeyValuePair<BindableProperty, BindingBase>> BindingsBackpack { get; } = new List<KeyValuePair<BindableProperty, BindingBase>>();
+ public IList<KeyValuePair<BindableProperty, object>> ValuesBackpack { get; } = new List<KeyValuePair<BindableProperty, object>>();
+
+ public BindableObjectProxy(TNativeView target)
+ {
+ TargetReference = new WeakReference<TNativeView>(target);
+ }
+
+ public void TransferAttachedPropertiesTo(View wrapper)
+ {
+ foreach (var kvp in BindingsBackpack)
+ wrapper.SetBinding(kvp.Key, kvp.Value);
+ foreach (var kvp in ValuesBackpack)
+ wrapper.SetValue(kvp.Key, kvp.Value);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Core/ParameterAttribute.cs b/Xamarin.Forms.Core/ParameterAttribute.cs
index d8a07267..629a454f 100644
--- a/Xamarin.Forms.Core/ParameterAttribute.cs
+++ b/Xamarin.Forms.Core/ParameterAttribute.cs
@@ -10,6 +10,6 @@ namespace Xamarin.Forms
Name = name;
}
- public string Name { get; set; }
+ public string Name { get; }
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Core/Properties/AssemblyInfo.cs b/Xamarin.Forms.Core/Properties/AssemblyInfo.cs
index 3573b08f..3fb4cbd1 100644
--- a/Xamarin.Forms.Core/Properties/AssemblyInfo.cs
+++ b/Xamarin.Forms.Core/Properties/AssemblyInfo.cs
@@ -20,7 +20,6 @@ using Xamarin.Forms.Internals;
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
-/* ===== InternalsVisibleTo() has been moved to Xamarin.Forms.Core/Properties/ExposeInternalsToXamarin.cs file
[assembly: InternalsVisibleTo("Xamarin.Forms.Platform.iOS")]
[assembly: InternalsVisibleTo("Xamarin.Forms.Platform.iOS.Classic")]
[assembly: InternalsVisibleTo("Xamarin.Forms.Platform.Android")]
@@ -56,7 +55,8 @@ using Xamarin.Forms.Internals;
[assembly: InternalsVisibleTo("Xamarin.Forms.Pages")]
[assembly: InternalsVisibleTo("Xamarin.Forms.Pages.UnitTests")]
[assembly: InternalsVisibleTo("Xamarin.Forms.CarouselView")]
-*/
-[assembly: InternalsVisibleTo("Xamarin.Forms.Platform.Tizen, PublicKey=0024000004800000940000000602000000240000525341310004000011000000b526a39dd3a53bcd7b35e28e309fb199847b2ea2cec8aad56740fd879b0b6f9e45983b4a6788c6b70ce05900fb3ca66208d9fde22880cb5165d42ce1f1de9b7e46c0dfd0a8c8433a84a396db82fd7c1485584bedba9a53d772d7fbdfe98692fd2083d4c9019614df497609d5848a46f25149c6549def06fc5ea987377408e2af")]
-[assembly: InternalsVisibleTo("Xamarin.Forms.Platform.Tizen.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000011000000b526a39dd3a53bcd7b35e28e309fb199847b2ea2cec8aad56740fd879b0b6f9e45983b4a6788c6b70ce05900fb3ca66208d9fde22880cb5165d42ce1f1de9b7e46c0dfd0a8c8433a84a396db82fd7c1485584bedba9a53d772d7fbdfe98692fd2083d4c9019614df497609d5848a46f25149c6549def06fc5ea987377408e2af")]
+
+[assembly: InternalsVisibleTo("Xamarin.Forms.Platform.Tizen")]
+[assembly: InternalsVisibleTo("Xamarin.Forms.Platform.Tizen.Tests")]
+
[assembly: Preserve] \ No newline at end of file
diff --git a/Xamarin.Forms.Core/Properties/ExposeInternalsToXamarin.cs b/Xamarin.Forms.Core/Properties/ExposeInternalsToXamarin.cs
deleted file mode 100644
index 6050bb11..00000000
--- a/Xamarin.Forms.Core/Properties/ExposeInternalsToXamarin.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-[assembly: InternalsVisibleTo("Xamarin.Forms.Build.Tasks," +
- "PublicKey=00240000048000009400000006020000002400005253413100040000" +
- "1100000033ce7398017d567782784824a0e996cb3e03561e5771075ab4754fe11e" +
- "0ac76f870cc54669cf3ea8b6f28a4a140eafd269837857f5fd0a6e40958b07daa6" +
- "4e9c38d82903aa3caeffde0bc1b1e7cf693210fea62518c8942ad2a99d3e685038" +
- "1b17bb26550cd0ee26ebae413dc4c9c51128d7577651ff383805e398bebe4ab384")]
-
-[assembly: InternalsVisibleTo("Xamarin.Forms.Core.UnitTests," +
- "PublicKey=00240000048000009400000006020000002400005253413100040000" +
- "1100000033ce7398017d567782784824a0e996cb3e03561e5771075ab4754fe11e" +
- "0ac76f870cc54669cf3ea8b6f28a4a140eafd269837857f5fd0a6e40958b07daa6" +
- "4e9c38d82903aa3caeffde0bc1b1e7cf693210fea62518c8942ad2a99d3e685038" +
- "1b17bb26550cd0ee26ebae413dc4c9c51128d7577651ff383805e398bebe4ab384")]
-
-[assembly: InternalsVisibleTo("Xamarin.Forms.Pages," +
- "PublicKey=00240000048000009400000006020000002400005253413100040000" +
- "1100000033ce7398017d567782784824a0e996cb3e03561e5771075ab4754fe11e" +
- "0ac76f870cc54669cf3ea8b6f28a4a140eafd269837857f5fd0a6e40958b07daa6" +
- "4e9c38d82903aa3caeffde0bc1b1e7cf693210fea62518c8942ad2a99d3e685038" +
- "1b17bb26550cd0ee26ebae413dc4c9c51128d7577651ff383805e398bebe4ab384")]
-
-[assembly: InternalsVisibleTo("Xamarin.Forms.Pages.UnitTests," +
- "PublicKey=00240000048000009400000006020000002400005253413100040000" +
- "1100000033ce7398017d567782784824a0e996cb3e03561e5771075ab4754fe11e" +
- "0ac76f870cc54669cf3ea8b6f28a4a140eafd269837857f5fd0a6e40958b07daa6" +
- "4e9c38d82903aa3caeffde0bc1b1e7cf693210fea62518c8942ad2a99d3e685038" +
- "1b17bb26550cd0ee26ebae413dc4c9c51128d7577651ff383805e398bebe4ab384")]
-
-[assembly: InternalsVisibleTo("Xamarin.Forms.Xaml," +
- "PublicKey=00240000048000009400000006020000002400005253413100040000" +
- "1100000033ce7398017d567782784824a0e996cb3e03561e5771075ab4754fe11e" +
- "0ac76f870cc54669cf3ea8b6f28a4a140eafd269837857f5fd0a6e40958b07daa6" +
- "4e9c38d82903aa3caeffde0bc1b1e7cf693210fea62518c8942ad2a99d3e685038" +
- "1b17bb26550cd0ee26ebae413dc4c9c51128d7577651ff383805e398bebe4ab384")]
-
-[assembly: InternalsVisibleTo("Xamarin.Forms.Xaml.UnitTests," +
- "PublicKey=00240000048000009400000006020000002400005253413100040000" +
- "1100000033ce7398017d567782784824a0e996cb3e03561e5771075ab4754fe11e" +
- "0ac76f870cc54669cf3ea8b6f28a4a140eafd269837857f5fd0a6e40958b07daa6" +
- "4e9c38d82903aa3caeffde0bc1b1e7cf693210fea62518c8942ad2a99d3e685038" +
- "1b17bb26550cd0ee26ebae413dc4c9c51128d7577651ff383805e398bebe4ab384")]
-
-[assembly: InternalsVisibleTo("xamlg," +
- "PublicKey=00240000048000009400000006020000002400005253413100040000" +
- "1100000033ce7398017d567782784824a0e996cb3e03561e5771075ab4754fe11e" +
- "0ac76f870cc54669cf3ea8b6f28a4a140eafd269837857f5fd0a6e40958b07daa6" +
- "4e9c38d82903aa3caeffde0bc1b1e7cf693210fea62518c8942ad2a99d3e685038" +
- "1b17bb26550cd0ee26ebae413dc4c9c51128d7577651ff383805e398bebe4ab384")]
-
diff --git a/Xamarin.Forms.Core/ProvideCompiledAttribute.cs b/Xamarin.Forms.Core/ProvideCompiledAttribute.cs
new file mode 100644
index 00000000..f8e261ba
--- /dev/null
+++ b/Xamarin.Forms.Core/ProvideCompiledAttribute.cs
@@ -0,0 +1,15 @@
+using System;
+
+namespace Xamarin.Forms.Xaml
+{
+ [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
+ sealed class ProvideCompiledAttribute : Attribute
+ {
+ public string CompiledVersion { get; }
+
+ public ProvideCompiledAttribute (string compiledVersion)
+ {
+ CompiledVersion = compiledVersion;
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Core/RectangleTypeConverter.cs b/Xamarin.Forms.Core/RectangleTypeConverter.cs
index b17a8c26..421c8060 100644
--- a/Xamarin.Forms.Core/RectangleTypeConverter.cs
+++ b/Xamarin.Forms.Core/RectangleTypeConverter.cs
@@ -3,6 +3,7 @@ using System.Globalization;
namespace Xamarin.Forms
{
+ [Xaml.ProvideCompiled("Xamarin.Forms.Core.XamlC.RectangleTypeConverter")]
public class RectangleTypeConverter : TypeConverter
{
public override object ConvertFromInvariantString(string value)
diff --git a/Xamarin.Forms.Core/SignWithXamarinKey.props b/Xamarin.Forms.Core/SignWithXamarinKey.props
deleted file mode 100644
index 1124bbc6..00000000
--- a/Xamarin.Forms.Core/SignWithXamarinKey.props
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <SignAssembly>true</SignAssembly>
- <AssemblyOriginatorKeyFile>..\Xamarin.Forms.Core\Xamarin.Forms.snk</AssemblyOriginatorKeyFile>
- </PropertyGroup>
-</Project>
diff --git a/Xamarin.Forms.Core/TypeConverter.cs b/Xamarin.Forms.Core/TypeConverter.cs
index 57ea3b4c..52b14d4e 100644
--- a/Xamarin.Forms.Core/TypeConverter.cs
+++ b/Xamarin.Forms.Core/TypeConverter.cs
@@ -8,7 +8,7 @@ namespace Xamarin.Forms
public virtual bool CanConvertFrom(Type sourceType)
{
if (sourceType == null)
- throw new ArgumentNullException("sourceType");
+ throw new ArgumentNullException(nameof(sourceType));
return sourceType == typeof(string);
}
diff --git a/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj b/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj
index 0555e218..90578e3c 100644
--- a/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj
+++ b/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj
@@ -4,9 +4,11 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{57B8B73D-C3B5-4C42-869E-7B2F17D354AC}</ProjectGuid>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<RootNamespace>Xamarin.Forms</RootNamespace>
<AssemblyName>Xamarin.Forms.Core</AssemblyName>
+ <TargetFrameworkProfile>Profile259</TargetFrameworkProfile>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
</PropertyGroup>
@@ -46,7 +48,6 @@
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
- <Import Project="..\Xamarin.Forms.Core\SignWithXamarinKey.props" />
<ItemGroup>
<Compile Include="AbsoluteLayoutFlags.cs" />
<Compile Include="ActionSheetArguments.cs" />
@@ -431,11 +432,12 @@
<Compile Include="IAppIndexingProvider.cs" />
<Compile Include="ListStringTypeConverter.cs" />
<Compile Include="PoppedToRootEventArgs.cs" />
- <Compile Include="Properties\ExposeInternalsToXamarin.cs">
- <Link>Properties\ExposeInternalsToXamarin.cs</Link>
- </Compile>
+ <Compile Include="NativeBindingHelpers.cs" />
+ <Compile Include="INativeValueConverterService.cs" />
+ <Compile Include="INativeBindingService.cs" />
+ <Compile Include="ProvideCompiledAttribute.cs" />
</ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\Xamarin.Forms.Platform\Xamarin.Forms.Platform.csproj">
<Project>{67f9d3a8-f71e-4428-913f-c37ae82cdb24}</Project>
@@ -448,8 +450,4 @@
</PostBuildEvent>
</PropertyGroup>
<ItemGroup />
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Xml" />
- </ItemGroup>
-</Project> \ No newline at end of file
+</Project>
diff --git a/Xamarin.Forms.Core/Xamarin.Forms.snk b/Xamarin.Forms.Core/Xamarin.Forms.snk
deleted file mode 100644
index 804f4461..00000000
--- a/Xamarin.Forms.Core/Xamarin.Forms.snk
+++ /dev/null
Binary files differ
diff --git a/Xamarin.Forms.Core/XamlParseException.cs b/Xamarin.Forms.Core/XamlParseException.cs
index 42e8b618..d953da0f 100644
--- a/Xamarin.Forms.Core/XamlParseException.cs
+++ b/Xamarin.Forms.Core/XamlParseException.cs
@@ -7,7 +7,7 @@ namespace Xamarin.Forms.Xaml
{
readonly string _unformattedMessage;
- public XamlParseException(string message, IXmlLineInfo xmlInfo) : base(FormatMessage(message, xmlInfo))
+ public XamlParseException(string message, IXmlLineInfo xmlInfo, Exception innerException = null) : base(FormatMessage(message, xmlInfo), innerException)
{
_unformattedMessage = message;
XmlInfo = xmlInfo;
diff --git a/Xamarin.Forms.CustomAttributes/Xamarin.Forms.CustomAttributes.csproj b/Xamarin.Forms.CustomAttributes/Xamarin.Forms.CustomAttributes.csproj
index e3c1a7e5..35fd6b92 100644
--- a/Xamarin.Forms.CustomAttributes/Xamarin.Forms.CustomAttributes.csproj
+++ b/Xamarin.Forms.CustomAttributes/Xamarin.Forms.CustomAttributes.csproj
@@ -13,7 +13,7 @@
<DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <TargetFrameworkProfile Condition=" '$(OS)' != 'Unix' ">Profile259</TargetFrameworkProfile>
+ <TargetFrameworkProfile>Profile259</TargetFrameworkProfile>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -48,7 +48,6 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NoWarn>0169</NoWarn>
</PropertyGroup>
- <Import Project="..\Xamarin.Forms.Core\SignWithXamarinKey.props" />
<ItemGroup>
<!-- A reference to the entire .NET Framework is automatically included -->
</ItemGroup>
@@ -57,8 +56,7 @@
<Compile Include="TestAttributes.cs" />
<Compile Include="UiTestAttribute.cs" />
</ItemGroup>
- <Import Condition=" '$(OS)' != 'Unix' " Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
- <Import Condition=" '$(OS)' == 'Unix' " Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
diff --git a/Xamarin.Forms.Maps.Android/MapRenderer.cs b/Xamarin.Forms.Maps.Android/MapRenderer.cs
index 29270c0b..dc1b46cc 100644
--- a/Xamarin.Forms.Maps.Android/MapRenderer.cs
+++ b/Xamarin.Forms.Maps.Android/MapRenderer.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
@@ -10,35 +11,45 @@ using Android.OS;
using Java.Lang;
using Xamarin.Forms.Platform.Android;
using Math = System.Math;
-using Android.Runtime;
-using System.Collections;
namespace Xamarin.Forms.Maps.Android
{
- public class MapRenderer : ViewRenderer<Map,MapView>,
- GoogleMap.IOnCameraChangeListener
+ public class MapRenderer : ViewRenderer<Map, MapView>,
+ GoogleMap.IOnCameraChangeListener
{
- public MapRenderer ()
- {
- AutoPackage = false;
- }
+ const string MoveMessageName = "MapMoveToRegion";
static Bundle s_bundle;
- internal static Bundle Bundle { set { s_bundle = value; } }
+
+ bool _disposed;
+
+ bool _init = true;
List<Marker> _markers;
- const string MoveMessageName = "MapMoveToRegion";
+ public MapRenderer()
+ {
+ AutoPackage = false;
+ }
+
+ protected Map Map => Element;
#pragma warning disable 618
- protected GoogleMap NativeMap => ((MapView) Control).Map;
+ protected GoogleMap NativeMap => Control.Map;
#pragma warning restore 618
+ internal static Bundle Bundle
+ {
+ set { s_bundle = value; }
+ }
- protected Map Map => (Map) Element;
+ public void OnCameraChange(CameraPosition pos)
+ {
+ UpdateVisibleRegion(pos.Target);
+ }
- public override SizeRequest GetDesiredSize (int widthConstraint, int heightConstraint)
+ public override SizeRequest GetDesiredSize(int widthConstraint, int heightConstraint)
{
- return new SizeRequest (new Size (Context.ToPixels (40), Context.ToPixels (40)));
+ return new SizeRequest(new Size(Context.ToPixels(40), Context.ToPixels(40)));
}
protected override MapView CreateNativeControl()
@@ -46,29 +57,57 @@ namespace Xamarin.Forms.Maps.Android
return new MapView(Context);
}
- protected override void OnElementChanged (ElementChangedEventArgs<Map> e)
+ protected override void Dispose(bool disposing)
{
- base.OnElementChanged (e);
+ if (disposing && !_disposed)
+ {
+ _disposed = true;
- var oldMapView = (MapView)Control;
+ Map mapModel = Element;
+ if (mapModel != null)
+ {
+ MessagingCenter.Unsubscribe<Map, MapSpan>(this, MoveMessageName);
+ ((ObservableCollection<Pin>)mapModel.Pins).CollectionChanged -= OnCollectionChanged;
+ }
- var mapView = CreateNativeControl();
- mapView.OnCreate (s_bundle);
- mapView.OnResume ();
- SetNativeControl (mapView);
+ GoogleMap gmap = NativeMap;
+ if (gmap == null)
+ {
+ return;
+ }
+ gmap.MyLocationEnabled = false;
+ gmap.InfoWindowClick -= MapOnMarkerClick;
+ gmap.Dispose();
+ }
+
+ base.Dispose(disposing);
+ }
+
+ protected override void OnElementChanged(ElementChangedEventArgs<Map> e)
+ {
+ base.OnElementChanged(e);
+
+ MapView oldMapView = Control;
- if (e.OldElement != null) {
- var oldMapModel = e.OldElement;
+ MapView mapView = CreateNativeControl();
+ mapView.OnCreate(s_bundle);
+ mapView.OnResume();
+ SetNativeControl(mapView);
+
+ if (e.OldElement != null)
+ {
+ Map oldMapModel = e.OldElement;
((ObservableCollection<Pin>)oldMapModel.Pins).CollectionChanged -= OnCollectionChanged;
- MessagingCenter.Unsubscribe<Map, MapSpan> (this, MoveMessageName);
+ MessagingCenter.Unsubscribe<Map, MapSpan>(this, MoveMessageName);
#pragma warning disable 618
- if (oldMapView.Map != null) {
+ if (oldMapView.Map != null)
+ {
#pragma warning restore 618
#pragma warning disable 618
- oldMapView.Map.SetOnCameraChangeListener (null);
+ oldMapView.Map.SetOnCameraChangeListener(null);
#pragma warning restore 618
NativeMap.InfoWindowClick -= MapOnMarkerClick;
}
@@ -76,179 +115,96 @@ namespace Xamarin.Forms.Maps.Android
oldMapView.Dispose();
}
- var map = NativeMap;
- if (map != null) {
- map.SetOnCameraChangeListener (this);
+ GoogleMap map = NativeMap;
+ if (map != null)
+ {
+ map.SetOnCameraChangeListener(this);
NativeMap.InfoWindowClick += MapOnMarkerClick;
map.UiSettings.ZoomControlsEnabled = Map.HasZoomEnabled;
map.UiSettings.ZoomGesturesEnabled = Map.HasZoomEnabled;
map.UiSettings.ScrollGesturesEnabled = Map.HasScrollEnabled;
map.MyLocationEnabled = map.UiSettings.MyLocationButtonEnabled = Map.IsShowingUser;
- SetMapType ();
+ SetMapType();
}
-
- MessagingCenter.Subscribe<Map, MapSpan> (this, MoveMessageName, OnMoveToRegionMessage, Map);
+
+ MessagingCenter.Subscribe<Map, MapSpan>(this, MoveMessageName, OnMoveToRegionMessage, Map);
var incc = Map.Pins as INotifyCollectionChanged;
if (incc != null)
+ {
incc.CollectionChanged += OnCollectionChanged;
- }
-
- void OnCollectionChanged (object sender, NotifyCollectionChangedEventArgs notifyCollectionChangedEventArgs)
- {
- switch (notifyCollectionChangedEventArgs.Action) {
- case NotifyCollectionChangedAction.Add:
- AddPins (notifyCollectionChangedEventArgs.NewItems);
- break;
- case NotifyCollectionChangedAction.Remove:
- RemovePins (notifyCollectionChangedEventArgs.OldItems);
- break;
- case NotifyCollectionChangedAction.Replace:
- RemovePins (notifyCollectionChangedEventArgs.OldItems);
- AddPins (notifyCollectionChangedEventArgs.NewItems);
- break;
- case NotifyCollectionChangedAction.Reset:
- _markers?.ForEach (m => m.Remove ());
- _markers = null;
- AddPins ((IList)(Element as Map).Pins);
- break;
- case NotifyCollectionChangedAction.Move:
- //do nothing
- break;
- }
- }
-
- void OnMoveToRegionMessage (Map s, MapSpan a)
- {
- MoveToRegion (a, true);
- }
-
- void MoveToRegion (MapSpan span, bool animate)
- {
- var map = NativeMap;
- if (map == null)
- return;
-
- span = span.ClampLatitude (85, -85);
- var ne = new LatLng (span.Center.Latitude + span.LatitudeDegrees / 2, span.Center.Longitude + span.LongitudeDegrees / 2);
- var sw = new LatLng (span.Center.Latitude - span.LatitudeDegrees / 2, span.Center.Longitude - span.LongitudeDegrees / 2);
- var update = CameraUpdateFactory.NewLatLngBounds (new LatLngBounds (sw, ne), 0);
-
- try {
- if (animate)
- map.AnimateCamera (update);
- else
- map.MoveCamera (update);
- } catch (IllegalStateException exc) {
- System.Diagnostics.Debug.WriteLine ("MoveToRegion exception: " + exc);
- }
- }
-
- bool _init = true;
-
- protected override void OnLayout (bool changed, int l, int t, int r, int b)
- {
- base.OnLayout (changed, l, t, r, b);
-
- if (_init) {
- MoveToRegion (((Map)Element).LastMoveToRegion, false);
- OnCollectionChanged (((Map)Element).Pins, new NotifyCollectionChangedEventArgs( NotifyCollectionChangedAction.Reset));
- _init = false;
- } else if (changed) {
- UpdateVisibleRegion (NativeMap.CameraPosition.Target);
}
}
- protected override void OnElementPropertyChanged (object sender, PropertyChangedEventArgs e)
+ protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
- base.OnElementPropertyChanged (sender, e);
+ base.OnElementPropertyChanged(sender, e);
- if (e.PropertyName == Map.MapTypeProperty.PropertyName) {
+ if (e.PropertyName == Map.MapTypeProperty.PropertyName)
+ {
SetMapType();
return;
}
-
- var gmap = NativeMap;
+
+ GoogleMap gmap = NativeMap;
if (gmap == null)
+ {
return;
+ }
if (e.PropertyName == Map.IsShowingUserProperty.PropertyName)
+ {
gmap.MyLocationEnabled = gmap.UiSettings.MyLocationButtonEnabled = Map.IsShowingUser;
+ }
else if (e.PropertyName == Map.HasScrollEnabledProperty.PropertyName)
+ {
gmap.UiSettings.ScrollGesturesEnabled = Map.HasScrollEnabled;
- else if (e.PropertyName == Map.HasZoomEnabledProperty.PropertyName) {
+ }
+ else if (e.PropertyName == Map.HasZoomEnabledProperty.PropertyName)
+ {
gmap.UiSettings.ZoomControlsEnabled = Map.HasZoomEnabled;
gmap.UiSettings.ZoomGesturesEnabled = Map.HasZoomEnabled;
}
}
- void SetMapType ()
+ protected override void OnLayout(bool changed, int l, int t, int r, int b)
{
- var map = NativeMap;
- if (map == null)
- return;
+ base.OnLayout(changed, l, t, r, b);
- switch (Map.MapType) {
- case MapType.Street:
- map.MapType = GoogleMap.MapTypeNormal;
- break;
- case MapType.Satellite:
- map.MapType = GoogleMap.MapTypeSatellite;
- break;
- case MapType.Hybrid:
- map.MapType = GoogleMap.MapTypeHybrid;
- break;
- default:
- throw new ArgumentOutOfRangeException ();
+ if (_init)
+ {
+ MoveToRegion(Element.LastMoveToRegion, false);
+ OnCollectionChanged(Element.Pins, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
+ _init = false;
+ }
+ else if (changed)
+ {
+ UpdateVisibleRegion(NativeMap.CameraPosition.Target);
}
}
- public void OnCameraChange (CameraPosition pos)
- {
- UpdateVisibleRegion (pos.Target);
- }
-
- void UpdateVisibleRegion (LatLng pos)
- {
- var map = NativeMap;
- if (map == null)
- return;
- var projection = map.Projection;
- var width = Control.Width;
- var height = Control.Height;
- var ul = projection.FromScreenLocation (new global::Android.Graphics.Point (0, 0));
- var ur = projection.FromScreenLocation (new global::Android.Graphics.Point (width, 0));
- var ll = projection.FromScreenLocation (new global::Android.Graphics.Point (0, height));
- var lr = projection.FromScreenLocation (new global::Android.Graphics.Point (width, height));
- var dlat = Math.Max (Math.Abs (ul.Latitude - lr.Latitude), Math.Abs (ur.Latitude - ll.Latitude));
- var dlong = Math.Max (Math.Abs (ul.Longitude - lr.Longitude), Math.Abs (ur.Longitude - ll.Longitude));
- ((Map)Element).VisibleRegion = new MapSpan (
- new Position (
- pos.Latitude,
- pos.Longitude
- ),
- dlat,
- dlong
- );
- }
-
- void AddPins (IList pins)
+ void AddPins(IList pins)
{
- var map = NativeMap;
+ GoogleMap map = NativeMap;
if (map == null)
+ {
return;
+ }
if (_markers == null)
- _markers = new List<Marker> ();
+ {
+ _markers = new List<Marker>();
+ }
- _markers.AddRange( pins.Cast<Pin>().Select (p => {
- var pin = (Pin)p;
- var opts = new MarkerOptions ();
- opts.SetPosition (new LatLng (pin.Position.Latitude, pin.Position.Longitude));
- opts.SetTitle (pin.Label);
- opts.SetSnippet (pin.Address);
- var marker = map.AddMarker (opts);
+ _markers.AddRange(pins.Cast<Pin>().Select(p =>
+ {
+ Pin pin = p;
+ var opts = new MarkerOptions();
+ opts.SetPosition(new LatLng(pin.Position.Latitude, pin.Position.Longitude));
+ opts.SetTitle(pin.Label);
+ opts.SetSnippet(pin.Address);
+ var marker = map.AddMarker(opts);
// associate pin with marker for later lookup in event handlers
pin.Id = marker.Id;
@@ -256,34 +212,20 @@ namespace Xamarin.Forms.Maps.Android
}));
}
- void RemovePins (IList pins)
- {
- var map = NativeMap;
- if (map == null)
- return;
- if (_markers == null)
- return;
-
- foreach (Pin p in pins) {
- var marker = _markers.FirstOrDefault (m => (object)m.Id == p.Id);
- if (marker == null)
- continue;
- marker.Remove ();
- _markers.Remove (marker);
- }
- }
-
- void MapOnMarkerClick (object sender, GoogleMap.InfoWindowClickEventArgs eventArgs)
+ void MapOnMarkerClick(object sender, GoogleMap.InfoWindowClickEventArgs eventArgs)
{
// clicked marker
var marker = eventArgs.Marker;
// lookup pin
Pin targetPin = null;
- for (var i = 0; i < Map.Pins.Count; i++) {
- var pin = Map.Pins[i];
+ for (var i = 0; i < Map.Pins.Count; i++)
+ {
+ Pin pin = Map.Pins[i];
if ((string)pin.Id != marker.Id)
+ {
continue;
+ }
targetPin = pin;
break;
@@ -291,30 +233,136 @@ namespace Xamarin.Forms.Maps.Android
// only consider event handled if a handler is present.
// Else allow default behavior of displaying an info window.
- targetPin?.SendTap ();
+ targetPin?.SendTap();
}
- bool _disposed;
- protected override void Dispose (bool disposing)
+ void MoveToRegion(MapSpan span, bool animate)
{
- if (disposing && !_disposed) {
- _disposed = true;
-
- var mapModel = Element as Map;
- if (mapModel != null) {
- MessagingCenter.Unsubscribe<Map, MapSpan> (this, MoveMessageName);
- ((ObservableCollection<Pin>)mapModel.Pins).CollectionChanged -= OnCollectionChanged;
+ GoogleMap map = NativeMap;
+ if (map == null)
+ {
+ return;
+ }
+
+ span = span.ClampLatitude(85, -85);
+ var ne = new LatLng(span.Center.Latitude + span.LatitudeDegrees / 2,
+ span.Center.Longitude + span.LongitudeDegrees / 2);
+ var sw = new LatLng(span.Center.Latitude - span.LatitudeDegrees / 2,
+ span.Center.Longitude - span.LongitudeDegrees / 2);
+ CameraUpdate update = CameraUpdateFactory.NewLatLngBounds(new LatLngBounds(sw, ne), 0);
+
+ try
+ {
+ if (animate)
+ {
+ map.AnimateCamera(update);
+ }
+ else
+ {
+ map.MoveCamera(update);
}
+ }
+ catch (IllegalStateException exc)
+ {
+ System.Diagnostics.Debug.WriteLine("MoveToRegion exception: " + exc);
+ }
+ }
- var gmap = NativeMap;
- if (gmap == null)
- return;
- gmap.MyLocationEnabled = false;
- gmap.InfoWindowClick -= MapOnMarkerClick;
- gmap.Dispose ();
+ void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs notifyCollectionChangedEventArgs)
+ {
+ switch (notifyCollectionChangedEventArgs.Action)
+ {
+ case NotifyCollectionChangedAction.Add:
+ AddPins(notifyCollectionChangedEventArgs.NewItems);
+ break;
+ case NotifyCollectionChangedAction.Remove:
+ RemovePins(notifyCollectionChangedEventArgs.OldItems);
+ break;
+ case NotifyCollectionChangedAction.Replace:
+ RemovePins(notifyCollectionChangedEventArgs.OldItems);
+ AddPins(notifyCollectionChangedEventArgs.NewItems);
+ break;
+ case NotifyCollectionChangedAction.Reset:
+ _markers?.ForEach(m => m.Remove());
+ _markers = null;
+ AddPins((IList)Element.Pins);
+ break;
+ case NotifyCollectionChangedAction.Move:
+ //do nothing
+ break;
+ }
+ }
+
+ void OnMoveToRegionMessage(Map s, MapSpan a)
+ {
+ MoveToRegion(a, true);
+ }
+
+ void RemovePins(IList pins)
+ {
+ GoogleMap map = NativeMap;
+ if (map == null)
+ {
+ return;
+ }
+ if (_markers == null)
+ {
+ return;
+ }
+
+ foreach (Pin p in pins)
+ {
+ var marker = _markers.FirstOrDefault(m => (object)m.Id == p.Id);
+ if (marker == null)
+ {
+ continue;
+ }
+ marker.Remove();
+ _markers.Remove(marker);
+ }
+ }
+
+ void SetMapType()
+ {
+ GoogleMap map = NativeMap;
+ if (map == null)
+ {
+ return;
}
- base.Dispose (disposing);
+ switch (Map.MapType)
+ {
+ case MapType.Street:
+ map.MapType = GoogleMap.MapTypeNormal;
+ break;
+ case MapType.Satellite:
+ map.MapType = GoogleMap.MapTypeSatellite;
+ break;
+ case MapType.Hybrid:
+ map.MapType = GoogleMap.MapTypeHybrid;
+ break;
+ default:
+ throw new ArgumentOutOfRangeException();
+ }
+ }
+
+ void UpdateVisibleRegion(LatLng pos)
+ {
+ GoogleMap map = NativeMap;
+ if (map == null)
+ {
+ return;
+ }
+ Projection projection = map.Projection;
+ int width = Control.Width;
+ int height = Control.Height;
+ LatLng ul = projection.FromScreenLocation(new global::Android.Graphics.Point(0, 0));
+ LatLng ur = projection.FromScreenLocation(new global::Android.Graphics.Point(width, 0));
+ LatLng ll = projection.FromScreenLocation(new global::Android.Graphics.Point(0, height));
+ LatLng lr = projection.FromScreenLocation(new global::Android.Graphics.Point(width, height));
+ double dlat = Math.Max(Math.Abs(ul.Latitude - lr.Latitude), Math.Abs(ur.Latitude - ll.Latitude));
+ double dlong = Math.Max(Math.Abs(ul.Longitude - lr.Longitude), Math.Abs(ur.Longitude - ll.Longitude));
+ Element.VisibleRegion = new MapSpan(new Position(pos.Latitude, pos.Longitude), dlat, dlong);
}
}
-}
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Maps.iOS/FormsMaps.cs b/Xamarin.Forms.Maps.iOS/FormsMaps.cs
index 91033f78..ca8dca67 100644
--- a/Xamarin.Forms.Maps.iOS/FormsMaps.cs
+++ b/Xamarin.Forms.Maps.iOS/FormsMaps.cs
@@ -1,10 +1,5 @@
-using Xamarin.Forms.Maps.iOS;
-#if __UNIFIED__
using UIKit;
-
-#else
-using MonoTouch.UIKit;
-#endif
+using Xamarin.Forms.Maps.iOS;
namespace Xamarin
{
diff --git a/Xamarin.Forms.Maps.iOS/GeocoderBackend.cs b/Xamarin.Forms.Maps.iOS/GeocoderBackend.cs
index 42b96457..08ffbbec 100644
--- a/Xamarin.Forms.Maps.iOS/GeocoderBackend.cs
+++ b/Xamarin.Forms.Maps.iOS/GeocoderBackend.cs
@@ -1,23 +1,8 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-#if __UNIFIED__
-using CoreLocation;
using AddressBookUI;
-#else
-using MonoTouch.AddressBookUI;
-using MonoTouch.CoreLocation;
-#endif
-#if __UNIFIED__
-using RectangleF = CoreGraphics.CGRect;
-using SizeF = CoreGraphics.CGSize;
-using PointF = CoreGraphics.CGPoint;
-
-#else
-using nfloat=global::System.Single;
-using nint=global::System.Int32;
-using nuint=global::System.UInt32;
-#endif
+using CoreLocation;
namespace Xamarin.Forms.Maps.iOS
{
diff --git a/Xamarin.Forms.Maps.iOS/MapRenderer.cs b/Xamarin.Forms.Maps.iOS/MapRenderer.cs
index c556d141..3f4e7eb6 100644
--- a/Xamarin.Forms.Maps.iOS/MapRenderer.cs
+++ b/Xamarin.Forms.Maps.iOS/MapRenderer.cs
@@ -4,31 +4,13 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
-using Xamarin.Forms.Platform.iOS;
-#if __UNIFIED__
-using UIKit;
-using MapKit;
using CoreLocation;
using Foundation;
-#else
-using MonoTouch.UIKit;
-using MonoTouch.Foundation;
-using MonoTouch.CoreLocation;
-using MonoTouch.MapKit;
-using System.Drawing;
-#endif
-#if __UNIFIED__
-using RectangleF = CoreGraphics.CGRect;
-using SizeF = CoreGraphics.CGSize;
-using PointF = CoreGraphics.CGPoint;
+using MapKit;
using ObjCRuntime;
-
-#else
-using nfloat=global::System.Single;
-using nint=global::System.Int32;
-using nuint=global::System.UInt32;
-using MonoTouch.ObjCRuntime;
-#endif
+using UIKit;
+using Xamarin.Forms.Platform.iOS;
+using RectangleF = CoreGraphics.CGRect;
namespace Xamarin.Forms.Maps.iOS
{
@@ -44,11 +26,7 @@ namespace Xamarin.Forms.Maps.iOS
_map = map;
}
-#if __UNIFIED__
public override MKAnnotationView GetViewForAnnotation(MKMapView mapView, IMKAnnotation annotation)
-#else
- public override MKAnnotationView GetViewForAnnotation (MKMapView mapView, NSObject annotation)
-#endif
{
MKPinAnnotationView mapPin = null;
@@ -71,11 +49,7 @@ namespace Xamarin.Forms.Maps.iOS
return mapPin;
}
-#if __UNIFIED__
void AttachGestureToPin(MKPinAnnotationView mapPin, IMKAnnotation annotation)
-#else
- void AttachGestureToPin (MKPinAnnotationView mapPin, NSObject annotation)
-#endif
{
UIGestureRecognizer[] recognizers = mapPin.GestureRecognizers;
@@ -238,11 +212,7 @@ namespace Xamarin.Forms.Maps.iOS
var annotation = new MKPointAnnotation { Title = pin.Label, Subtitle = pin.Address ?? "" };
pin.Id = annotation;
-#if __UNIFIED__
annotation.SetCoordinate(new CLLocationCoordinate2D(pin.Position.Latitude, pin.Position.Longitude));
-#else
- annotation.Coordinate = new CLLocationCoordinate2D (pin.Position.Latitude, pin.Position.Longitude);
-#endif
((MKMapView)Control).AddAnnotation(annotation);
}
}
@@ -293,11 +263,7 @@ namespace Xamarin.Forms.Maps.iOS
void RemovePins(IList pins)
{
foreach (object pin in pins)
-#if __UNIFIED__
((MKMapView)Control).RemoveAnnotation((IMKAnnotation)((Pin)pin).Id);
-#else
- ((MKMapView)Control).RemoveAnnotation ((NSObject)((Pin)pin).Id);
-#endif
}
void UpdateHasScrollEnabled()
diff --git a/Xamarin.Forms.Maps.iOS/Xamarin.Forms.Maps.iOS.Classic.csproj b/Xamarin.Forms.Maps.iOS/Xamarin.Forms.Maps.iOS.Classic.csproj
deleted file mode 100644
index 0f5fb89e..00000000
--- a/Xamarin.Forms.Maps.iOS/Xamarin.Forms.Maps.iOS.Classic.csproj
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
- <ProductVersion>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{CA10FACD-22AB-463F-A20E-379C212B0858}</ProjectGuid>
- <ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <OutputType>Library</OutputType>
- <RootNamespace>Xamarin.Forms.Maps.iOS</RootNamespace>
- <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
- <AssemblyName>Xamarin.Forms.Maps.iOS.Classic</AssemblyName>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>classic_bin\iPhoneSimulator\Debug</OutputPath>
- <BaseIntermediateOutputPath>classic_obj\</BaseIntermediateOutputPath>
- <DefineConstants>DEBUG</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <ConsolePause>false</ConsolePause>
- <MtouchDebug>true</MtouchDebug>
- <CodesignKey>iPhone Developer</CodesignKey>
- <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- <NoWarn>
- </NoWarn>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>none</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>classic_bin\iPhoneSimulator\Release</OutputPath>
- <BaseIntermediateOutputPath>classic_obj\</BaseIntermediateOutputPath>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <ConsolePause>false</ConsolePause>
- <CodesignKey>iPhone Developer</CodesignKey>
- <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- <NoWarn>
- </NoWarn>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Turkey|AnyCPU'">
- <DebugSymbols>true</DebugSymbols>
- <OutputPath>bin\Turkey\</OutputPath>
- <DefineConstants>__MOBILE__;__IOS__;DEBUG</DefineConstants>
- <DebugType>full</DebugType>
- <PlatformTarget>AnyCPU</PlatformTarget>
- <UseVSHostingProcess>false</UseVSHostingProcess>
- <ErrorReport>prompt</ErrorReport>
- <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
- <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- <NoWarn>
- </NoWarn>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'AppStore|AnyCPU'">
- <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- <NoWarn>
- </NoWarn>
- </PropertyGroup>
- <ItemGroup>
- <Compile Include="..\Xamarin.Forms.Core\Properties\GlobalAssemblyInfo.cs">
- <Link>Properties\GlobalAssemblyInfo.cs</Link>
- </Compile>
- <Compile Include="MapRenderer.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="FormsMaps.cs" />
- <Compile Include="GeocoderBackend.cs" />
- </ItemGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Xml" />
- <Reference Include="System.Core" />
- <Reference Include="monotouch" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\Xamarin.Forms.Core\Xamarin.Forms.Core.csproj">
- <Project>{57b8b73d-c3b5-4c42-869e-7b2f17d354ac}</Project>
- <Name>Xamarin.Forms.Core</Name>
- </ProjectReference>
- <ProjectReference Include="..\Xamarin.Forms.Maps\Xamarin.Forms.Maps.csproj">
- <Project>{7D13BAC2-C6A4-416A-B07E-C169B199E52B}</Project>
- <Name>Xamarin.Forms.Maps</Name>
- </ProjectReference>
- <ProjectReference Include="..\Xamarin.Forms.Platform.iOS\Xamarin.Forms.Platform.iOS.Classic.csproj">
- <Project>{4a47b5df-ddfc-476b-ac41-5105ff3b9b8b}</Project>
- <Name>Xamarin.Forms.Platform.iOS.Classic</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets" />
-</Project> \ No newline at end of file
diff --git a/Xamarin.Forms.Maps.iOS/Xamarin.Forms.Maps.iOS.csproj b/Xamarin.Forms.Maps.iOS/Xamarin.Forms.Maps.iOS.csproj
index 0318b39e..4ce638ea 100644
--- a/Xamarin.Forms.Maps.iOS/Xamarin.Forms.Maps.iOS.csproj
+++ b/Xamarin.Forms.Maps.iOS/Xamarin.Forms.Maps.iOS.csproj
@@ -42,7 +42,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Turkey|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Turkey\</OutputPath>
- <DefineConstants>__UNIFIED__;__MOBILE__;__IOS__;DEBUG</DefineConstants>
+ <DefineConstants>__MOBILE__;__IOS__;DEBUG</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
diff --git a/Xamarin.Forms.Maps/Properties/AssemblyInfo.cs b/Xamarin.Forms.Maps/Properties/AssemblyInfo.cs
index 9394dd02..2220ffff 100644
--- a/Xamarin.Forms.Maps/Properties/AssemblyInfo.cs
+++ b/Xamarin.Forms.Maps/Properties/AssemblyInfo.cs
@@ -13,7 +13,6 @@ using Xamarin.Forms.Internals;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
-/* ===== InternalsVisibleTo() has been moved to Xamarin.Forms.Core/Properties/ExposeInternalsToXamarin.cs file
[assembly: InternalsVisibleTo("Xamarin.Forms.Maps.iOS")]
[assembly: InternalsVisibleTo("Xamarin.Forms.Maps.iOS.Classic")]
[assembly: InternalsVisibleTo("Xamarin.Forms.Maps.Android")]
@@ -28,5 +27,4 @@ using Xamarin.Forms.Internals;
[assembly: InternalsVisibleTo("Xamarin.Forms.Xaml.UnitTests")]
[assembly: InternalsVisibleTo("Xamarin.Forms.Xaml")]
[assembly: InternalsVisibleTo("Xamarin.Forms.Maps.Design")]
-*/
[assembly: Preserve] \ No newline at end of file
diff --git a/Xamarin.Forms.Maps/Xamarin.Forms.Maps.csproj b/Xamarin.Forms.Maps/Xamarin.Forms.Maps.csproj
index 6e2a7b49..e09848de 100644
--- a/Xamarin.Forms.Maps/Xamarin.Forms.Maps.csproj
+++ b/Xamarin.Forms.Maps/Xamarin.Forms.Maps.csproj
@@ -11,7 +11,7 @@
<RootNamespace>Xamarin.Forms.Maps</RootNamespace>
<AssemblyName>Xamarin.Forms.Maps</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <TargetFrameworkProfile Condition=" '$(OS)' != 'Unix' ">Profile259</TargetFrameworkProfile>
+ <TargetFrameworkProfile>Profile259</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
@@ -50,7 +50,6 @@
<NoWarn>
</NoWarn>
</PropertyGroup>
- <Import Project="..\Xamarin.Forms.Core\SignWithXamarinKey.props" />
<ItemGroup>
<!-- A reference to the entire .NET Framework is automatically included -->
<ProjectReference Include="..\Xamarin.Forms.Core\Xamarin.Forms.Core.csproj">
@@ -62,9 +61,6 @@
<Compile Include="..\Xamarin.Forms.Core\Properties\GlobalAssemblyInfo.cs">
<Link>Properties\GlobalAssemblyInfo.cs</Link>
</Compile>
- <Compile Include="..\Xamarin.Forms.Core\Properties\ExposeInternalsToXamarin.cs">
- <Link>Properties\ExposeInternalsToXamarin.cs</Link>
- </Compile>
<Compile Include="Map.cs" />
<Compile Include="Pin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -75,11 +71,7 @@
<Compile Include="Position.cs" />
<Compile Include="Geocoder.cs" />
</ItemGroup>
- <Import Condition=" '$(OS)' != 'Unix' " Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
- <Import Condition=" '$(OS)' == 'Unix' " Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <ItemGroup Condition=" '$(OS)' == 'Unix' ">
- <Reference Include="System" />
- </ItemGroup>
+ <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
diff --git a/Xamarin.Forms.Pages.Azure/Xamarin.Forms.Pages.Azure.csproj b/Xamarin.Forms.Pages.Azure/Xamarin.Forms.Pages.Azure.csproj
index 11ec6902..c8d47fd8 100644
--- a/Xamarin.Forms.Pages.Azure/Xamarin.Forms.Pages.Azure.csproj
+++ b/Xamarin.Forms.Pages.Azure/Xamarin.Forms.Pages.Azure.csproj
@@ -13,7 +13,7 @@
<DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <TargetFrameworkProfile Condition=" '$(OS)' != 'Unix' ">Profile259</TargetFrameworkProfile>
+ <TargetFrameworkProfile>Profile259</TargetFrameworkProfile>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
@@ -81,11 +81,7 @@
<Name>Xamarin.Forms.Xaml</Name>
</ProjectReference>
</ItemGroup>
- <Import Condition=" '$(OS)' != 'Unix' " Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
- <Import Condition=" '$(OS)' == 'Unix' " Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <ItemGroup Condition=" '$(OS)' == 'Unix' ">
- <Reference Include="System" />
- </ItemGroup>
+ <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
diff --git a/Xamarin.Forms.Pages.UnitTests/Xamarin.Forms.Pages.UnitTests.csproj b/Xamarin.Forms.Pages.UnitTests/Xamarin.Forms.Pages.UnitTests.csproj
index f8cac18e..1fd24655 100644
--- a/Xamarin.Forms.Pages.UnitTests/Xamarin.Forms.Pages.UnitTests.csproj
+++ b/Xamarin.Forms.Pages.UnitTests/Xamarin.Forms.Pages.UnitTests.csproj
@@ -30,14 +30,13 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
- <Import Project="..\Xamarin.Forms.Core\SignWithXamarinKey.props" />
<ItemGroup>
- <Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
- <HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+ <Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+ <HintPath>..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
- <Reference Include="nunit.framework, Version=2.6.2.12296, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
- <HintPath>..\packages\NUnit.2.6.2\lib\nunit.framework.dll</HintPath>
+ <Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
+ <HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
@@ -80,7 +79,9 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
- <None Include="packages.config" />
+ <None Include="packages.config">
+ <SubType>Designer</SubType>
+ </None>
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
diff --git a/Xamarin.Forms.Pages.UnitTests/packages.config b/Xamarin.Forms.Pages.UnitTests/packages.config
index 2cf632d9..537d2828 100644
--- a/Xamarin.Forms.Pages.UnitTests/packages.config
+++ b/Xamarin.Forms.Pages.UnitTests/packages.config
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" />
- <package id="NUnit" version="2.6.2" targetFramework="net452" />
+ <package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
+ <package id="NUnit" version="2.6.4" targetFramework="net45" />
</packages> \ No newline at end of file
diff --git a/Xamarin.Forms.Pages/BaseDataSource.cs b/Xamarin.Forms.Pages/BaseDataSource.cs
index 31608b83..678b5b74 100644
--- a/Xamarin.Forms.Pages/BaseDataSource.cs
+++ b/Xamarin.Forms.Pages/BaseDataSource.cs
@@ -17,7 +17,9 @@ namespace Xamarin.Forms.Pages
{
get
{
+#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
Initialize();
+#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
return _dataSourceList;
}
}
diff --git a/Xamarin.Forms.Pages/Xamarin.Forms.Pages.csproj b/Xamarin.Forms.Pages/Xamarin.Forms.Pages.csproj
index b3f5c5ab..61dadbf9 100644
--- a/Xamarin.Forms.Pages/Xamarin.Forms.Pages.csproj
+++ b/Xamarin.Forms.Pages/Xamarin.Forms.Pages.csproj
@@ -13,8 +13,10 @@
<DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <TargetFrameworkProfile Condition=" '$(OS)' != 'Unix' ">Profile259</TargetFrameworkProfile>
+ <TargetFrameworkProfile>Profile259</TargetFrameworkProfile>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <NuGetPackageImportStamp>
+ </NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -33,7 +35,6 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
- <Import Project="..\Xamarin.Forms.Core\SignWithXamarinKey.props" />
<ItemGroup>
<!-- A reference to the entire .NET Framework is automatically included -->
<ProjectReference Include="..\Xamarin.Forms.Core\Xamarin.Forms.Core.csproj">
@@ -89,11 +90,7 @@
<SubType>Designer</SubType>
</None>
</ItemGroup>
- <Import Condition=" '$(OS)' != 'Unix' " Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
- <Import Condition=" '$(OS)' == 'Unix' " Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <ItemGroup Condition=" '$(OS)' == 'Unix' ">
- <Reference Include="System" />
- </ItemGroup>
+ <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
diff --git a/Xamarin.Forms.Platform.Android.AppLinks/AndroidAppLinks.cs b/Xamarin.Forms.Platform.Android.AppLinks/AndroidAppLinks.cs
index b1639da7..975e65fb 100644
--- a/Xamarin.Forms.Platform.Android.AppLinks/AndroidAppLinks.cs
+++ b/Xamarin.Forms.Platform.Android.AppLinks/AndroidAppLinks.cs
@@ -91,11 +91,11 @@ namespace Xamarin.Forms.Platform.Android.AppLinks
{
if (appLink.IsLinkActive)
{
- Statuses resultStartAgain = await AppIndex.AppIndexApi.StartAsync(_client, indexAction);
+ await AppIndex.AppIndexApi.StartAsync(_client, indexAction);
}
else
{
- Statuses resultEnd = await AppIndex.AppIndexApi.EndAsync(_client, indexAction);
+ await AppIndex.AppIndexApi.EndAsync(_client, indexAction);
}
}
};
diff --git a/Xamarin.Forms.Platform.Android.FormsViewGroup/Xamarin.Forms.Platform.Android.FormsViewGroup.csproj b/Xamarin.Forms.Platform.Android.FormsViewGroup/Xamarin.Forms.Platform.Android.FormsViewGroup.csproj
index 51c52610..f22ce100 100644
--- a/Xamarin.Forms.Platform.Android.FormsViewGroup/Xamarin.Forms.Platform.Android.FormsViewGroup.csproj
+++ b/Xamarin.Forms.Platform.Android.FormsViewGroup/Xamarin.Forms.Platform.Android.FormsViewGroup.csproj
@@ -13,6 +13,7 @@
<AssemblyName>FormsViewGroup</AssemblyName>
<FileAlignment>512</FileAlignment>
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
+ <TargetFrameworkVersion>v7.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
diff --git a/Xamarin.Forms.Platform.Android/AppCompat/FormsAppCompatActivity.cs b/Xamarin.Forms.Platform.Android/AppCompat/FormsAppCompatActivity.cs
index b200e27b..ab2fb61a 100644
--- a/Xamarin.Forms.Platform.Android/AppCompat/FormsAppCompatActivity.cs
+++ b/Xamarin.Forms.Platform.Android/AppCompat/FormsAppCompatActivity.cs
@@ -414,10 +414,6 @@ namespace Xamarin.Forms.Platform.Android
{
_busyCount = Math.Max(0, enabled ? _busyCount + 1 : _busyCount - 1);
- if (!Forms.SupportsProgress)
- return;
-
- SetProgressBarIndeterminate(true);
UpdateProgressBarVisibility(_busyCount > 0);
}
@@ -491,8 +487,10 @@ namespace Xamarin.Forms.Platform.Android
{
if (!Forms.SupportsProgress)
return;
-
+#pragma warning disable 612, 618
+ SetProgressBarIndeterminate(true);
SetProgressBarIndeterminateVisibility(isBusy);
+#pragma warning restore 612, 618
}
internal class DefaultApplication : Application
diff --git a/Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs b/Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs
index f591f057..b2b9108a 100644
--- a/Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs
+++ b/Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs
@@ -607,8 +607,6 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
transaction.Show(toShow);
else
transaction.Add(Id, toShow);
-
- ((Platform)Element.Platform).NavAnimationInProgress = false;
}
else
{
@@ -617,7 +615,6 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
transaction.Hide(currentToHide);
transaction.Add(Id, fragment);
fragments.Add(fragment);
- ((Platform)Element.Platform).NavAnimationInProgress = false;
}
}
transaction.Commit();
@@ -657,6 +654,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
}
Context.HideKeyboard(this);
+ ((Platform)Element.Platform).NavAnimationInProgress = false;
// 200ms is how long the animations are, and they are "reversible" in the sense that starting another one slightly before it's done is fine
@@ -670,6 +668,9 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
void UpdateMenu()
{
+ if (_disposed)
+ return;
+
AToolbar bar = _toolbar;
Context context = Context;
IMenu menu = bar.Menu;
diff --git a/Xamarin.Forms.Platform.Android/ColorExtensions.cs b/Xamarin.Forms.Platform.Android/ColorExtensions.cs
index db190b4a..93e23124 100644
--- a/Xamarin.Forms.Platform.Android/ColorExtensions.cs
+++ b/Xamarin.Forms.Platform.Android/ColorExtensions.cs
@@ -36,5 +36,10 @@ namespace Xamarin.Forms.Platform.Android
int disabled = defaults.GetColorForState(States[1], color.ToAndroid());
return new ColorStateList(States, new[] { color.ToAndroid().ToArgb(), disabled });
}
+
+ public static Color ToColor(this AColor color)
+ {
+ return Color.FromUint((uint)color.ToArgb());
+ }
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.Android/Extensions/NativeBindingExtensions.cs b/Xamarin.Forms.Platform.Android/Extensions/NativeBindingExtensions.cs
new file mode 100644
index 00000000..fd072461
--- /dev/null
+++ b/Xamarin.Forms.Platform.Android/Extensions/NativeBindingExtensions.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+
+namespace Xamarin.Forms.Platform.Android
+{
+ public static class NativeBindingExtensions
+ {
+ public static void SetBinding(this global::Android.Views.View view, string propertyName, BindingBase binding, string updateSourceEventName = null)
+ {
+ NativeBindingHelpers.SetBinding(view, propertyName, binding, updateSourceEventName);
+ }
+
+ public static void SetBinding(this global::Android.Views.View view, BindableProperty targetProperty, BindingBase binding)
+ {
+ NativeBindingHelpers.SetBinding(view, targetProperty, binding);
+ }
+
+ public static void SetValue(this global::Android.Views.View target, BindableProperty targetProperty, object value)
+ {
+ NativeBindingHelpers.SetValue(target, targetProperty, value);
+ }
+
+ public static void SetBindingContext(this global::Android.Views.View target, object bindingContext, Func<global::Android.Views.View, IEnumerable<global::Android.Views.View>> getChildren = null)
+ {
+ NativeBindingHelpers.SetBindingContext(target, bindingContext, getChildren);
+ }
+
+ internal static void TransferBindablePropertiesToWrapper(this global::Android.Views.View target, View wrapper)
+ {
+ NativeBindingHelpers.TransferBindablePropertiesToWrapper(target, wrapper);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.Android/Forms.cs b/Xamarin.Forms.Platform.Android/Forms.cs
index a2a063c9..c2dc770b 100644
--- a/Xamarin.Forms.Platform.Android/Forms.cs
+++ b/Xamarin.Forms.Platform.Android/Forms.cs
@@ -264,9 +264,7 @@ namespace Xamarin.Forms
public void BeginInvokeOnMainThread(Action action)
{
- var activity = Context as Activity;
- if (activity != null)
- activity.RunOnUiThread(action);
+ new Handler(Looper.MainLooper).Post(action);
}
public Ticker CreateTicker()
diff --git a/Xamarin.Forms.Platform.Android/FormsApplicationActivity.cs b/Xamarin.Forms.Platform.Android/FormsApplicationActivity.cs
index adb27f77..c8795c6a 100644
--- a/Xamarin.Forms.Platform.Android/FormsApplicationActivity.cs
+++ b/Xamarin.Forms.Platform.Android/FormsApplicationActivity.cs
@@ -243,11 +243,6 @@ namespace Xamarin.Forms.Platform.Android
MessagingCenter.Subscribe(this, Page.BusySetSignalName, (Page sender, bool enabled) =>
{
busyCount = Math.Max(0, enabled ? busyCount + 1 : busyCount - 1);
-
- if (!Forms.SupportsProgress)
- return;
-
- SetProgressBarIndeterminate(true);
UpdateProgressBarVisibility(busyCount > 0);
});
@@ -338,7 +333,10 @@ namespace Xamarin.Forms.Platform.Android
{
if (!Forms.SupportsProgress)
return;
+#pragma warning disable 612, 618
+ SetProgressBarIndeterminate(true);
SetProgressBarIndeterminateVisibility(isBusy);
+#pragma warning restore 612, 618
}
internal class DefaultApplication : Application
diff --git a/Xamarin.Forms.Platform.Android/NativeBindingservice.cs b/Xamarin.Forms.Platform.Android/NativeBindingservice.cs
new file mode 100644
index 00000000..3dd4fe3c
--- /dev/null
+++ b/Xamarin.Forms.Platform.Android/NativeBindingservice.cs
@@ -0,0 +1,39 @@
+using System;
+using AView = Android.Views.View;
+
+[assembly: Xamarin.Forms.Dependency(typeof(Xamarin.Forms.Platform.Android.NativeBindingService))]
+
+namespace Xamarin.Forms.Platform.Android
+{
+ class NativeBindingService : Xaml.INativeBindingService
+ {
+ public bool TrySetBinding(object target, string propertyName, BindingBase binding)
+ {
+ var view = target as AView;
+ if (view == null)
+ return false;
+ if (target.GetType().GetProperty(propertyName)?.GetMethod == null)
+ return false;
+ view.SetBinding(propertyName, binding);
+ return true;
+ }
+
+ public bool TrySetBinding(object target, BindableProperty property, BindingBase binding)
+ {
+ var view = target as AView;
+ if (view == null)
+ return false;
+ view.SetBinding(property, binding);
+ return true;
+ }
+
+ public bool TrySetValue(object target, BindableProperty property, object value)
+ {
+ var view = target as AView;
+ if (view == null)
+ return false;
+ view.SetValue(property, value);
+ return true;
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.Android/NativeValueConverterService.cs b/Xamarin.Forms.Platform.Android/NativeValueConverterService.cs
new file mode 100644
index 00000000..ff6faa90
--- /dev/null
+++ b/Xamarin.Forms.Platform.Android/NativeValueConverterService.cs
@@ -0,0 +1,19 @@
+using System;
+using AView = Android.Views.View;
+
+[assembly: Xamarin.Forms.Dependency(typeof(Xamarin.Forms.Platform.Android.NativeValueConverterService))]
+namespace Xamarin.Forms.Platform.Android
+{
+ class NativeValueConverterService : Xaml.INativeValueConverterService
+ {
+ public bool ConvertTo(object value, Type toType, out object nativeValue)
+ {
+ nativeValue = null;
+ if (typeof(AView).IsInstanceOfType(value) && toType.IsAssignableFrom(typeof(View))) {
+ nativeValue = ((AView)value).ToView();
+ return true;
+ }
+ return false;
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.Android/NativeViewWrapper.cs b/Xamarin.Forms.Platform.Android/NativeViewWrapper.cs
index eecef9bc..53b5253c 100644
--- a/Xamarin.Forms.Platform.Android/NativeViewWrapper.cs
+++ b/Xamarin.Forms.Platform.Android/NativeViewWrapper.cs
@@ -1,3 +1,5 @@
+using Android.Views;
+
namespace Xamarin.Forms.Platform.Android
{
public class NativeViewWrapper : View
@@ -9,6 +11,8 @@ namespace Xamarin.Forms.Platform.Android
NativeView = nativeView;
OnLayoutDelegate = onLayoutDelegate;
OnMeasureDelegate = onMeasureDelegate;
+
+ nativeView.TransferBindablePropertiesToWrapper(this);
}
public GetDesiredSizeDelegate GetDesiredSizeDelegate { get; }
@@ -18,5 +22,11 @@ namespace Xamarin.Forms.Platform.Android
public OnLayoutDelegate OnLayoutDelegate { get; }
public OnMeasureDelegate OnMeasureDelegate { get; }
+
+ protected override void OnBindingContextChanged()
+ {
+ NativeView.SetBindingContext(BindingContext, (view) => (view as ViewGroup)?.GetChildrenOfType<global::Android.Views.View>());
+ base.OnBindingContextChanged();
+ }
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.Android/Renderers/WebViewRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/WebViewRenderer.cs
index bd5b8059..8efc41e1 100644
--- a/Xamarin.Forms.Platform.Android/Renderers/WebViewRenderer.cs
+++ b/Xamarin.Forms.Platform.Android/Renderers/WebViewRenderer.cs
@@ -201,6 +201,7 @@ namespace Xamarin.Forms.Platform.Android
base.OnReceivedError(view, request, error);
}
+ [Obsolete]
public override bool ShouldOverrideUrlLoading(AWebView view, string url)
{
if (_renderer.Element == null)
diff --git a/Xamarin.Forms.Platform.Android/VisualElementPackager.cs b/Xamarin.Forms.Platform.Android/VisualElementPackager.cs
index e6db1c6a..891d4383 100644
--- a/Xamarin.Forms.Platform.Android/VisualElementPackager.cs
+++ b/Xamarin.Forms.Platform.Android/VisualElementPackager.cs
@@ -33,8 +33,15 @@ namespace Xamarin.Forms.Platform.Android
public void Dispose()
{
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
if (_disposed)
return;
+
_disposed = true;
if (_renderer != null)
diff --git a/Xamarin.Forms.Platform.Android/VisualElementTracker.cs b/Xamarin.Forms.Platform.Android/VisualElementTracker.cs
index 2b9815d3..7ade4596 100644
--- a/Xamarin.Forms.Platform.Android/VisualElementTracker.cs
+++ b/Xamarin.Forms.Platform.Android/VisualElementTracker.cs
@@ -45,18 +45,28 @@ namespace Xamarin.Forms.Platform.Android
public void Dispose()
{
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
if (_disposed)
return;
- _disposed = true;
- SetElement(_element, null);
+ _disposed = true;
- if (_renderer != null)
+ if (disposing)
{
- _renderer.ElementChanged -= RendererOnElementChanged;
- _renderer.ViewGroup.RemoveOnAttachStateChangeListener(AttachTracker.Instance);
- _renderer = null;
- _context = null;
+ SetElement(_element, null);
+
+ if (_renderer != null)
+ {
+ _renderer.ElementChanged -= RendererOnElementChanged;
+ _renderer.ViewGroup.RemoveOnAttachStateChangeListener(AttachTracker.Instance);
+ _renderer = null;
+ _context = null;
+ }
}
}
diff --git a/Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android.csproj b/Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android.csproj
index 33bfa03f..2852b85b 100644
--- a/Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android.csproj
+++ b/Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android.csproj
@@ -241,6 +241,9 @@
<Compile Include="AppCompat\FormsFragmentPagerAdapter.cs" />
<Compile Include="AndroidAppIndexProvider.cs" />
<Compile Include="Renderers\FormsSeekBar.cs" />
+ <Compile Include="Extensions\NativeBindingExtensions.cs" />
+ <Compile Include="NativeValueConverterService.cs" />
+ <Compile Include="NativeBindingservice.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
@@ -263,6 +266,9 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
+ <ItemGroup>
+ <Folder Include="Extensions\" />
+ </ItemGroup>
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Import Project="..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
@@ -271,4 +277,4 @@
</PropertyGroup>
<Error Condition="!Exists('..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets'))" />
</Target>
-</Project> \ No newline at end of file
+</Project>
diff --git a/Xamarin.Forms.Platform.UAP/NativeBindingService.cs b/Xamarin.Forms.Platform.UAP/NativeBindingService.cs
new file mode 100644
index 00000000..e999af2a
--- /dev/null
+++ b/Xamarin.Forms.Platform.UAP/NativeBindingService.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Windows.UI.Xaml;
+
+#if WINDOWS_UWP
+[assembly: Xamarin.Forms.Dependency(typeof(Xamarin.Forms.Platform.UWP.NativeBindingService))]
+namespace Xamarin.Forms.Platform.UWP
+#else
+[assembly: Xamarin.Forms.Dependency(typeof(Xamarin.Forms.Platform.WinRT.NativeBindingService))]
+namespace Xamarin.Forms.Platform.WinRT
+#endif
+{
+ public class NativeBindingService : Xaml.INativeBindingService
+ {
+ public bool TrySetBinding(object target, string propertyName, BindingBase binding)
+ {
+ var view = target as FrameworkElement;
+ if (view == null)
+ return false;
+ if (target.GetType().GetProperty(propertyName)?.GetMethod == null)
+ return false;
+ view.SetBinding(propertyName, binding);
+ return true;
+ }
+
+ public bool TrySetBinding(object target, BindableProperty property, BindingBase binding)
+ {
+ var view = target as FrameworkElement;
+ if (view == null)
+ return false;
+ view.SetBinding(property, binding);
+ return true;
+ }
+
+ public bool TrySetValue(object target, BindableProperty property, object value)
+ {
+ var view = target as FrameworkElement;
+ if (view == null)
+ return false;
+ view.SetValue(property, value);
+ return true;
+ }
+ }
+}
diff --git a/Xamarin.Forms.Platform.UAP/NativeValueConverterService.cs b/Xamarin.Forms.Platform.UAP/NativeValueConverterService.cs
new file mode 100644
index 00000000..1f0ef68a
--- /dev/null
+++ b/Xamarin.Forms.Platform.UAP/NativeValueConverterService.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Windows.UI.Xaml;
+
+#if WINDOWS_UWP
+[assembly: Xamarin.Forms.Dependency(typeof(Xamarin.Forms.Platform.UWP.NativeValueConverterService))]
+namespace Xamarin.Forms.Platform.UWP
+#else
+[assembly: Xamarin.Forms.Dependency(typeof(Xamarin.Forms.Platform.WinRT.NativeValueConverterService))]
+namespace Xamarin.Forms.Platform.WinRT
+#endif
+{
+ public class NativeValueConverterService : Xaml.INativeValueConverterService
+ {
+ public bool ConvertTo(object value, Type toType, out object nativeValue)
+ {
+ nativeValue = null;
+ if (typeof(FrameworkElement).IsInstanceOfType(value) && toType.IsAssignableFrom(typeof(View)))
+ {
+ nativeValue = ((FrameworkElement)value).ToView();
+ return true;
+ }
+ return false;
+ }
+ }
+}
diff --git a/Xamarin.Forms.Platform.UAP/Xamarin.Forms.Platform.UAP.csproj b/Xamarin.Forms.Platform.UAP/Xamarin.Forms.Platform.UAP.csproj
index ce1b1066..4f383064 100644
--- a/Xamarin.Forms.Platform.UAP/Xamarin.Forms.Platform.UAP.csproj
+++ b/Xamarin.Forms.Platform.UAP/Xamarin.Forms.Platform.UAP.csproj
@@ -158,6 +158,15 @@
<Compile Include="..\Xamarin.Forms.Platform.WinRT\IWrapperAware.cs">
<Link>IWrapperAware.cs</Link>
</Compile>
+ <Compile Include="..\Xamarin.Forms.Platform.WinRT\NativeBindingExtensions.cs">
+ <Link>NativeBindingExtensions.cs</Link>
+ </Compile>
+ <Compile Include="..\Xamarin.Forms.Platform.WinRT\NativeEventWrapper.cs">
+ <Link>NativeEventWrapper.cs</Link>
+ </Compile>
+ <Compile Include="..\Xamarin.Forms.Platform.WinRT\NativePropertyListener.cs">
+ <Link>NativePropertyListener.cs</Link>
+ </Compile>
<Compile Include="..\Xamarin.Forms.Platform.WinRT\NativeViewWrapper.cs">
<Link>NativeViewWrapper.cs</Link>
</Compile>
@@ -180,6 +189,8 @@
<Link>LayoutExtensions.cs</Link>
</Compile>
<Compile Include="IToolBarForegroundBinder.cs" />
+ <Compile Include="NativeBindingService.cs" />
+ <Compile Include="NativeValueConverterService.cs" />
<Compile Include="SearchBarRenderer.cs" />
<Compile Include="..\Xamarin.Forms.Platform.WinRT\TextAlignmentToHorizontalAlignmentConverter.cs">
<Link>TextAlignmentToHorizontalAlignmentConverter.cs</Link>
diff --git a/Xamarin.Forms.Platform.WP8/VisualElementTracker.cs b/Xamarin.Forms.Platform.WP8/VisualElementTracker.cs
index 21633806..45b51a95 100644
--- a/Xamarin.Forms.Platform.WP8/VisualElementTracker.cs
+++ b/Xamarin.Forms.Platform.WP8/VisualElementTracker.cs
@@ -13,7 +13,15 @@ namespace Xamarin.Forms.Platform.WinPhone
{
public abstract FrameworkElement Child { get; set; }
- public abstract void Dispose();
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ }
public event EventHandler Updated;
@@ -106,29 +114,35 @@ namespace Xamarin.Forms.Platform.WinPhone
}
}
- public override void Dispose()
+ protected override void Dispose(bool disposing)
{
if (_disposed)
return;
+
_disposed = true;
- if (_element != null)
+ if (disposing)
{
- _element.Tap -= ElementOnTap;
- _element.DoubleTap -= ElementOnDoubleTap;
- _element.ManipulationDelta -= OnManipulationDelta;
- _element.ManipulationCompleted -= OnManipulationCompleted;
- }
+ if (_element != null)
+ {
+ _element.Tap -= ElementOnTap;
+ _element.DoubleTap -= ElementOnDoubleTap;
+ _element.ManipulationDelta -= OnManipulationDelta;
+ _element.ManipulationCompleted -= OnManipulationCompleted;
+ }
- if (_model != null)
- {
- _model.BatchCommitted -= HandleRedrawNeeded;
- _model.PropertyChanged -= HandlePropertyChanged;
+ if (_model != null)
+ {
+ _model.BatchCommitted -= HandleRedrawNeeded;
+ _model.PropertyChanged -= HandlePropertyChanged;
+ }
+
+ Child = null;
+ Model = null;
+ Element = null;
}
- Child = null;
- Model = null;
- Element = null;
+ base.Dispose(disposing);
}
protected virtual void HandlePropertyChanged(object sender, PropertyChangedEventArgs e)
diff --git a/Xamarin.Forms.Platform.WinRT.Phone/PhoneResources.xaml b/Xamarin.Forms.Platform.WinRT.Phone/PhoneResources.xaml
index 41ec603d..d0e069fd 100644
--- a/Xamarin.Forms.Platform.WinRT.Phone/PhoneResources.xaml
+++ b/Xamarin.Forms.Platform.WinRT.Phone/PhoneResources.xaml
@@ -435,9 +435,8 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
-
- <Grid Height="79" Background="{TemplateBinding NavigationBarBackground}"
- Visibility="{TemplateBinding TitleVisibility}">
+
+ <Grid Height="79" Background="{TemplateBinding ToolbarBackground}" Visibility="{TemplateBinding TitleVisibility}">
<TextBlock Margin="10,0,0,0" Name="title" Foreground="{TemplateBinding TitleBrush}" VerticalAlignment="Center" Style="{ThemeResource HeaderTextBlockStyle}" Text="{Binding Title}" />
</Grid>
<ContentPresenter x:Name="presenter" Grid.Row="1" ContentTransitions="{TemplateBinding ContentTransitions}" />
diff --git a/Xamarin.Forms.Platform.WinRT.Tablet/TabletResources.xaml b/Xamarin.Forms.Platform.WinRT.Tablet/TabletResources.xaml
index a57b4f0a..c782d5d9 100644
--- a/Xamarin.Forms.Platform.WinRT.Tablet/TabletResources.xaml
+++ b/Xamarin.Forms.Platform.WinRT.Tablet/TabletResources.xaml
@@ -327,8 +327,7 @@
<RowDefinition Height="*" />
</Grid.RowDefinitions>
- <Grid Grid.Row="0" Grid.Column="0" Height="79" VerticalAlignment="Center" Background="{TemplateBinding NavigationBarBackground}"
- Visibility="{TemplateBinding TitleVisibility}">
+ <Grid Grid.Row="0" Grid.Column="0" Height="79" VerticalAlignment="Center" Background="{TemplateBinding ToolbarBackground}" Visibility="{TemplateBinding TitleVisibility}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" MinWidth="{Binding TitleInset,RelativeSource={RelativeSource TemplatedParent}}" />
<ColumnDefinition Width="*" />
diff --git a/Xamarin.Forms.Platform.WinRT/FrameworkElementExtensions.cs b/Xamarin.Forms.Platform.WinRT/FrameworkElementExtensions.cs
index eb040e02..f94f3d62 100644
--- a/Xamarin.Forms.Platform.WinRT/FrameworkElementExtensions.cs
+++ b/Xamarin.Forms.Platform.WinRT/FrameworkElementExtensions.cs
@@ -128,5 +128,21 @@ namespace Xamarin.Forms.Platform.WinRT
return foregroundProperty;
}
+
+ internal static IEnumerable<T> GetChildren<T>(this DependencyObject parent) where T : DependencyObject
+ {
+ int myChildrenCount = VisualTreeHelper.GetChildrenCount(parent);
+ for (int i = 0; i < myChildrenCount; i++)
+ {
+ var child = VisualTreeHelper.GetChild(parent, i);
+ if (child is T)
+ yield return child as T;
+ else
+ {
+ foreach (var subChild in child.GetChildren<T>())
+ yield return subChild;
+ }
+ }
+ }
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.WinRT/LabelRenderer.cs b/Xamarin.Forms.Platform.WinRT/LabelRenderer.cs
index 3997e7e4..33f1fee3 100644
--- a/Xamarin.Forms.Platform.WinRT/LabelRenderer.cs
+++ b/Xamarin.Forms.Platform.WinRT/LabelRenderer.cs
@@ -84,7 +84,7 @@ namespace Xamarin.Forms.Platform.WinRT
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
- if (e.PropertyName == Label.TextProperty.PropertyName)
+ if (e.PropertyName == Label.TextProperty.PropertyName || e.PropertyName == Label.FormattedTextProperty.PropertyName)
UpdateText(Control);
else if (e.PropertyName == Label.TextColorProperty.PropertyName)
UpdateColor(Control);
diff --git a/Xamarin.Forms.Platform.WinRT/NativeBindingExtensions.cs b/Xamarin.Forms.Platform.WinRT/NativeBindingExtensions.cs
new file mode 100644
index 00000000..cc88c87e
--- /dev/null
+++ b/Xamarin.Forms.Platform.WinRT/NativeBindingExtensions.cs
@@ -0,0 +1,58 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using Windows.UI.Xaml;
+using static System.String;
+#if WINDOWS_UWP
+
+namespace Xamarin.Forms.Platform.UWP
+#else
+
+namespace Xamarin.Forms.Platform.WinRT
+#endif
+{
+ public static class NativeBindingExtensions
+ {
+ public static void SetBinding(this FrameworkElement view, string propertyName, BindingBase bindingBase, string updateSourceEventName = null)
+ {
+ var binding = bindingBase as Binding;
+ updateSourceEventName = updateSourceEventName ?? binding?.UpdateSourceEventName;
+
+ if (IsNullOrEmpty(updateSourceEventName))
+ {
+ NativePropertyListener nativePropertyListener = null;
+ if (bindingBase.Mode == BindingMode.TwoWay)
+ nativePropertyListener = new NativePropertyListener(view, propertyName);
+
+ NativeBindingHelpers.SetBinding(view, propertyName, bindingBase, nativePropertyListener as INotifyPropertyChanged);
+ return;
+ }
+
+ NativeEventWrapper eventE = null;
+ if (binding.Mode == BindingMode.TwoWay && !(view is INotifyPropertyChanged))
+ eventE = new NativeEventWrapper(view, propertyName, updateSourceEventName);
+
+ NativeBindingHelpers.SetBinding(view, propertyName, binding, eventE);
+ }
+
+ public static void SetBinding(this FrameworkElement view, BindableProperty targetProperty, BindingBase binding)
+ {
+ NativeBindingHelpers.SetBinding(view, targetProperty, binding);
+ }
+
+ public static void SetValue(this FrameworkElement target, BindableProperty targetProperty, object value)
+ {
+ NativeBindingHelpers.SetValue(target, targetProperty, value);
+ }
+
+ public static void SetBindingContext(this FrameworkElement target, object bindingContext, Func<FrameworkElement, IEnumerable<FrameworkElement>> getChildren = null)
+ {
+ NativeBindingHelpers.SetBindingContext(target, bindingContext, getChildren);
+ }
+
+ internal static void TransferbindablePropertiesToWrapper(this FrameworkElement target, View wrapper)
+ {
+ NativeBindingHelpers.TransferBindablePropertiesToWrapper(target, wrapper);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.WinRT/NativeEventWrapper.cs b/Xamarin.Forms.Platform.WinRT/NativeEventWrapper.cs
new file mode 100644
index 00000000..e28ca0eb
--- /dev/null
+++ b/Xamarin.Forms.Platform.WinRT/NativeEventWrapper.cs
@@ -0,0 +1,45 @@
+using System;
+using System.ComponentModel;
+using System.Linq;
+using System.Reflection;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.UI.Xaml;
+
+#if WINDOWS_UWP
+namespace Xamarin.Forms.Platform.UWP
+#else
+namespace Xamarin.Forms.Platform.WinRT
+#endif
+{
+ class NativeEventWrapper : INotifyPropertyChanged
+ {
+ static string TargetProperty { get; set; }
+ static readonly MethodInfo s_handlerinfo = typeof(NativeEventWrapper).GetRuntimeMethods().Single(mi => mi.Name == nameof(OnPropertyChanged) && mi.IsPublic == false);
+
+ public NativeEventWrapper(object target, string targetProperty, string updateSourceEventName)
+ {
+ TargetProperty = targetProperty;
+ try {
+ var updateSourceEvent = target.GetType().GetRuntimeEvent(updateSourceEventName);
+ MethodInfo addMethod = updateSourceEvent.AddMethod;
+ MethodInfo removeMethod = updateSourceEvent.RemoveMethod;
+ ParameterInfo[] addParameters = addMethod.GetParameters();
+ Type delegateType = addParameters[0].ParameterType;
+ var handlerDelegate = s_handlerinfo.CreateDelegate(delegateType, this);
+ Func<object, EventRegistrationToken> add = a => (EventRegistrationToken)addMethod.Invoke(target, new object[] { handlerDelegate });
+ Action<EventRegistrationToken> remove = t => removeMethod.Invoke(target, new object[] { t });
+ WindowsRuntimeMarshal.AddEventHandler(add, remove, s_handlerinfo);
+ }
+ catch (Exception) {
+ Log.Warning(nameof(NativeEventWrapper), "Can not attach NativeEventWrapper.");
+ }
+ }
+
+ void OnPropertyChanged(object sender, RoutedEventArgs e)
+ {
+ PropertyChanged?.Invoke(sender, new PropertyChangedEventArgs(TargetProperty));
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+ }
+}
diff --git a/Xamarin.Forms.Platform.WinRT/NativePropertyListener.cs b/Xamarin.Forms.Platform.WinRT/NativePropertyListener.cs
new file mode 100644
index 00000000..5a1b294c
--- /dev/null
+++ b/Xamarin.Forms.Platform.WinRT/NativePropertyListener.cs
@@ -0,0 +1,47 @@
+using System;
+using System.ComponentModel;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Data;
+
+#if WINDOWS_UWP
+namespace Xamarin.Forms.Platform.UWP
+#else
+namespace Xamarin.Forms.Platform.WinRT
+#endif
+{
+ class NativePropertyListener : DependencyObject, INotifyPropertyChanged
+ {
+ readonly DependencyObject _target;
+ readonly string _targetProperty;
+
+ public static readonly DependencyProperty TargetPropertyValueProperty = DependencyProperty.Register(nameof(TargetPropertyValue), typeof(object), typeof(NativePropertyListener), new PropertyMetadata(null, OnNativePropertyChanged));
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ public NativePropertyListener(DependencyObject target, string propertyName)
+ {
+ _target = target;
+ _targetProperty = propertyName;
+ BindingOperations.SetBinding(this, TargetPropertyValueProperty, new Windows.UI.Xaml.Data.Binding() { Source = _target, Path = new PropertyPath(_targetProperty), Mode = Windows.UI.Xaml.Data.BindingMode.OneWay });
+ }
+
+ public void Dispose()
+ {
+ ClearValue(TargetPropertyValueProperty);
+ }
+
+ public object TargetPropertyValue
+ {
+ get
+ {
+ return GetValue(TargetPropertyValueProperty);
+ }
+ }
+
+ static void OnNativePropertyChanged(object sender, DependencyPropertyChangedEventArgs args)
+ {
+ NativePropertyListener source = (NativePropertyListener)sender;
+ source?.PropertyChanged?.Invoke(source._target, new PropertyChangedEventArgs(source._targetProperty));
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.WinRT/NativeViewWrapper.cs b/Xamarin.Forms.Platform.WinRT/NativeViewWrapper.cs
index 824f0eed..22cca62e 100644
--- a/Xamarin.Forms.Platform.WinRT/NativeViewWrapper.cs
+++ b/Xamarin.Forms.Platform.WinRT/NativeViewWrapper.cs
@@ -1,4 +1,5 @@
using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
#if WINDOWS_UWP
@@ -17,6 +18,7 @@ namespace Xamarin.Forms.Platform.WinRT
ArrangeOverrideDelegate = arrangeOverrideDelegate;
MeasureOverrideDelegate = measureOverrideDelegate;
NativeElement = nativeElement;
+ nativeElement.TransferbindablePropertiesToWrapper(this);
}
public ArrangeOverrideDelegate ArrangeOverrideDelegate { get; set; }
@@ -26,5 +28,11 @@ namespace Xamarin.Forms.Platform.WinRT
public MeasureOverrideDelegate MeasureOverrideDelegate { get; set; }
public FrameworkElement NativeElement { get; }
+
+ protected override void OnBindingContextChanged()
+ {
+ NativeElement.SetBindingContext(BindingContext, nv => nv.GetChildren<FrameworkElement>());
+ base.OnBindingContextChanged();
+ }
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.WinRT/VisualElementPackager.cs b/Xamarin.Forms.Platform.WinRT/VisualElementPackager.cs
index 686da587..f2e8794d 100644
--- a/Xamarin.Forms.Platform.WinRT/VisualElementPackager.cs
+++ b/Xamarin.Forms.Platform.WinRT/VisualElementPackager.cs
@@ -46,6 +46,12 @@ namespace Xamarin.Forms.Platform.WinRT
public void Dispose()
{
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
if (_disposed)
return;
diff --git a/Xamarin.Forms.Platform.WinRT/Xamarin.Forms.Platform.WinRT.csproj b/Xamarin.Forms.Platform.WinRT/Xamarin.Forms.Platform.WinRT.csproj
index fd73aae0..22068d0b 100644
--- a/Xamarin.Forms.Platform.WinRT/Xamarin.Forms.Platform.WinRT.csproj
+++ b/Xamarin.Forms.Platform.WinRT/Xamarin.Forms.Platform.WinRT.csproj
@@ -66,10 +66,12 @@
<Compile Include="..\Xamarin.Forms.Core\Properties\GlobalAssemblyInfo.cs">
<Link>Properties\GlobalAssemblyInfo.cs</Link>
</Compile>
- <Compile Include="PlatformConfigurationExtensions.cs" />
</ItemGroup>
<ItemGroup Condition=" '$(OS)' != 'Unix' ">
- <Compile Include="BrushHelpers.cs" />
+ <Compile Include="BrushHelpers.cs" />
+ <Compile Include="NativeBindingExtensions.cs" />
+ <Compile Include="NativeEventWrapper.cs" />
+ <Compile Include="NativePropertyListener.cs" />
<Compile Include="NativeViewWrapper.cs" />
<Compile Include="NativeViewWrapperRenderer.cs" />
<Compile Include="ViewExtensions.cs" />
@@ -166,6 +168,13 @@
<Compile Include="HorizontalTextAlignmentConverter.cs" />
<Compile Include="AlignmentExtensions.cs" />
<Compile Include="TextAlignmentToHorizontalAlignmentConverter.cs" />
+ <Compile Include="..\Xamarin.Forms.Platform.UAP\NativeBindingService.cs">
+ <Link>NativeBindingService.cs</Link>
+ </Compile>
+ <Compile Include="..\Xamarin.Forms.Platform.UAP\NativeValueConverterService.cs">
+ <Link>NativeValueConverterService.cs</Link>
+ </Compile>
+ <Compile Include="PlatformConfigurationExtensions.cs" />
<Page Include="PageControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -183,4 +192,4 @@
<Target Name="AfterBuild">
</Target>
-->
-</Project> \ No newline at end of file
+</Project>
diff --git a/Xamarin.Forms.Platform.iOS/CADisplayLinkTicker.cs b/Xamarin.Forms.Platform.iOS/CADisplayLinkTicker.cs
index e9102978..8b60b010 100644
--- a/Xamarin.Forms.Platform.iOS/CADisplayLinkTicker.cs
+++ b/Xamarin.Forms.Platform.iOS/CADisplayLinkTicker.cs
@@ -1,17 +1,10 @@
using System;
using System.Collections.Concurrent;
using System.Threading;
-using Xamarin.Forms.Internals;
-#if __UNIFIED__
-using UIKit;
using CoreAnimation;
using Foundation;
-
-#else
-using MonoTouch.UIKit;
-using MonoTouch.CoreAnimation;
-using MonoTouch.Foundation;
-#endif
+using UIKit;
+using Xamarin.Forms.Internals;
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/Cells/CellRenderer.cs b/Xamarin.Forms.Platform.iOS/Cells/CellRenderer.cs
index 3ec12bd8..ea0e8d3f 100644
--- a/Xamarin.Forms.Platform.iOS/Cells/CellRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Cells/CellRenderer.cs
@@ -1,13 +1,6 @@
using System;
-using Xamarin.Forms.Internals;
-#if __UNIFIED__
using UIKit;
-using Foundation;
-
-#else
-using MonoTouch.UIKit;
-using MonoTouch.Foundation;
-#endif
+using Xamarin.Forms.Internals;
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/Cells/CellTableViewCell.cs b/Xamarin.Forms.Platform.iOS/Cells/CellTableViewCell.cs
index 4d9918fa..e32e86cd 100644
--- a/Xamarin.Forms.Platform.iOS/Cells/CellTableViewCell.cs
+++ b/Xamarin.Forms.Platform.iOS/Cells/CellTableViewCell.cs
@@ -1,13 +1,7 @@
using System;
using System.ComponentModel;
-using Xamarin.Forms.Internals;
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-
namespace Xamarin.Forms.Platform.iOS
{
public class CellTableViewCell : UITableViewCell, INativeElementView
@@ -32,7 +26,7 @@ namespace Xamarin.Forms.Platform.iOS
if (cellController != null)
Device.BeginInvokeOnMainThread(cellController.SendDisappearing);
-
+
_cell = value;
cellController = value;
@@ -91,7 +85,7 @@ namespace Xamarin.Forms.Platform.iOS
contextCell.Update(tableView, cell, nativeCell);
var viewTableCell = contextCell.ContentCell as ViewCellRenderer.ViewTableCell;
if (viewTableCell != null)
- viewTableCell.SupressSeparator = true;
+ viewTableCell.SupressSeparator = tableView.SeparatorStyle == UITableViewCellSeparatorStyle.None;
nativeCell = contextCell;
}
diff --git a/Xamarin.Forms.Platform.iOS/Cells/EntryCellRenderer.cs b/Xamarin.Forms.Platform.iOS/Cells/EntryCellRenderer.cs
index e94e0ea5..b00ff9dd 100644
--- a/Xamarin.Forms.Platform.iOS/Cells/EntryCellRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Cells/EntryCellRenderer.cs
@@ -1,21 +1,7 @@
using System;
using System.ComponentModel;
-using System.Drawing;
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-#if __UNIFIED__
using RectangleF = CoreGraphics.CGRect;
-using SizeF = CoreGraphics.CGSize;
-using PointF = CoreGraphics.CGPoint;
-
-#else
-using nfloat=System.Single;
-using nint=System.Int32;
-using nuint=System.UInt32;
-#endif
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/Cells/ImageCellRenderer.cs b/Xamarin.Forms.Platform.iOS/Cells/ImageCellRenderer.cs
index 010319ba..38aae375 100644
--- a/Xamarin.Forms.Platform.iOS/Cells/ImageCellRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Cells/ImageCellRenderer.cs
@@ -1,14 +1,7 @@
using System.ComponentModel;
using System.Threading.Tasks;
-using Xamarin.Forms.Internals;
-#if __UNIFIED__
-using UIKit;
using Foundation;
-
-#else
-using MonoTouch.UIKit;
-using MonoTouch.Foundation;
-#endif
+using UIKit;
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/Cells/SwitchCellRenderer.cs b/Xamarin.Forms.Platform.iOS/Cells/SwitchCellRenderer.cs
index ed7ddc10..d93ec5c1 100644
--- a/Xamarin.Forms.Platform.iOS/Cells/SwitchCellRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Cells/SwitchCellRenderer.cs
@@ -1,13 +1,8 @@
using System;
using System.ComponentModel;
using System.Drawing;
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-
namespace Xamarin.Forms.Platform.iOS
{
public class SwitchCellRenderer : CellRenderer
diff --git a/Xamarin.Forms.Platform.iOS/Cells/TextCellRenderer.cs b/Xamarin.Forms.Platform.iOS/Cells/TextCellRenderer.cs
index 41c43341..2f5cfdd1 100644
--- a/Xamarin.Forms.Platform.iOS/Cells/TextCellRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Cells/TextCellRenderer.cs
@@ -1,11 +1,6 @@
using System.ComponentModel;
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-
namespace Xamarin.Forms.Platform.iOS
{
public class TextCellRenderer : CellRenderer
diff --git a/Xamarin.Forms.Platform.iOS/Cells/ViewCellRenderer.cs b/Xamarin.Forms.Platform.iOS/Cells/ViewCellRenderer.cs
index 852f455a..8f8a92ce 100644
--- a/Xamarin.Forms.Platform.iOS/Cells/ViewCellRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Cells/ViewCellRenderer.cs
@@ -1,23 +1,8 @@
using System;
using System.ComponentModel;
-using Xamarin.Forms.Internals;
-
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-using System.Drawing;
-#endif
-#if __UNIFIED__
using RectangleF = CoreGraphics.CGRect;
using SizeF = CoreGraphics.CGSize;
-using PointF = CoreGraphics.CGPoint;
-
-#else
-using nfloat=System.Single;
-using nint=System.Int32;
-using nuint=System.UInt32;
-#endif
namespace Xamarin.Forms.Platform.iOS
{
@@ -81,10 +66,7 @@ namespace Xamarin.Forms.Platform.iOS
}
}
- Element INativeElementView.Element
- {
- get { return ViewCell; }
- }
+ Element INativeElementView.Element => ViewCell;
internal bool SupressSeparator { get; set; }
@@ -93,10 +75,11 @@ namespace Xamarin.Forms.Platform.iOS
//This sets the content views frame.
base.LayoutSubviews();
- if (SupressSeparator)
+ //TODO: Determine how best to hide the separator line when there is an accessory on the cell
+ if (SupressSeparator && Accessory == UITableViewCellAccessory.None)
{
var oldFrame = Frame;
- ContentView.Bounds = Frame = new RectangleF(oldFrame.Location, new SizeF(oldFrame.Width, oldFrame.Height + 0.5f));
+ ContentView.Bounds = new RectangleF(oldFrame.Location, new SizeF(oldFrame.Width, oldFrame.Height + 0.5f));
}
var contentFrame = ContentView.Frame;
@@ -118,10 +101,10 @@ namespace Xamarin.Forms.Platform.iOS
if (!_rendererRef.TryGetTarget(out renderer))
return base.SizeThatFits(size);
- if (renderer.Element == null)
- return SizeF.Empty;
-
- double width = size.Width;
+ if (renderer.Element == null)
+ return SizeF.Empty;
+
+ double width = size.Width;
var height = size.Height > 0 ? size.Height : double.PositiveInfinity;
var result = renderer.Element.Measure(width, height);
diff --git a/Xamarin.Forms.Platform.iOS/ContextActionCell.cs b/Xamarin.Forms.Platform.iOS/ContextActionCell.cs
index 5d50d31d..bb7bea1a 100644
--- a/Xamarin.Forms.Platform.iOS/ContextActionCell.cs
+++ b/Xamarin.Forms.Platform.iOS/ContextActionCell.cs
@@ -1,25 +1,13 @@
using System;
+using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
-using System.Collections.Generic;
-using System.Drawing;
-using Xamarin.Forms.Platform.iOS.Resources;
-#if __UNIFIED__
-using UIKit;
using Foundation;
-#else
-using MonoTouch.UIKit;
-using MonoTouch.Foundation;
-#endif
-#if __UNIFIED__
+using UIKit;
+using Xamarin.Forms.Platform.iOS.Resources;
+using PointF = CoreGraphics.CGPoint;
using RectangleF = CoreGraphics.CGRect;
using SizeF = CoreGraphics.CGSize;
-using PointF = CoreGraphics.CGPoint;
-
-#else
-using nfloat=System.Single;
-using nint=System.Int32;
-#endif
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/ContextScrollViewDelegate.cs b/Xamarin.Forms.Platform.iOS/ContextScrollViewDelegate.cs
index b2b34e4a..bc04ede2 100644
--- a/Xamarin.Forms.Platform.iOS/ContextScrollViewDelegate.cs
+++ b/Xamarin.Forms.Platform.iOS/ContextScrollViewDelegate.cs
@@ -1,23 +1,9 @@
using System;
-using System.Drawing;
using System.Collections.Generic;
-#if __UNIFIED__
using UIKit;
-using Foundation;
-#else
-using MonoTouch.UIKit;
-using MonoTouch.Foundation;
-#endif
-#if __UNIFIED__
using NSAction = System.Action;
-using RectangleF = CoreGraphics.CGRect;
-using SizeF = CoreGraphics.CGSize;
using PointF = CoreGraphics.CGPoint;
-
-#else
-using nfloat=System.Single;
-using nint=System.Int32;
-#endif
+using RectangleF = CoreGraphics.CGRect;
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/EventTracker.cs b/Xamarin.Forms.Platform.iOS/EventTracker.cs
index 16ccd505..9c6c90e9 100644
--- a/Xamarin.Forms.Platform.iOS/EventTracker.cs
+++ b/Xamarin.Forms.Platform.iOS/EventTracker.cs
@@ -3,21 +3,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-#if __UNIFIED__
-using RectangleF = CoreGraphics.CGRect;
-using SizeF = CoreGraphics.CGSize;
-using PointF = CoreGraphics.CGPoint;
-
-#else
-using nfloat=System.Single;
-using nint=System.Int32;
-using nuint=System.UInt32;
-#endif
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/Extensions/CellExtensions.cs b/Xamarin.Forms.Platform.iOS/Extensions/CellExtensions.cs
index 7243456b..80473a8c 100644
--- a/Xamarin.Forms.Platform.iOS/Extensions/CellExtensions.cs
+++ b/Xamarin.Forms.Platform.iOS/Extensions/CellExtensions.cs
@@ -1,11 +1,6 @@
using System;
-using Xamarin.Forms.Internals;
-#if __UNIFIED__
using Foundation;
-
-#else
-using MonoTouch.Foundation;
-#endif
+using Xamarin.Forms.Internals;
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/Extensions/ColorExtensions.cs b/Xamarin.Forms.Platform.iOS/Extensions/ColorExtensions.cs
index f512e157..bb4342ab 100644
--- a/Xamarin.Forms.Platform.iOS/Extensions/ColorExtensions.cs
+++ b/Xamarin.Forms.Platform.iOS/Extensions/ColorExtensions.cs
@@ -1,28 +1,9 @@
using System;
-using System.ComponentModel;
-using System.Drawing;
-using System.Linq;
-#if __UNIFIED__
-using CoreAnimation;
using CoreGraphics;
-using Foundation;
using UIKit;
-#else
-using MonoTouch.CoreAnimation;
-using MonoTouch.CoreGraphics;
-using MonoTouch.Foundation;
-using MonoTouch.UIKit;
-#endif
-#if __UNIFIED__
+using PointF = CoreGraphics.CGPoint;
using RectangleF = CoreGraphics.CGRect;
using SizeF = CoreGraphics.CGSize;
-using PointF = CoreGraphics.CGPoint;
-
-#else
-using nfloat=System.Single;
-using nint=System.Int32;
-using nuint=System.UInt32;
-#endif
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/Extensions/DateExtensions.cs b/Xamarin.Forms.Platform.iOS/Extensions/DateExtensions.cs
index a75e7a69..bb0dfff9 100644
--- a/Xamarin.Forms.Platform.iOS/Extensions/DateExtensions.cs
+++ b/Xamarin.Forms.Platform.iOS/Extensions/DateExtensions.cs
@@ -1,20 +1,5 @@
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Drawing;
-using System.Linq;
-#if __UNIFIED__
-using CoreAnimation;
-using CoreGraphics;
using Foundation;
-using UIKit;
-
-#else
-using MonoTouch.CoreAnimation;
-using MonoTouch.CoreGraphics;
-using MonoTouch.Foundation;
-using MonoTouch.UIKit;
-#endif
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/Extensions/Extensions.cs b/Xamarin.Forms.Platform.iOS/Extensions/Extensions.cs
index e74fed8d..3b24c1a8 100644
--- a/Xamarin.Forms.Platform.iOS/Extensions/Extensions.cs
+++ b/Xamarin.Forms.Platform.iOS/Extensions/Extensions.cs
@@ -1,12 +1,5 @@
-using System;
-using System.Collections.Generic;
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-
namespace Xamarin.Forms.Platform.iOS
{
public static class Extensions
diff --git a/Xamarin.Forms.Platform.iOS/LayoutExtensions.cs b/Xamarin.Forms.Platform.iOS/Extensions/LayoutExtensions.cs
index 6e7f5738..823c3f30 100644
--- a/Xamarin.Forms.Platform.iOS/LayoutExtensions.cs
+++ b/Xamarin.Forms.Platform.iOS/Extensions/LayoutExtensions.cs
@@ -1,17 +1,7 @@
using System.Collections.Generic;
-#if __UNIFIED__
using CoreGraphics;
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-
-#if !__UNIFIED__
- // Save ourselves a ton of ugly ifdefs below
-using CGSize = System.Drawing.SizeF;
-#endif
-
namespace Xamarin.Forms.Platform.iOS
{
public delegate SizeRequest? GetDesiredSizeDelegate(NativeViewWrapperRenderer renderer, double widthConstraint, double heightConstraint);
diff --git a/Xamarin.Forms.Platform.iOS/Extensions/ToolbarItemExtensions.cs b/Xamarin.Forms.Platform.iOS/Extensions/ToolbarItemExtensions.cs
index 3ee09643..295ebd52 100644
--- a/Xamarin.Forms.Platform.iOS/Extensions/ToolbarItemExtensions.cs
+++ b/Xamarin.Forms.Platform.iOS/Extensions/ToolbarItemExtensions.cs
@@ -1,23 +1,9 @@
-using System;
-using System.Drawing;
using System.ComponentModel;
-#if __UNIFIED__
using CoreGraphics;
using UIKit;
-#else
-using MonoTouch.CoreGraphics;
-using MonoTouch.UIKit;
-#endif
-#if __UNIFIED__
+using PointF = CoreGraphics.CGPoint;
using RectangleF = CoreGraphics.CGRect;
using SizeF = CoreGraphics.CGSize;
-using PointF = CoreGraphics.CGPoint;
-
-#else
-using nfloat=System.Single;
-using nint=System.Int32;
-using nuint=System.UInt32;
-#endif
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/Extensions/UIViewExtensions.cs b/Xamarin.Forms.Platform.iOS/Extensions/UIViewExtensions.cs
index 9847867c..eab88e81 100644
--- a/Xamarin.Forms.Platform.iOS/Extensions/UIViewExtensions.cs
+++ b/Xamarin.Forms.Platform.iOS/Extensions/UIViewExtensions.cs
@@ -1,13 +1,9 @@
+using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
-using System;
-#if __UNIFIED__
using UIKit;
-
-#else
-using MonoTouch.UIKit;
-#endif
+using static System.String;
namespace Xamarin.Forms.Platform.iOS
{
@@ -28,6 +24,47 @@ namespace Xamarin.Forms.Platform.iOS
return new SizeRequest(request, minimum);
}
+ public static void SetBinding(this UIView view, string propertyName, BindingBase bindingBase, string updateSourceEventName = null)
+ {
+ var binding = bindingBase as Binding;
+ //This will allow setting bindings from Xaml by reusing the MarkupExtension
+ updateSourceEventName = updateSourceEventName ?? binding?.UpdateSourceEventName;
+
+ if (!IsNullOrEmpty(updateSourceEventName))
+ {
+ NativeBindingHelpers.SetBinding(view, propertyName, bindingBase, updateSourceEventName);
+ return;
+ }
+
+ NativeViewPropertyListener nativePropertyListener = null;
+ if (bindingBase.Mode == BindingMode.TwoWay) {
+ nativePropertyListener = new NativeViewPropertyListener(propertyName);
+ view.AddObserver(nativePropertyListener, propertyName, 0, IntPtr.Zero);
+ }
+
+ NativeBindingHelpers.SetBinding(view, propertyName, bindingBase, nativePropertyListener);
+ }
+
+ public static void SetBinding(this UIView self, BindableProperty targetProperty, BindingBase binding)
+ {
+ NativeBindingHelpers.SetBinding(self, targetProperty, binding);
+ }
+
+ public static void SetValue(this UIView target, BindableProperty targetProperty, object value)
+ {
+ NativeBindingHelpers.SetValue(target, targetProperty, value);
+ }
+
+ public static void SetBindingContext(this UIView target, object bindingContext, Func<UIView, IEnumerable<UIView>> getChildren = null)
+ {
+ NativeBindingHelpers.SetBindingContext(target, bindingContext, getChildren);
+ }
+
+ internal static void TransferbindablePropertiesToWrapper(this UIView target, View wrapper)
+ {
+ NativeBindingHelpers.TransferBindablePropertiesToWrapper(target, wrapper);
+ }
+
internal static T FindDescendantView<T>(this UIView view) where T : UIView
{
var queue = new Queue<UIView>();
diff --git a/Xamarin.Forms.Platform.iOS/Forms.cs b/Xamarin.Forms.Platform.iOS/Forms.cs
index eb4100d8..820d3c0a 100644
--- a/Xamarin.Forms.Platform.iOS/Forms.cs
+++ b/Xamarin.Forms.Platform.iOS/Forms.cs
@@ -11,16 +11,10 @@ using System.Security.Cryptography;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
-using Xamarin.Forms.Internals;
-#if __UNIFIED__
-using UIKit;
using CoreFoundation;
using Foundation;
-#else
-using MonoTouch.UIKit;
-using MonoTouch.CoreFoundation;
-using MonoTouch.Foundation;
-#endif
+using UIKit;
+using Xamarin.Forms.Internals;
using Xamarin.Forms.Platform.iOS;
namespace Xamarin.Forms
@@ -241,18 +235,10 @@ namespace Xamarin.Forms
public void StartTimer(TimeSpan interval, Func<bool> callback)
{
NSTimer timer = null;
-#if __UNIFIED__
timer = NSTimer.CreateRepeatingScheduledTimer(interval, t =>
{
-#else
- timer = NSTimer.CreateRepeatingScheduledTimer (interval, () => {
- #endif
if (!callback())
-#if __UNIFIED__
t.Invalidate();
-#else
- timer.Invalidate ();
- #endif
});
NSRunLoop.Main.AddTimer(timer, NSRunLoopMode.Common);
}
diff --git a/Xamarin.Forms.Platform.iOS/FormsApplicationDelegate.cs b/Xamarin.Forms.Platform.iOS/FormsApplicationDelegate.cs
index 78dc6dca..a14bd7e7 100644
--- a/Xamarin.Forms.Platform.iOS/FormsApplicationDelegate.cs
+++ b/Xamarin.Forms.Platform.iOS/FormsApplicationDelegate.cs
@@ -1,17 +1,8 @@
using System;
using System.ComponentModel;
-using System.Linq;
-using System.Text;
-#if __UNIFIED__
+using CoreSpotlight;
using Foundation;
using UIKit;
-using CoreSpotlight;
-
-#else
-using MonoTouch.Foundation;
-using MonoTouch.UIKit;
-using MonoTouch.CoreSpotlight;
-#endif
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/GlobalCloseContextGestureRecognizer.cs b/Xamarin.Forms.Platform.iOS/GlobalCloseContextGestureRecognizer.cs
index f0e8522b..1a4e9c04 100644
--- a/Xamarin.Forms.Platform.iOS/GlobalCloseContextGestureRecognizer.cs
+++ b/Xamarin.Forms.Platform.iOS/GlobalCloseContextGestureRecognizer.cs
@@ -1,22 +1,7 @@
-using System.Collections.Generic;
-using System.Drawing;
-#if __UNIFIED__
using Foundation;
using UIKit;
-#else
-using MonoTouch.Foundation;
-using MonoTouch.UIKit;
-#endif
-#if __UNIFIED__
-using RectangleF = CoreGraphics.CGRect;
-using SizeF = CoreGraphics.CGSize;
-using PointF = CoreGraphics.CGPoint;
using NSAction = System.Action;
-
-#else
-using nfloat=System.Single;
-using nint=System.Int32;
-#endif
+using RectangleF = CoreGraphics.CGRect;
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/IVisualElementRenderer.cs b/Xamarin.Forms.Platform.iOS/IVisualElementRenderer.cs
index 5ffabf08..9a2bf580 100644
--- a/Xamarin.Forms.Platform.iOS/IVisualElementRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/IVisualElementRenderer.cs
@@ -1,11 +1,6 @@
using System;
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-
namespace Xamarin.Forms.Platform.iOS
{
public interface IVisualElementRenderer : IDisposable, IRegisterable
diff --git a/Xamarin.Forms.Platform.iOS/NativeBindingService.cs b/Xamarin.Forms.Platform.iOS/NativeBindingService.cs
new file mode 100644
index 00000000..3756e2f0
--- /dev/null
+++ b/Xamarin.Forms.Platform.iOS/NativeBindingService.cs
@@ -0,0 +1,39 @@
+using System;
+using UIKit;
+
+[assembly: Xamarin.Forms.Dependency(typeof(Xamarin.Forms.Platform.iOS.NativeBindingService))]
+
+namespace Xamarin.Forms.Platform.iOS
+{
+ class NativeBindingService : Xaml.INativeBindingService
+ {
+ public bool TrySetBinding(object target, string propertyName, BindingBase binding)
+ {
+ var view = target as UIView;
+ if (view == null)
+ return false;
+ if (target.GetType().GetProperty(propertyName)?.GetMethod == null)
+ return false;
+ view.SetBinding(propertyName, binding);
+ return true;
+ }
+
+ public bool TrySetBinding(object target, BindableProperty property, BindingBase binding)
+ {
+ var view = target as UIView;
+ if (view == null)
+ return false;
+ view.SetBinding(property, binding);
+ return true;
+ }
+
+ public bool TrySetValue(object target, BindableProperty property, object value)
+ {
+ var view = target as UIView;
+ if (view == null)
+ return false;
+ view.SetValue(property, value);
+ return true;
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.iOS/NativeValueConverterService.cs b/Xamarin.Forms.Platform.iOS/NativeValueConverterService.cs
new file mode 100644
index 00000000..9e20e045
--- /dev/null
+++ b/Xamarin.Forms.Platform.iOS/NativeValueConverterService.cs
@@ -0,0 +1,20 @@
+using System;
+using UIKit;
+
+[assembly: Xamarin.Forms.Dependency(typeof(Xamarin.Forms.Platform.iOS.NativeValueConverterService))]
+
+namespace Xamarin.Forms.Platform.iOS
+{
+ class NativeValueConverterService : Xaml.INativeValueConverterService
+ {
+ public bool ConvertTo(object value, Type toType, out object nativeValue)
+ {
+ nativeValue = null;
+ if (typeof(UIView).IsInstanceOfType(value) && toType.IsAssignableFrom(typeof(View))) {
+ nativeValue = ((UIView)value).ToView();
+ return true;
+ }
+ return false;
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.iOS/NativeViewPropertyListener.cs b/Xamarin.Forms.Platform.iOS/NativeViewPropertyListener.cs
new file mode 100644
index 00000000..2d872af2
--- /dev/null
+++ b/Xamarin.Forms.Platform.iOS/NativeViewPropertyListener.cs
@@ -0,0 +1,24 @@
+using System;
+using System.ComponentModel;
+using Foundation;
+
+namespace Xamarin.Forms.Platform.iOS
+{
+ class NativeViewPropertyListener : NSObject, INotifyPropertyChanged
+ {
+ string TargetProperty { get; set; }
+
+ public NativeViewPropertyListener(string targetProperty)
+ {
+ TargetProperty = targetProperty;
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ public override void ObserveValue(NSString keyPath, NSObject ofObject, NSDictionary change, IntPtr context)
+ {
+ if (keyPath == TargetProperty)
+ PropertyChanged?.Invoke(ofObject, new PropertyChangedEventArgs(TargetProperty));
+ }
+ }
+}
diff --git a/Xamarin.Forms.Platform.iOS/NativeViewWrapper.cs b/Xamarin.Forms.Platform.iOS/NativeViewWrapper.cs
index 209aca80..31cb186d 100644
--- a/Xamarin.Forms.Platform.iOS/NativeViewWrapper.cs
+++ b/Xamarin.Forms.Platform.iOS/NativeViewWrapper.cs
@@ -1,16 +1,4 @@
-using System.Collections.Generic;
-#if __UNIFIED__
-using CoreGraphics;
-using UIKit;
-
-#else
-using MonoTouch.UIKit;
-#endif
-
-#if !__UNIFIED__
- // Save ourselves a ton of ugly ifdefs below
-using CGSize = System.Drawing.SizeF;
-#endif
+using UIKit;
namespace Xamarin.Forms.Platform.iOS
{
@@ -22,6 +10,8 @@ namespace Xamarin.Forms.Platform.iOS
SizeThatFitsDelegate = sizeThatFitsDelegate;
LayoutSubViews = layoutSubViews;
NativeView = nativeView;
+
+ nativeView.TransferbindablePropertiesToWrapper(this);
}
public GetDesiredSizeDelegate GetDesiredSizeDelegate { get; }
@@ -31,5 +21,11 @@ namespace Xamarin.Forms.Platform.iOS
public UIView NativeView { get; }
public SizeThatFitsDelegate SizeThatFitsDelegate { get; set; }
+
+ protected override void OnBindingContextChanged()
+ {
+ NativeView.SetBindingContext(BindingContext, nv => nv.Subviews);
+ base.OnBindingContextChanged();
+ }
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.iOS/NativeViewWrapperRenderer.cs b/Xamarin.Forms.Platform.iOS/NativeViewWrapperRenderer.cs
index 58cacdc6..4d1252ee 100644
--- a/Xamarin.Forms.Platform.iOS/NativeViewWrapperRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/NativeViewWrapperRenderer.cs
@@ -1,17 +1,6 @@
-using System.Collections.Generic;
-using Xamarin.Forms.Internals;
-#if __UNIFIED__
-using CoreGraphics;
+using CoreGraphics;
using UIKit;
-
-#else
-using MonoTouch.UIKit;
-#endif
-
-#if !__UNIFIED__
- // Save ourselves a ton of ugly ifdefs below
-using CGSize = System.Drawing.SizeF;
-#endif
+using Xamarin.Forms.Internals;
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/PageExtensions.cs b/Xamarin.Forms.Platform.iOS/PageExtensions.cs
index 07da048a..51a5a33e 100644
--- a/Xamarin.Forms.Platform.iOS/PageExtensions.cs
+++ b/Xamarin.Forms.Platform.iOS/PageExtensions.cs
@@ -1,11 +1,6 @@
using System;
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-
namespace Xamarin.Forms
{
public static class PageExtensions
diff --git a/Xamarin.Forms.Platform.iOS/Platform.cs b/Xamarin.Forms.Platform.iOS/Platform.cs
index 3022fa0e..9ec4a8a8 100644
--- a/Xamarin.Forms.Platform.iOS/Platform.cs
+++ b/Xamarin.Forms.Platform.iOS/Platform.cs
@@ -1,33 +1,10 @@
using System;
using System.Collections.Generic;
-using System.ComponentModel;
-using System.Drawing;
using System.Linq;
-using System.Runtime.InteropServices;
using System.Threading.Tasks;
-
-#if __UNIFIED__
-using CoreGraphics;
using Foundation;
-using ObjCRuntime;
using UIKit;
using RectangleF = CoreGraphics.CGRect;
-using SizeF = CoreGraphics.CGSize;
-using PointF = CoreGraphics.CGPoint;
-
-#else
-using MonoTouch;
-using MonoTouch.CoreAnimation;
-using MonoTouch.CoreFoundation;
-using MonoTouch.CoreGraphics;
-using MonoTouch.UIKit;
-using MonoTouch.Foundation;
-using MonoTouch.ObjCRuntime;
-
-using nfloat = System.Single;
-using nint = System.Int32;
-using nuint = System.UInt32;
-#endif
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/PlatformEffect.cs b/Xamarin.Forms.Platform.iOS/PlatformEffect.cs
index 436ef6d7..8fb4f975 100644
--- a/Xamarin.Forms.Platform.iOS/PlatformEffect.cs
+++ b/Xamarin.Forms.Platform.iOS/PlatformEffect.cs
@@ -1,10 +1,4 @@
-using System.ComponentModel;
-#if __UNIFIED__
-using UIKit;
-
-#else
-using MonoTouch.UIKit;
-#endif
+using UIKit;
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/PlatformRenderer.cs b/Xamarin.Forms.Platform.iOS/PlatformRenderer.cs
index 554c0f50..f2d897e4 100644
--- a/Xamarin.Forms.Platform.iOS/PlatformRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/PlatformRenderer.cs
@@ -1,11 +1,5 @@
-using System;
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-
namespace Xamarin.Forms.Platform.iOS
{
internal class ModalWrapper : UIViewController
diff --git a/Xamarin.Forms.Platform.iOS/Properties/AssemblyInfo.cs b/Xamarin.Forms.Platform.iOS/Properties/AssemblyInfo.cs
index 822e143f..24df203f 100644
--- a/Xamarin.Forms.Platform.iOS/Properties/AssemblyInfo.cs
+++ b/Xamarin.Forms.Platform.iOS/Properties/AssemblyInfo.cs
@@ -5,13 +5,8 @@ using System.Runtime.CompilerServices;
using Xamarin.Forms;
using Xamarin.Forms.Internals;
using Xamarin.Forms.Platform.iOS;
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-
[assembly: AssemblyTitle("Xamarin.Forms.Platform.iOS")]
[assembly: AssemblyDescription("iOS Backend for Xamarin.Forms")]
[assembly: AssemblyConfiguration("")]
diff --git a/Xamarin.Forms.Platform.iOS/RendererPool.cs b/Xamarin.Forms.Platform.iOS/RendererPool.cs
index 51f7f4fb..babfa7bc 100644
--- a/Xamarin.Forms.Platform.iOS/RendererPool.cs
+++ b/Xamarin.Forms.Platform.iOS/RendererPool.cs
@@ -1,12 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
-#if __UNIFIED__
-using UIKit;
-
-#else
-using MonoTouch.UIKit;
-#endif
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ActivityIndicatorRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ActivityIndicatorRenderer.cs
index 0ef8741f..abd8f24f 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/ActivityIndicatorRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/ActivityIndicatorRenderer.cs
@@ -1,12 +1,7 @@
-using System.Drawing;
using System.ComponentModel;
-#if __UNIFIED__
+using System.Drawing;
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-
namespace Xamarin.Forms.Platform.iOS
{
public class ActivityIndicatorRenderer : ViewRenderer<ActivityIndicator, UIActivityIndicatorView>
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/AlignmentExtensions.cs b/Xamarin.Forms.Platform.iOS/Renderers/AlignmentExtensions.cs
index 01d0bf66..e6ae550f 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/AlignmentExtensions.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/AlignmentExtensions.cs
@@ -1,10 +1,5 @@
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-
namespace Xamarin.Forms.Platform.iOS
{
internal static class AlignmentExtensions
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/BoxRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/BoxRenderer.cs
index 20e9c38b..466773b5 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/BoxRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/BoxRenderer.cs
@@ -1,23 +1,7 @@
using System.ComponentModel;
-using System.Drawing;
-using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
-#if __UNIFIED__
using UIKit;
-using CoreGraphics;
-#else
-using MonoTouch.UIKit;
-using MonoTouch.CoreGraphics;
-#endif
-#if __UNIFIED__
using RectangleF = CoreGraphics.CGRect;
using SizeF = CoreGraphics.CGSize;
-using PointF = CoreGraphics.CGPoint;
-
-#else
-using nfloat=System.Single;
-using nint=System.Int32;
-using nuint=System.UInt32;
-#endif
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs
index 34609b49..ac972230 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs
@@ -1,22 +1,10 @@
using System;
-using System.Linq;
using System.ComponentModel;
using System.Diagnostics;
-
-#if __UNIFIED__
+using System.Linq;
using Foundation;
using UIKit;
-using RectangleF = CoreGraphics.CGRect;
using SizeF = CoreGraphics.CGSize;
-using PointF = CoreGraphics.CGPoint;
-#else
-using System.Drawing;
-using MonoTouch.UIKit;
-using MonoTouch.Foundation;
-using nfloat=System.Single;
-using nint=System.Int32;
-using nuint=System.UInt32;
-#endif
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/CarouselPageRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/CarouselPageRenderer.cs
index 49921313..58587e83 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/CarouselPageRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/CarouselPageRenderer.cs
@@ -2,23 +2,11 @@ using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
-using System.Drawing;
-using Xamarin.Forms.Internals;
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-#if __UNIFIED__
+using Xamarin.Forms.Internals;
+using PointF = CoreGraphics.CGPoint;
using RectangleF = CoreGraphics.CGRect;
using SizeF = CoreGraphics.CGSize;
-using PointF = CoreGraphics.CGPoint;
-
-#else
-using nfloat = System.Single;
-using nint = System.Int32;
-using nuint = System.UInt32;
-#endif
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/DatePickerRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/DatePickerRenderer.cs
index a591243c..710aa364 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/DatePickerRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/DatePickerRenderer.cs
@@ -1,23 +1,8 @@
using System;
-using System.Drawing;
using System.ComponentModel;
-#if __UNIFIED__
-using UIKit;
using Foundation;
-#else
-using MonoTouch.UIKit;
-using MonoTouch.Foundation;
-#endif
-#if __UNIFIED__
+using UIKit;
using RectangleF = CoreGraphics.CGRect;
-using SizeF = CoreGraphics.CGSize;
-using PointF = CoreGraphics.CGPoint;
-
-#else
-using nfloat=System.Single;
-using nint=System.Int32;
-using nuint=System.UInt32;
-#endif
namespace Xamarin.Forms.Platform.iOS
{
@@ -48,8 +33,8 @@ namespace Xamarin.Forms.Platform.iOS
{
var entry = new NoCaretField { BorderStyle = UITextBorderStyle.RoundedRect };
- entry.Started += OnStarted;
- entry.Ended += OnEnded;
+ entry.EditingDidBegin += OnStarted;
+ entry.EditingDidEnd += OnEnded;
_picker = new UIDatePicker { Mode = UIDatePickerMode.Date, TimeZone = new NSTimeZone("UTC") };
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs
index 939a9841..49126dad 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs
@@ -1,21 +1,7 @@
using System;
-using System.Drawing;
using System.ComponentModel;
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-#if __UNIFIED__
using RectangleF = CoreGraphics.CGRect;
-using SizeF = CoreGraphics.CGSize;
-using PointF = CoreGraphics.CGPoint;
-
-#else
-using nfloat=System.Single;
-using nint=System.Int32;
-using nuint=System.UInt32;
-#endif
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs
index f946de89..2e37a95b 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs
@@ -1,13 +1,8 @@
using System;
-using System.Drawing;
-using System.Runtime.Remoting.Channels;
using System.ComponentModel;
-#if __UNIFIED__
-using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
+using System.Drawing;
+using UIKit;
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/FontExtensions.cs b/Xamarin.Forms.Platform.iOS/Renderers/FontExtensions.cs
index c2e565d9..ae16c662 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/FontExtensions.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/FontExtensions.cs
@@ -1,14 +1,8 @@
-using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-
namespace Xamarin.Forms.Platform.iOS
{
public static class FontExtensions
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/FormattedStringExtensions.cs b/Xamarin.Forms.Platform.iOS/Renderers/FormattedStringExtensions.cs
index 4bb829b5..dce86b98 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/FormattedStringExtensions.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/FormattedStringExtensions.cs
@@ -1,12 +1,6 @@
-#if __UNIFIED__
using Foundation;
using UIKit;
-#else
-using MonoTouch.Foundation;
-using MonoTouch.UIKit;
-#endif
-
namespace Xamarin.Forms.Platform.iOS
{
public static class FormattedStringExtensions
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/FrameRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/FrameRenderer.cs
index 3f2f1ccb..3d2213f4 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/FrameRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/FrameRenderer.cs
@@ -1,12 +1,7 @@
using System.ComponentModel;
using System.Drawing;
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-
namespace Xamarin.Forms.Platform.iOS
{
public class FrameRenderer : VisualElementRenderer<Frame>
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ImageRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ImageRenderer.cs
index a08365e8..6f6392b1 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/ImageRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/ImageRenderer.cs
@@ -1,26 +1,11 @@
-using System.Drawing;
+using System;
using System.ComponentModel;
using System.IO;
-using System.Threading.Tasks;
using System.Threading;
-using System;
-#if __UNIFIED__
-using UIKit;
+using System.Threading.Tasks;
using Foundation;
-#else
-using MonoTouch.UIKit;
-using MonoTouch.Foundation;
-#endif
-#if __UNIFIED__
+using UIKit;
using RectangleF = CoreGraphics.CGRect;
-using SizeF = CoreGraphics.CGSize;
-using PointF = CoreGraphics.CGPoint;
-
-#else
-using nfloat=System.Single;
-using nint=System.Int32;
-using nuint=System.UInt32;
-#endif
namespace Xamarin.Forms.Platform.iOS
{
@@ -180,7 +165,7 @@ namespace Xamarin.Forms.Platform.iOS
{
public async Task<UIImage> LoadImageAsync(ImageSource imagesource, CancellationToken cancelationToken = default(CancellationToken), float scale = 1f)
{
- UIImage image = null;
+ UIImage image = null;
var streamsource = imagesource as StreamImageSource;
if (streamsource != null && streamsource.Stream != null)
{
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/KeyboardInsetTracker.cs b/Xamarin.Forms.Platform.iOS/Renderers/KeyboardInsetTracker.cs
index d5759947..95217672 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/KeyboardInsetTracker.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/KeyboardInsetTracker.cs
@@ -1,20 +1,7 @@
using System;
-using System.Drawing;
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-#if __UNIFIED__
-using RectangleF = CoreGraphics.CGRect;
-using SizeF = CoreGraphics.CGSize;
using PointF = CoreGraphics.CGPoint;
-
-#else
-using nfloat=System.Single;
-using nint=System.Int32;
-using nuint=System.UInt32;
-#endif
+using RectangleF = CoreGraphics.CGRect;
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/KeyboardObserver.cs b/Xamarin.Forms.Platform.iOS/Renderers/KeyboardObserver.cs
index 4ebb75d7..987858bc 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/KeyboardObserver.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/KeyboardObserver.cs
@@ -1,11 +1,6 @@
using System;
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-
namespace Xamarin.Forms.Platform.iOS
{
internal static class KeyboardObserver
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/LabelRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/LabelRenderer.cs
index f886cb35..0a9ef79a 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/LabelRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/LabelRenderer.cs
@@ -1,23 +1,8 @@
using System;
-using System.Drawing;
using System.ComponentModel;
-#if __UNIFIED__
using UIKit;
-using CoreText;
-#else
-using MonoTouch.UIKit;
-using MonoTouch.CoreText;
-#endif
-#if __UNIFIED__
using RectangleF = CoreGraphics.CGRect;
using SizeF = CoreGraphics.CGSize;
-using PointF = CoreGraphics.CGPoint;
-
-#else
-using nfloat=System.Single;
-using nint=System.Int32;
-using nuint=System.UInt32;
-#endif
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs
index d0dacbd4..07025c70 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs
@@ -3,26 +3,12 @@ using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
-using System.Drawing;
using System.Linq;
-using Xamarin.Forms.Internals;
-#if __UNIFIED__
-using UIKit;
using Foundation;
-#else
-using MonoTouch.UIKit;
-using MonoTouch.Foundation;
-#endif
-#if __UNIFIED__
+using UIKit;
+using Xamarin.Forms.Internals;
using RectangleF = CoreGraphics.CGRect;
using SizeF = CoreGraphics.CGSize;
-using PointF = CoreGraphics.CGPoint;
-
-#else
-using nfloat=System.Single;
-using nint=System.Int32;
-using nuint=System.UInt32;
-#endif
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/NavigationMenuRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/NavigationMenuRenderer.cs
index aa9b5ff3..2ea8a008 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/NavigationMenuRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/NavigationMenuRenderer.cs
@@ -1,23 +1,9 @@
using System;
-using System.Drawing;
using System.Linq;
-#if __UNIFIED__
-using UIKit;
using Foundation;
-#else
-using MonoTouch.UIKit;
-using MonoTouch.Foundation;
-#endif
-#if __UNIFIED__
+using UIKit;
using RectangleF = CoreGraphics.CGRect;
using SizeF = CoreGraphics.CGSize;
-using PointF = CoreGraphics.CGPoint;
-
-#else
-using nfloat=System.Single;
-using nint=System.Int32;
-using nuint=System.UInt32;
-#endif
namespace Xamarin.Forms.Platform.iOS
{
@@ -41,7 +27,8 @@ namespace Xamarin.Forms.Platform.iOS
SectionInset = new UIEdgeInsets(margin, margin, bottomMargin, margin),
MinimumInteritemSpacing = margin,
MinimumLineSpacing = margin
- }) { DataSource = new DataSource((NavigationMenu)Element), BackgroundColor = UIColor.White };
+ })
+ { DataSource = new DataSource((NavigationMenu)Element), BackgroundColor = UIColor.White };
using (var navigationCellId = new NSString("NavigationCell"))
_collectionView.RegisterClassForCell(typeof(NavigationCell), navigationCellId);
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs
index c4186880..654fc8ed 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs
@@ -1,30 +1,14 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
-using System.Diagnostics;
-using System.Drawing;
using System.Linq;
-using System.Threading;
using System.Threading.Tasks;
+using CoreGraphics;
+using UIKit;
using Xamarin.Forms.Internals;
using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
-#if __UNIFIED__
-using UIKit;
-using CoreGraphics;
-#else
-using MonoTouch.UIKit;
-using MonoTouch.CoreGraphics;
-#endif
-#if __UNIFIED__
-using RectangleF = CoreGraphics.CGRect;
-using SizeF = CoreGraphics.CGSize;
using PointF = CoreGraphics.CGPoint;
-
-#else
-using nfloat = System.Single;
-using nint = System.Int32;
-using nuint = System.UInt32;
-#endif
+using RectangleF = CoreGraphics.CGRect;
namespace Xamarin.Forms.Platform.iOS
{
@@ -309,11 +293,7 @@ namespace Xamarin.Forms.Platform.iOS
var task = GetAppearedOrDisappearedTask(page);
UIViewController poppedViewController;
-#if __UNIFIED__
poppedViewController = base.PopViewController(animated);
-#else
- poppedViewController = base.PopViewControllerAnimated (animated);
-#endif
if (poppedViewController == null)
{
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/OpenGLViewRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/OpenGLViewRenderer.cs
index 84c67744..58c172cf 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/OpenGLViewRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/OpenGLViewRenderer.cs
@@ -1,27 +1,10 @@
using System;
-using System.Drawing;
using System.ComponentModel;
-#if __UNIFIED__
using GLKit;
using OpenGLES;
using Foundation;
using CoreAnimation;
-#else
-using MonoTouch.GLKit;
-using MonoTouch.OpenGLES;
-using MonoTouch.Foundation;
-using MonoTouch.CoreAnimation;
-#endif
-#if __UNIFIED__
using RectangleF = CoreGraphics.CGRect;
-using SizeF = CoreGraphics.CGSize;
-using PointF = CoreGraphics.CGPoint;
-
-#else
-using nfloat=System.Single;
-using nint=System.Int32;
-using nuint=System.UInt32;
-#endif
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs
index ff286537..94caef04 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs
@@ -1,14 +1,8 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-
-#endif
-
namespace Xamarin.Forms.Platform.iOS
{
public class PageRenderer : UIViewController, IVisualElementRenderer, IEffectControlProvider
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs
index 55ed9610..17c08e75 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs
@@ -1,23 +1,9 @@
using System;
-using System.Linq;
-using System.Drawing;
using System.ComponentModel;
-#if __UNIFIED__
+using System.Linq;
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-#if __UNIFIED__
-using RectangleF = CoreGraphics.CGRect;
-using SizeF = CoreGraphics.CGSize;
using PointF = CoreGraphics.CGPoint;
-#else
-using nfloat=System.Single;
-using nint=System.Int32;
-using nuint=System.UInt32;
-#endif
-
namespace Xamarin.Forms.Platform.iOS
{
public class PhoneMasterDetailRenderer : UIViewController, IVisualElementRenderer, IEffectControlProvider
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/PickerRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/PickerRenderer.cs
index bebf91cf..d0cc4ece 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/PickerRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/PickerRenderer.cs
@@ -1,21 +1,7 @@
using System;
using System.ComponentModel;
-using System.Drawing;
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-#if __UNIFIED__
using RectangleF = CoreGraphics.CGRect;
-using SizeF = CoreGraphics.CGSize;
-using PointF = CoreGraphics.CGPoint;
-
-#else
-using nfloat=System.Single;
-using nint=System.Int32;
-using nuint=System.UInt32;
-#endif
namespace Xamarin.Forms.Platform.iOS
{
@@ -37,8 +23,8 @@ namespace Xamarin.Forms.Platform.iOS
{
var entry = new NoCaretField { BorderStyle = UITextBorderStyle.RoundedRect };
- entry.Started += OnStarted;
- entry.Ended += OnEnded;
+ entry.EditingDidBegin += OnStarted;
+ entry.EditingDidEnd += OnEnded;
_picker = new UIPickerView();
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ProgressBarRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ProgressBarRenderer.cs
index 37091720..234f8128 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/ProgressBarRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/ProgressBarRenderer.cs
@@ -1,20 +1,6 @@
-using System.Drawing;
using System.ComponentModel;
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-#if __UNIFIED__
-using RectangleF = CoreGraphics.CGRect;
using SizeF = CoreGraphics.CGSize;
-using PointF = CoreGraphics.CGPoint;
-
-#else
-using nfloat=System.Single;
-using nint=System.Int32;
-using nuint=System.UInt32;
-#endif
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ScrollViewRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ScrollViewRenderer.cs
index 1e8ea1fc..b2107db7 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/ScrollViewRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/ScrollViewRenderer.cs
@@ -1,21 +1,9 @@
using System;
using System.ComponentModel;
-using System.Drawing;
-#if __UNIFIED__
using UIKit;
-using Foundation;
-using ObjCRuntime;
using PointF = CoreGraphics.CGPoint;
using RectangleF = CoreGraphics.CGRect;
-#else
-using MonoTouch.Foundation;
-using MonoTouch.ObjCRuntime;
-using MonoTouch.UIKit;
-using nfloat=System.Single;
-
-#endif
-
namespace Xamarin.Forms.Platform.iOS
{
public class ScrollViewRenderer : UIScrollView, IVisualElementRenderer
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs
index 90a24376..8c54702f 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs
@@ -1,13 +1,8 @@
using System;
-using System.Drawing;
using System.ComponentModel;
-#if __UNIFIED__
+using System.Drawing;
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-
namespace Xamarin.Forms.Platform.iOS
{
public class SearchBarRenderer : ViewRenderer<SearchBar, UISearchBar>
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/SliderRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/SliderRenderer.cs
index 2df61f2f..aa01c955 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/SliderRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/SliderRenderer.cs
@@ -1,21 +1,7 @@
using System;
-using System.Drawing;
using System.ComponentModel;
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-#if __UNIFIED__
-using RectangleF = CoreGraphics.CGRect;
using SizeF = CoreGraphics.CGSize;
-using PointF = CoreGraphics.CGPoint;
-
-#else
-using nfloat=System.Single;
-using nint=System.Int32;
-using nuint=System.UInt32;
-#endif
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/StepperRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/StepperRenderer.cs
index 0cb0fcb7..9d96399d 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/StepperRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/StepperRenderer.cs
@@ -1,13 +1,8 @@
using System;
using System.Drawing;
using System.ComponentModel;
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-
namespace Xamarin.Forms.Platform.iOS
{
public class StepperRenderer : ViewRenderer<Stepper, UIStepper>
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/SwitchRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/SwitchRenderer.cs
index 0bb7fbef..50889b8f 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/SwitchRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/SwitchRenderer.cs
@@ -1,12 +1,7 @@
using System;
using System.Drawing;
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-
namespace Xamarin.Forms.Platform.iOS
{
public class SwitchRenderer : ViewRenderer<Switch, UISwitch>
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs
index 695ce2ac..626a61f1 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs
@@ -1,24 +1,9 @@
using System;
+using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
-using System.Linq;
-using System.Collections.Generic;
-using Xamarin.Forms.Internals;
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-#if __UNIFIED__
-using RectangleF = CoreGraphics.CGRect;
-using SizeF = CoreGraphics.CGSize;
-using PointF = CoreGraphics.CGPoint;
-
-#else
-using nfloat=System.Single;
-using nint=System.Int32;
-using nuint=System.UInt32;
-#endif
+using Xamarin.Forms.Internals;
namespace Xamarin.Forms.Platform.iOS
{
@@ -356,7 +341,7 @@ namespace Xamarin.Forms.Platform.iOS
if (!_defaultBarTextColorSet)
{
- _defaultBarTextColor = TabBar.TintColor;
+ _defaultBarTextColor = TabBar.TintColor;
_defaultBarTextColorSet = true;
}
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/TableViewModelRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/TableViewModelRenderer.cs
index cc70a5f1..4a9f694d 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/TableViewModelRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/TableViewModelRenderer.cs
@@ -1,24 +1,7 @@
using System;
using System.Collections.Generic;
-using Xamarin.Forms;
-using Xamarin.Forms.Internals;
-#if __UNIFIED__
-using UIKit;
using Foundation;
-#else
-using MonoTouch.UIKit;
-using MonoTouch.Foundation;
-#endif
-#if __UNIFIED__
-using RectangleF = CoreGraphics.CGRect;
-using SizeF = CoreGraphics.CGSize;
-using PointF = CoreGraphics.CGPoint;
-
-#else
-using nfloat=System.Single;
-using nint=System.Int32;
-using nuint=System.UInt32;
-#endif
+using UIKit;
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/TableViewRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/TableViewRenderer.cs
index cdfc138f..725ef51f 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/TableViewRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/TableViewRenderer.cs
@@ -1,15 +1,8 @@
-using System;
-using System.ComponentModel;
-using System.Drawing;
using System.Collections.Generic;
-#if __UNIFIED__
+using System.ComponentModel;
using UIKit;
using RectangleF = CoreGraphics.CGRect;
-#else
-using MonoTouch.UIKit;
-#endif
-
namespace Xamarin.Forms.Platform.iOS
{
public class TableViewRenderer : ViewRenderer<TableView, UITableView>
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs
index cb76b765..7b54faf6 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs
@@ -1,12 +1,7 @@
using System;
using System.ComponentModel;
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-
namespace Xamarin.Forms.Platform.iOS
{
internal class ChildViewController : UIViewController
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/TimePickerRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/TimePickerRenderer.cs
index f8529800..f2632768 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/TimePickerRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/TimePickerRenderer.cs
@@ -1,23 +1,8 @@
using System;
-using System.Drawing;
using System.ComponentModel;
-#if __UNIFIED__
-using UIKit;
using Foundation;
-#else
-using MonoTouch.UIKit;
-using MonoTouch.Foundation;
-#endif
-#if __UNIFIED__
+using UIKit;
using RectangleF = CoreGraphics.CGRect;
-using SizeF = CoreGraphics.CGSize;
-using PointF = CoreGraphics.CGPoint;
-
-#else
-using nfloat=System.Single;
-using nint=System.Int32;
-using nuint=System.UInt32;
-#endif
namespace Xamarin.Forms.Platform.iOS
{
@@ -32,8 +17,8 @@ namespace Xamarin.Forms.Platform.iOS
{
if (disposing)
{
- Control.Started -= OnStarted;
- Control.Ended -= OnEnded;
+ Control.EditingDidBegin -= OnStarted;
+ Control.EditingDidEnd -= OnEnded;
_picker.ValueChanged -= OnValueChanged;
}
@@ -49,8 +34,8 @@ namespace Xamarin.Forms.Platform.iOS
{
var entry = new NoCaretField { BorderStyle = UITextBorderStyle.RoundedRect };
- entry.Started += OnStarted;
- entry.Ended += OnEnded;
+ entry.EditingDidBegin += OnStarted;
+ entry.EditingDidEnd += OnEnded;
_picker = new UIDatePicker { Mode = UIDatePickerMode.Time, TimeZone = new NSTimeZone("UTC") };
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/WebViewRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/WebViewRenderer.cs
index 11ab72f2..70c9bf60 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/WebViewRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/WebViewRenderer.cs
@@ -1,15 +1,9 @@
using System;
-using System.Drawing;
using System.ComponentModel;
-using Xamarin.Forms.Internals;
-#if __UNIFIED__
-using UIKit;
+using System.Drawing;
using Foundation;
-
-#else
-using MonoTouch.UIKit;
-using MonoTouch.Foundation;
-#endif
+using UIKit;
+using Xamarin.Forms.Internals;
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/ResourcesProvider.cs b/Xamarin.Forms.Platform.iOS/ResourcesProvider.cs
index 847107d9..cb5e3cfe 100644
--- a/Xamarin.Forms.Platform.iOS/ResourcesProvider.cs
+++ b/Xamarin.Forms.Platform.iOS/ResourcesProvider.cs
@@ -1,10 +1,5 @@
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-
namespace Xamarin.Forms.Platform.iOS
{
internal class ResourcesProvider : ISystemResourcesProvider
diff --git a/Xamarin.Forms.Platform.iOS/ViewInitializedEventArgs.cs b/Xamarin.Forms.Platform.iOS/ViewInitializedEventArgs.cs
index e34a493e..73041163 100644
--- a/Xamarin.Forms.Platform.iOS/ViewInitializedEventArgs.cs
+++ b/Xamarin.Forms.Platform.iOS/ViewInitializedEventArgs.cs
@@ -1,11 +1,6 @@
using System;
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-
namespace Xamarin.Forms
{
public class ViewInitializedEventArgs : EventArgs
diff --git a/Xamarin.Forms.Platform.iOS/ViewRenderer.cs b/Xamarin.Forms.Platform.iOS/ViewRenderer.cs
index 0c0f8f93..6ecc307b 100644
--- a/Xamarin.Forms.Platform.iOS/ViewRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/ViewRenderer.cs
@@ -1,21 +1,8 @@
using System;
-using System.Drawing;
using System.ComponentModel;
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-#if __UNIFIED__
using RectangleF = CoreGraphics.CGRect;
using SizeF = CoreGraphics.CGSize;
-using PointF = CoreGraphics.CGPoint;
-
-#else
-using nfloat=System.Single;
-using nint=System.Int32;
-using nuint=System.UInt32;
-#endif
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/VisualElementPackager.cs b/Xamarin.Forms.Platform.iOS/VisualElementPackager.cs
index 0aefc482..1670176d 100644
--- a/Xamarin.Forms.Platform.iOS/VisualElementPackager.cs
+++ b/Xamarin.Forms.Platform.iOS/VisualElementPackager.cs
@@ -1,10 +1,4 @@
using System;
-#if __UNIFIED__
-using UIKit;
-
-#else
-using MonoTouch.UIKit;
-#endif
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/VisualElementRenderer.cs b/Xamarin.Forms.Platform.iOS/VisualElementRenderer.cs
index d4da0930..b4a60f63 100644
--- a/Xamarin.Forms.Platform.iOS/VisualElementRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/VisualElementRenderer.cs
@@ -1,27 +1,11 @@
using System;
using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Collections.Specialized;
-using System.Drawing;
using System.ComponentModel;
-using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
-
-#if __UNIFIED__
using UIKit;
-#else
-using MonoTouch.UIKit;
-#endif
-#if __UNIFIED__
+using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
using RectangleF = CoreGraphics.CGRect;
using SizeF = CoreGraphics.CGSize;
-using PointF = CoreGraphics.CGPoint;
-using CoreGraphics;
-
-#else
-using nfloat=System.Single;
-using nint=System.Int32;
-using nuint=System.UInt32;
-#endif
+
namespace Xamarin.Forms.Platform.iOS
{
diff --git a/Xamarin.Forms.Platform.iOS/VisualElementTracker.cs b/Xamarin.Forms.Platform.iOS/VisualElementTracker.cs
index c9396769..5b41ca84 100644
--- a/Xamarin.Forms.Platform.iOS/VisualElementTracker.cs
+++ b/Xamarin.Forms.Platform.iOS/VisualElementTracker.cs
@@ -1,16 +1,9 @@
using System;
-using System.Drawing;
using System.ComponentModel;
+using System.Drawing;
using System.Threading;
-#if __UNIFIED__
-using UIKit;
using CoreAnimation;
-#else
-using MonoTouch.UIKit;
-using MonoTouch.CoreAnimation;
-#endif
-
namespace Xamarin.Forms.Platform.iOS
{
public class VisualElementTracker : IDisposable
diff --git a/Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.Classic.csproj b/Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.Classic.csproj
deleted file mode 100644
index 5b705d01..00000000
--- a/Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.Classic.csproj
+++ /dev/null
@@ -1,273 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
- <ProductVersion>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{4A47B5DF-DDFC-476B-AC41-5105FF3B9B8B}</ProjectGuid>
- <ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <OutputType>Library</OutputType>
- <RootNamespace>Xamarin.Forms.Platform.iOS</RootNamespace>
- <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
- <AssemblyName>Xamarin.Forms.Platform.iOS.Classic</AssemblyName>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>classic_bin\iPhoneSimulator\Debug\</OutputPath>
- <BaseIntermediateOutputPath>classic_obj\</BaseIntermediateOutputPath>
- <DefineConstants>TRACE;DEBUG;__MOBILE__;__IOS__</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <ConsolePause>false</ConsolePause>
- <MtouchDebug>true</MtouchDebug>
- <CodesignKey>iPhone Developer</CodesignKey>
- <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- <NoWarn>
- </NoWarn>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>none</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>classic_bin\iPhoneSimulator\Release\</OutputPath>
- <BaseIntermediateOutputPath>classic_obj\</BaseIntermediateOutputPath>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <ConsolePause>false</ConsolePause>
- <CodesignKey>iPhone Developer</CodesignKey>
- <DefineConstants>TRACE;__IOS__;__MOBILE__;</DefineConstants>
- <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- <NoWarn>
- </NoWarn>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Turkey|AnyCPU'">
- <DebugSymbols>true</DebugSymbols>
- <OutputPath>bin\Turkey\</OutputPath>
- <DefineConstants>__MOBILE__;__IOS__;TRACE;DEBUG;__MOBILE__;__IOS__</DefineConstants>
- <DebugType>full</DebugType>
- <PlatformTarget>AnyCPU</PlatformTarget>
- <UseVSHostingProcess>false</UseVSHostingProcess>
- <ErrorReport>prompt</ErrorReport>
- <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
- <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- <NoWarn>
- </NoWarn>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'AppStore|AnyCPU'">
- <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- <NoWarn>
- </NoWarn>
- </PropertyGroup>
- <ItemGroup>
- <Compile Include="..\Xamarin.Forms.Core\Properties\GlobalAssemblyInfo.cs">
- <Link>Properties\GlobalAssemblyInfo.cs</Link>
- </Compile>
- <Compile Include="CADisplayLinkTicker.cs" />
- <Compile Include="ContextActionCell.cs" />
- <Compile Include="ContextScrollViewDelegate.cs" />
- <Compile Include="EffectUtilities.cs" />
- <Compile Include="Extensions\CellExtensions.cs" />
- <Compile Include="Extensions\PlatformConfigurationExtensions.cs" />
- <Compile Include="Forms.cs" />
- <Compile Include="GlobalCloseContextGestureRecognizer.cs" />
- <Compile Include="Extensions\ArrayExtensions.cs" />
- <Compile Include="NativeViewWrapper.cs" />
- <Compile Include="NativeViewWrapperRenderer.cs" />
- <Compile Include="PlatformEffect.cs" />
- <Compile Include="LayoutExtensions.cs" />
- <Compile Include="Renderers\AlignmentExtensions.cs" />
- <Compile Include="PageExtensions.cs" />
- <Compile Include="Renderers\ExportCellAttribute.cs" />
- <Compile Include="Renderers\ExportImageSourceHandlerAttribute.cs" />
- <Compile Include="Renderers\ExportRendererAttribute.cs" />
- <Compile Include="Resources\StringResources.Designer.cs" />
- <Compile Include="ViewInitializedEventArgs.cs" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="$(MSBuildThisFileDirectory)Deserializer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)ElementChangedEventArgs.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)EventTracker.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)FormsApplicationDelegate.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)IVisualElementRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Platform.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)PlatformRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)RendererFactory.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)RendererPool.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)ResourcesProvider.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)ViewRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)VisualElementPackager.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)VisualElementRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)VisualElementTracker.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Cells\CellRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Cells\CellTableViewCell.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Cells\EntryCellRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Cells\ImageCellRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Cells\SwitchCellRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Cells\TextCellRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Cells\ViewCellRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Extensions\ColorExtensions.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Extensions\DateExtensions.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Extensions\Extensions.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Extensions\ToolbarItemExtensions.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Extensions\UIViewExtensions.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Extensions\ViewExtensions.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\ActivityIndicatorRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\BoxRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\ButtonRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\CarouselPageRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\DatePickerRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\EditorRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\EntryRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\FontExtensions.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\FormattedStringExtensions.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\FrameRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\ImageRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\KeyboardInsetTracker.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\KeyboardObserver.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\LabelRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\ListViewRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\NavigationMenuRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\NavigationRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\OpenGLViewRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\PageRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\PhoneMasterDetailRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\PickerRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\ProgressBarRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\ScrollViewRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\SearchBarRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\SliderRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\StepperRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\SwitchRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\TabbedRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\TableViewModelRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\TableViewRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\TabletMasterDetailRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\TimePickerRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Renderers\WebViewRenderer.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Properties\AssemblyInfo.cs" />
- <Compile Include="iOSAppIndexingProvider.cs" />
- <Compile Include="iOSAppLinks.cs" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.ar.resx" />
- </ItemGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Runtime.Serialization" />
- <Reference Include="System.Xml" />
- <Reference Include="System.Core" />
- <Reference Include="monotouch" />
- <Reference Include="System.Net.Http" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\Xamarin.Forms.Core\Xamarin.Forms.Core.csproj">
- <Project>{57B8B73D-C3B5-4C42-869E-7B2F17D354AC}</Project>
- <Name>Xamarin.Forms.Core</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets" />
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.ca.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.cs.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.da.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.de.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.el.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.es.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.fi.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.fr.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.he.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.hi.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.hr.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.hu.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.id.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.it.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.ja.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.ko.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.ms.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.nb.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.nl.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.pl.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.pt-BR.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.pt.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.ro.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.ru.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.sk.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.sv.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.th.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.tr.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.uk.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.vi.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.zh-Hans.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.zh-Hant.resx" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources\StringResources.zh-HK.resx" />
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.csproj b/Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.csproj
index d2364175..c7f02785 100644
--- a/Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.csproj
+++ b/Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.csproj
@@ -37,7 +37,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Turkey|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Turkey\</OutputPath>
- <DefineConstants>__UNIFIED__;__MOBILE__;__IOS__;DEBUG;</DefineConstants>
+ <DefineConstants>__MOBILE__;__IOS__;DEBUG;</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
@@ -137,7 +137,6 @@
<Compile Include="NativeViewWrapper.cs" />
<Compile Include="NativeViewWrapperRenderer.cs" />
<Compile Include="PlatformEffect.cs" />
- <Compile Include="LayoutExtensions.cs" />
<Compile Include="Renderers\AlignmentExtensions.cs" />
<Compile Include="Forms.cs" />
<Compile Include="PageExtensions.cs" />
@@ -149,6 +148,10 @@
<Compile Include="ViewInitializedEventArgs.cs" />
<Compile Include="IOSAppIndexingProvider.cs" />
<Compile Include="IOSAppLinks.cs" />
+ <Compile Include="NativeViewPropertyListener.cs" />
+ <Compile Include="Extensions\LayoutExtensions.cs" />
+ <Compile Include="NativeValueConverterService.cs" />
+ <Compile Include="NativeBindingService.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\StringResources.ar.resx" />
@@ -204,4 +207,4 @@
<Link>Properties\GlobalAssemblyInfo.cs</Link>
</Compile>
</ItemGroup>
-</Project> \ No newline at end of file
+</Project>
diff --git a/Xamarin.Forms.Platform.iOS/iOSAppLinks.cs b/Xamarin.Forms.Platform.iOS/iOSAppLinks.cs
index 8c46ed07..f8771a93 100644
--- a/Xamarin.Forms.Platform.iOS/iOSAppLinks.cs
+++ b/Xamarin.Forms.Platform.iOS/iOSAppLinks.cs
@@ -1,16 +1,9 @@
using System;
using System.Threading.Tasks;
-#if __UNIFIED__
-using Foundation;
using CoreSpotlight;
+using Foundation;
using UIKit;
-#else
-using MonoTouch.Foundation;
-using MonoTouch.UIKit;
-using MonoTouch.CoreSpotlight;
-#endif
-
namespace Xamarin.Forms.Platform.iOS
{
internal class IOSAppLinks : IAppLinks
@@ -60,11 +53,7 @@ namespace Xamarin.Forms.Platform.iOS
//we need to make sure we index the item in spotlight first or the RelatedUniqueIdentifier will not work
await IndexItemAsync(searchItem);
-#if __UNIFIED__
var activity = new NSUserActivity($"{appDomain}.{contentType}");
-#else
- var activity = new NSUserActivity (new NSString($"{appDomain}.{contentType}"));
-#endif
activity.Title = deepLinkUri.Title;
activity.EligibleForSearch = true;
diff --git a/Xamarin.Forms.Platform/Properties/AssemblyInfo.cs b/Xamarin.Forms.Platform/Properties/AssemblyInfo.cs
index 12bd7f0f..6ca776be 100644
--- a/Xamarin.Forms.Platform/Properties/AssemblyInfo.cs
+++ b/Xamarin.Forms.Platform/Properties/AssemblyInfo.cs
@@ -15,7 +15,7 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
-[assembly: InternalsVisibleTo("Xamarin.Forms.Core, PublicKey=002400000480000094000000060200000024000052534131000400001100000033ce7398017d567782784824a0e996cb3e03561e5771075ab4754fe11e0ac76f870cc54669cf3ea8b6f28a4a140eafd269837857f5fd0a6e40958b07daa64e9c38d82903aa3caeffde0bc1b1e7cf693210fea62518c8942ad2a99d3e6850381b17bb26550cd0ee26ebae413dc4c9c51128d7577651ff383805e398bebe4ab384")]
+[assembly: InternalsVisibleTo("Xamarin.Forms.Core")]
// Version information for an assembly consists of the following four values:
//
diff --git a/Xamarin.Forms.Platform/Xamarin.Forms.Platform.csproj b/Xamarin.Forms.Platform/Xamarin.Forms.Platform.csproj
index 2679c555..31986952 100644
--- a/Xamarin.Forms.Platform/Xamarin.Forms.Platform.csproj
+++ b/Xamarin.Forms.Platform/Xamarin.Forms.Platform.csproj
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
@@ -11,7 +11,9 @@
<RootNamespace>Xamarin.Forms.Platform</RootNamespace>
<AssemblyName>Xamarin.Forms.Platform</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <TargetFrameworkProfile>Profile259</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<NuGetPackageImportStamp>9af32e5a</NuGetPackageImportStamp>
@@ -35,15 +37,11 @@
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
- <Import Project="..\Xamarin.Forms.Core\SignWithXamarinKey.props" />
<ItemGroup>
<Compile Include="Xamarin.Forms.Platform.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="..\Xamarin.Forms.Core\Properties\ExposeInternalsToXamarin.cs">
- <Link>Properties\ExposeInternalsToXamarin.cs</Link>
- </Compile>
</ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
diff --git a/Xamarin.Forms.Xaml.UnitTests/CompiledTypeConverter.xaml b/Xamarin.Forms.Xaml.UnitTests/CompiledTypeConverter.xaml
new file mode 100644
index 00000000..56d7e082
--- /dev/null
+++ b/Xamarin.Forms.Xaml.UnitTests/CompiledTypeConverter.xaml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ x:Class="Xamarin.Forms.Xaml.UnitTests.CompiledTypeConverter"
+ RectangleP="0,1,2,4"
+ RectangleBP="4,8,16,32"
+ BackgroundColor="Pink">
+ <Label HorizontalOptions="EndAndExpand" />
+</ContentPage> \ No newline at end of file
diff --git a/Xamarin.Forms.Xaml.UnitTests/CompiledTypeConverter.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/CompiledTypeConverter.xaml.cs
new file mode 100644
index 00000000..092d67de
--- /dev/null
+++ b/Xamarin.Forms.Xaml.UnitTests/CompiledTypeConverter.xaml.cs
@@ -0,0 +1,45 @@
+using System;
+using System.Collections.Generic;
+
+using Xamarin.Forms;
+using NUnit.Framework;
+
+namespace Xamarin.Forms.Xaml.UnitTests
+{
+ public partial class CompiledTypeConverter : ContentPage
+ {
+ public static readonly BindableProperty RectangleBPProperty =
+ BindableProperty.Create ("RectangleBP", typeof(Rectangle), typeof(CompiledTypeConverter), default(Rectangle));
+
+ public Rectangle RectangleBP {
+ get { return (Rectangle)GetValue (RectangleBPProperty); }
+ set { SetValue (RectangleBPProperty, value); }
+ }
+
+ public Rectangle RectangleP { get; set; }
+
+ public CompiledTypeConverter ()
+ {
+ InitializeComponent ();
+ }
+
+ public CompiledTypeConverter (bool useCompiledXaml)
+ {
+ //this stub will be replaced at compile time
+ }
+
+ [TestFixture]
+ public class Tests
+ {
+ [TestCase (false)]
+ [TestCase (true)]
+ public void CompiledTypeConverterAreInvoked (bool useCompiledXaml)
+ {
+ var p = new CompiledTypeConverter (useCompiledXaml);
+ Assert.AreEqual (new Rectangle (0, 1, 2, 4), p.RectangleP);
+ Assert.AreEqual (new Rectangle (4, 8, 16, 32), p.RectangleBP);
+ Assert.AreEqual (Color.Pink, p.BackgroundColor);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Xaml.UnitTests/GenericCollections.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/GenericCollections.xaml.cs
index 95c057b0..c2891e06 100644
--- a/Xamarin.Forms.Xaml.UnitTests/GenericCollections.xaml.cs
+++ b/Xamarin.Forms.Xaml.UnitTests/GenericCollections.xaml.cs
@@ -14,6 +14,11 @@ namespace Xamarin.Forms.Xaml.UnitTests
typeof(GenericCollection),
typeof(AttachedBP),
null);
+
+ public static GenericCollection GetAttachedBP(BindableObject bindable)
+ {
+ throw new NotImplementedException();
+ }
}
public class GenericCollection : ObservableCollection<object>
diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/BPNotResolvedOnSubClass.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/BPNotResolvedOnSubClass.xaml.cs
index 65bb73f1..c6913949 100644
--- a/Xamarin.Forms.Xaml.UnitTests/Issues/BPNotResolvedOnSubClass.xaml.cs
+++ b/Xamarin.Forms.Xaml.UnitTests/Issues/BPNotResolvedOnSubClass.xaml.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using Xamarin.Forms;
using NUnit.Framework;
+using Xamarin.Forms.Core.UnitTests;
namespace Xamarin.Forms.Xaml.UnitTests
{
@@ -29,6 +30,18 @@ namespace Xamarin.Forms.Xaml.UnitTests
[TestFixture]
class Tests
{
+ [SetUp]
+ public void Setup()
+ {
+ Device.PlatformServices = new MockPlatformServices();
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ Device.PlatformServices = null;
+ }
+
[TestCase(true)]
[TestCase(false)]
public void CorrectlyResolveBPOnSubClasses (bool useCompiledXaml)
diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz43450.xaml b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz43450.xaml
new file mode 100644
index 00000000..cc234879
--- /dev/null
+++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz43450.xaml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ x:Class="Xamarin.Forms.Xaml.UnitTests.Bz43450">
+ <Grid>
+ <Grid.RowDefinition>
+ <RowDefinition Height="20"/>
+ <RowDefinition Height="*"/>
+ <RowDefinition Height="20"/>
+ </Grid.RowDefinition>
+ <BoxView BackgroundColor="Red"/>
+ <BoxView Grid.Row="1" BackgroundColor="Yellow"/>
+ <BoxView Grid.Row="2" BackgroundColor="Green"/>
+ </Grid>
+</ContentPage> \ No newline at end of file
diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz43450.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz43450.xaml.cs
new file mode 100644
index 00000000..b3346b37
--- /dev/null
+++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz43450.xaml.cs
@@ -0,0 +1,32 @@
+using NUnit.Framework;
+
+namespace Xamarin.Forms.Xaml.UnitTests
+{
+ [XamlCompilation(XamlCompilationOptions.Skip)]
+ public partial class Bz43450 : ContentPage
+ {
+ public Bz43450()
+ {
+ InitializeComponent();
+ }
+
+ public Bz43450(bool useCompiledXaml)
+ {
+ //this stub will be replaced at compile time
+ }
+
+ [TestFixture]
+ class Tests
+ {
+ [TestCase(true)]
+ [TestCase(false)]
+ public void DoesNotAllowGridRowDefinition(bool useCompiledXaml)
+ {
+ if (!useCompiledXaml)
+ Assert.Throws<XamlParseException>(() => new Bz43450(useCompiledXaml));
+ else
+ Assert.Throws<XamlParseException>(() => MockCompiler.Compile(typeof(Bz43450)));
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Issue1497.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Issue1497.cs
index 3813f73a..b35339d5 100644
--- a/Xamarin.Forms.Xaml.UnitTests/Issues/Issue1497.cs
+++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Issue1497.cs
@@ -1,11 +1,24 @@
using System;
using NUnit.Framework;
+using Xamarin.Forms.Core.UnitTests;
namespace Xamarin.Forms.Xaml.UnitTests
{
[TestFixture]
public class Issue1497
{
+ [SetUp]
+ public void Setup()
+ {
+ Device.PlatformServices = new MockPlatformServices();
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ Device.PlatformServices = null;
+ }
+
[Test]
public void BPCollectionsWithSingleElement ()
{
@@ -23,5 +36,4 @@ namespace Xamarin.Forms.Xaml.UnitTests
Assert.True (grid.ColumnDefinitions [0].Width.IsStar);
}
}
-}
-
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Xaml.UnitTests/MarkupExpressionParserTests.cs b/Xamarin.Forms.Xaml.UnitTests/MarkupExpressionParserTests.cs
index 7361235c..a026eda2 100644
--- a/Xamarin.Forms.Xaml.UnitTests/MarkupExpressionParserTests.cs
+++ b/Xamarin.Forms.Xaml.UnitTests/MarkupExpressionParserTests.cs
@@ -177,11 +177,7 @@ namespace Xamarin.Forms.Xaml.UnitTests
}
}
- public object TargetProperty {
- get {
- throw new NotImplementedException ();
- }
- }
+ public object TargetProperty { get; } = null;
}
[Test]
diff --git a/Xamarin.Forms.Xaml.UnitTests/MockCompiler.cs b/Xamarin.Forms.Xaml.UnitTests/MockCompiler.cs
new file mode 100644
index 00000000..404169b3
--- /dev/null
+++ b/Xamarin.Forms.Xaml.UnitTests/MockCompiler.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+using Xamarin.Forms.Build.Tasks;
+
+namespace Xamarin.Forms.Xaml.UnitTests
+{
+ public static class MockCompiler
+ {
+ public static void Compile(Type type)
+ {
+ var assembly = type.Assembly.Location;
+ var refs = from an in type.Assembly.GetReferencedAssemblies()
+ let a = System.Reflection.Assembly.Load(an)
+ select a.Location;
+
+ var xamlc = new XamlCTask {
+ Assembly = assembly,
+ ReferencePath = string.Join(";", refs),
+ KeepXamlResources = true,
+ Type = type.FullName
+ };
+
+ var exceptions = new List<Exception>();
+ if (!xamlc.Compile(exceptions) && exceptions.Any())
+ throw exceptions [0];
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Xaml.UnitTests/NativeViewsAndBindings.xaml b/Xamarin.Forms.Xaml.UnitTests/NativeViewsAndBindings.xaml
new file mode 100644
index 00000000..a35f8e50
--- /dev/null
+++ b/Xamarin.Forms.Xaml.UnitTests/NativeViewsAndBindings.xaml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ xmlns:ios="clr-namespace:Xamarin.Forms.Xaml.UnitTests;targetPlatform=iOS"
+ xmlns:android="clr-namespace:Xamarin.Forms.Xaml.UnitTests;targetPlatform=Android"
+ x:Class="Xamarin.Forms.Xaml.UnitTests.NativeViewsAndBindings">
+ <StackLayout>
+ <ContentView x:Name="view0">
+ <ios:MockUIView Foo="foo" Bar="42" Baz="{Binding Baz}" View.HorizontalOptions="End" View.VerticalOptions="{Binding VerticalOption}" />
+ <android:MockAndroidView Foo="foo" Bar="42" Baz="{Binding Baz}" View.HorizontalOptions="End" View.VerticalOptions="{Binding VerticalOption}" />
+ </ContentView>
+ </StackLayout>
+</ContentPage> \ No newline at end of file
diff --git a/Xamarin.Forms.Xaml.UnitTests/NativeViewsAndBindings.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/NativeViewsAndBindings.xaml.cs
new file mode 100644
index 00000000..ce02d63b
--- /dev/null
+++ b/Xamarin.Forms.Xaml.UnitTests/NativeViewsAndBindings.xaml.cs
@@ -0,0 +1,293 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using NUnit.Framework;
+using Xamarin.Forms;
+using Xamarin.Forms.Core.UnitTests;
+
+namespace Xamarin.Forms.Xaml.UnitTests
+{
+ public abstract class MockNativeView
+ {
+ public string Foo { get; set; }
+ public int Bar { get; set; }
+ public string Baz { get; set; }
+ }
+
+ public class MockUIView : MockNativeView
+ {
+ public IList<MockUIView> SubViews { get; set; }
+ }
+
+ class MockUIViewWrapper : View
+ {
+ public MockUIView NativeView { get; }
+
+ public MockUIViewWrapper(MockUIView nativeView)
+ {
+ NativeView = nativeView;
+ nativeView.TransferbindablePropertiesToWrapper(this);
+ }
+
+ protected override void OnBindingContextChanged()
+ {
+ NativeView.SetBindingContext(BindingContext, nv => nv.SubViews);
+ base.OnBindingContextChanged();
+ }
+ }
+
+ public class MockAndroidView : MockNativeView
+ {
+ public IList<MockAndroidView> SubViews { get; set; }
+ }
+
+ class MockAndroidViewWrapper : View
+ {
+ public MockAndroidView NativeView { get; }
+
+ public MockAndroidViewWrapper(MockAndroidView nativeView)
+ {
+ NativeView = nativeView;
+ nativeView.TransferbindablePropertiesToWrapper(this);
+ }
+
+ protected override void OnBindingContextChanged()
+ {
+ NativeView.SetBindingContext(BindingContext, nv => nv.SubViews);
+ base.OnBindingContextChanged();
+ }
+ }
+
+ public static class MockNativeViewExtensions
+ {
+ public static View ToView(this MockUIView nativeView)
+ {
+ return new MockUIViewWrapper(nativeView);
+ }
+
+ public static void SetBinding(this MockUIView target, string targetProperty, BindingBase binding, string updateSourceEventName = null)
+ {
+ NativeBindingHelpers.SetBinding(target, targetProperty, binding, updateSourceEventName);
+ }
+
+ internal static void SetBinding(this MockUIView target, string targetProperty, BindingBase binding, INotifyPropertyChanged propertyChanged)
+ {
+ NativeBindingHelpers.SetBinding(target, targetProperty, binding, propertyChanged);
+ }
+
+ public static void SetBinding(this MockUIView target, BindableProperty targetProperty, BindingBase binding)
+ {
+ NativeBindingHelpers.SetBinding(target, targetProperty, binding);
+ }
+
+ public static void SetValue(this MockUIView target, BindableProperty targetProperty, object value)
+ {
+ NativeBindingHelpers.SetValue(target, targetProperty, value);
+ }
+
+ public static void SetBindingContext(this MockUIView target, object bindingContext, Func<MockUIView, IEnumerable<MockUIView>> getChild = null)
+ {
+ NativeBindingHelpers.SetBindingContext(target, bindingContext, getChild);
+ }
+
+ internal static void TransferbindablePropertiesToWrapper(this MockUIView target, MockUIViewWrapper wrapper)
+ {
+ NativeBindingHelpers.TransferBindablePropertiesToWrapper(target, wrapper);
+ }
+
+ public static View ToView(this MockAndroidView nativeView)
+ {
+ return new MockAndroidViewWrapper(nativeView);
+ }
+
+ public static void SetBinding(this MockAndroidView target, string targetProperty, BindingBase binding, string updateSourceEventName = null)
+ {
+ NativeBindingHelpers.SetBinding(target, targetProperty, binding, updateSourceEventName);
+ }
+
+ internal static void SetBinding(this MockAndroidView target, string targetProperty, BindingBase binding, INotifyPropertyChanged propertyChanged)
+ {
+ NativeBindingHelpers.SetBinding(target, targetProperty, binding, propertyChanged);
+ }
+
+ public static void SetBinding(this MockAndroidView target, BindableProperty targetProperty, BindingBase binding)
+ {
+ NativeBindingHelpers.SetBinding(target, targetProperty, binding);
+ }
+
+ public static void SetValue(this MockAndroidView target, BindableProperty targetProperty, object value)
+ {
+ NativeBindingHelpers.SetValue(target, targetProperty, value);
+ }
+
+ public static void SetBindingContext(this MockAndroidView target, object bindingContext, Func<MockAndroidView, IEnumerable<MockAndroidView>> getChild = null)
+ {
+ NativeBindingHelpers.SetBindingContext(target, bindingContext, getChild);
+ }
+
+ internal static void TransferbindablePropertiesToWrapper(this MockAndroidView target, MockAndroidViewWrapper wrapper)
+ {
+ NativeBindingHelpers.TransferBindablePropertiesToWrapper(target, wrapper);
+ }
+ }
+
+ public class MockIosNativeValueConverterService : INativeValueConverterService
+ {
+ public bool ConvertTo(object value, Type toType, out object nativeValue)
+ {
+ nativeValue = null;
+ if (typeof(MockUIView).IsInstanceOfType(value) && toType.IsAssignableFrom(typeof(View))) {
+ nativeValue = ((MockUIView)value).ToView();
+ return true;
+ }
+ return false;
+ }
+ }
+
+ public class MockAndroidNativeValueConverterService : INativeValueConverterService
+ {
+ public bool ConvertTo(object value, Type toType, out object nativeValue)
+ {
+ nativeValue = null;
+ if (typeof(MockAndroidView).IsInstanceOfType(value) && toType.IsAssignableFrom(typeof(View))) {
+ nativeValue = ((MockAndroidView)value).ToView();
+ return true;
+ }
+ return false;
+ }
+ }
+
+ public class MockIosNativeBindingService : INativeBindingService
+ {
+ public bool TrySetBinding(object target, string propertyName, BindingBase binding)
+ {
+ var view = target as MockUIView;
+ if (view == null)
+ return false;
+ if (target.GetType().GetProperty(propertyName)?.GetMethod == null)
+ return false;
+ view.SetBinding(propertyName, binding);
+ return true;
+ }
+
+ public bool TrySetBinding(object target, BindableProperty property, BindingBase binding)
+ {
+ var view = target as MockUIView;
+ if (view == null)
+ return false;
+ view.SetBinding(property, binding);
+ return true;
+ }
+
+ public bool TrySetValue(object target, BindableProperty property, object value)
+ {
+ var view = target as MockUIView;
+ if (view == null)
+ return false;
+ view.SetValue(property, value);
+ return true;
+ }
+ }
+
+ public class MockAndroidNativeBindingService : INativeBindingService
+ {
+ public bool TrySetBinding(object target, string propertyName, BindingBase binding)
+ {
+ var view = target as MockAndroidView;
+ if (view == null)
+ return false;
+ view.SetBinding(propertyName, binding);
+ return true;
+ }
+
+ public bool TrySetBinding(object target, BindableProperty property, BindingBase binding)
+ {
+ var view = target as MockAndroidView;
+ if (view == null)
+ return false;
+ view.SetBinding(property, binding);
+ return true;
+ }
+
+ public bool TrySetValue(object target, BindableProperty property, object value)
+ {
+ var view = target as MockAndroidView;
+ if (view == null)
+ return false;
+ view.SetValue(property, value);
+ return true;
+ }
+ }
+
+ public partial class NativeViewsAndBindings : ContentPage
+ {
+ public NativeViewsAndBindings()
+ {
+ InitializeComponent();
+ }
+
+ public NativeViewsAndBindings(bool useCompiledXaml)
+ {
+ //this stub will be replaced at compile time
+ }
+
+ [TestFixture]
+ public class Tests
+ {
+ [SetUp]
+ public void SetUp()
+ {
+ Device.PlatformServices = new MockPlatformServices();
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ Device.PlatformServices = null;
+ }
+
+ void SetUpPlatform(TargetPlatform platform)
+ {
+ Device.OS = platform;
+ if (platform == TargetPlatform.iOS) {
+ DependencyService.Register<INativeValueConverterService, MockIosNativeValueConverterService>();
+ DependencyService.Register<INativeBindingService, MockIosNativeBindingService>();
+ } else if (platform == TargetPlatform.Android) {
+ DependencyService.Register<INativeValueConverterService, MockAndroidNativeValueConverterService>();
+ DependencyService.Register<INativeBindingService, MockAndroidNativeBindingService>();
+ }
+ }
+
+ [TestCase(false, TargetPlatform.iOS)]
+ [TestCase(false, TargetPlatform.Android)]
+ //[TestCase(true)]
+ public void NativeInContentView(bool useCompiledXaml, TargetPlatform platform)
+ {
+ SetUpPlatform(platform);
+ var layout = new NativeViewsAndBindings(useCompiledXaml);
+ layout.BindingContext = new {
+ Baz = "Bound Value",
+ VerticalOption=LayoutOptions.EndAndExpand
+ };
+ var view = layout.view0;
+ Assert.NotNull(view.Content);
+ MockNativeView nativeView = null;
+ if (platform == TargetPlatform.iOS) {
+ Assert.That(view.Content, Is.TypeOf<MockUIViewWrapper>());
+ Assert.That(((MockUIViewWrapper)view.Content).NativeView, Is.TypeOf<MockUIView>());
+ nativeView = ((MockUIViewWrapper)view.Content).NativeView;
+ } else if (platform == TargetPlatform.Android) {
+ Assert.That(view.Content, Is.TypeOf<MockAndroidViewWrapper>());
+ Assert.That(((MockAndroidViewWrapper)view.Content).NativeView, Is.TypeOf<MockAndroidView>());
+ nativeView = ((MockAndroidViewWrapper)view.Content).NativeView;
+ }
+
+ Assert.AreEqual("foo", nativeView.Foo);
+ Assert.AreEqual(42, nativeView.Bar);
+ Assert.AreEqual("Bound Value", nativeView.Baz);
+ Assert.AreEqual(LayoutOptions.End, view.Content.GetValue(View.HorizontalOptionsProperty));
+ Assert.AreEqual(LayoutOptions.EndAndExpand, view.Content.GetValue(View.VerticalOptionsProperty));
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Xaml.UnitTests/OnPlatform.xaml b/Xamarin.Forms.Xaml.UnitTests/OnPlatform.xaml
index bf44299b..7f470a4a 100644
--- a/Xamarin.Forms.Xaml.UnitTests/OnPlatform.xaml
+++ b/Xamarin.Forms.Xaml.UnitTests/OnPlatform.xaml
@@ -1,9 +1,23 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Xamarin.Forms.Xaml.UnitTests.OnPlatform">
+ <ContentPage.Resources>
+ <ResourceDictionary>
+ <OnPlatform x:TypeArguments="FontAttributes" x:Key="fontAttributes">
+ <OnPlatform.iOS>Bold</OnPlatform.iOS>
+ <OnPlatform.Android>Italic</OnPlatform.Android>
+ </OnPlatform>
+ <OnPlatform x:Key="phone" x:TypeArguments="x:Double" iOS="20" Android="20" WinPhone="30"/>
+ <OnPlatform x:Key="tablet" x:TypeArguments="x:Double" iOS="40" Android="40" WinPhone="60"/>
+ <OnIdiom x:Key="fontSize" x:TypeArguments="x:Double"
+ Phone="{StaticResource phone}"
+ Tablet="{StaticResource tablet}"/>
+
+ </ResourceDictionary>
+ </ContentPage.Resources>
<StackLayout>
- <Label x:Name="label0">
+ <Label x:Name="label0" FontAttributes="{StaticResource fontAttributes}" FontSize="{StaticResource fontSize}">
<Label.IsVisible>
<OnPlatform x:TypeArguments="x:Boolean">
<OnPlatform.iOS>true</OnPlatform.iOS>
diff --git a/Xamarin.Forms.Xaml.UnitTests/OnPlatform.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/OnPlatform.xaml.cs
index 2c2c6482..d53a51c2 100644
--- a/Xamarin.Forms.Xaml.UnitTests/OnPlatform.xaml.cs
+++ b/Xamarin.Forms.Xaml.UnitTests/OnPlatform.xaml.cs
@@ -4,6 +4,7 @@ using System.Collections.Generic;
using Xamarin.Forms;
using NUnit.Framework;
+using Xamarin.Forms.Core.UnitTests;
namespace Xamarin.Forms.Xaml.UnitTests
{
@@ -22,6 +23,18 @@ namespace Xamarin.Forms.Xaml.UnitTests
[TestFixture]
public class Tests
{
+ [SetUp]
+ public void Setup()
+ {
+ Device.PlatformServices = new MockPlatformServices();
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ Device.PlatformServices = null;
+ }
+
[TestCase (false)]
[TestCase (true)]
public void BoolToVisibility (bool useCompiledXaml)
@@ -34,13 +47,61 @@ namespace Xamarin.Forms.Xaml.UnitTests
layout = new OnPlatform (useCompiledXaml);
Assert.AreEqual (false, layout.label0.IsVisible);
}
- }
- public void T ()
- {
- var onplat = new OnPlatform<bool> ();
- var label = new Label ();
- label.IsVisible = onplat;
+ [TestCase(false)]
+ [TestCase(true)]
+ public void DoubleToWidth(bool useCompiledXaml)
+ {
+ Device.OS = TargetPlatform.iOS;
+ var layout = new OnPlatform(useCompiledXaml);
+ Assert.AreEqual(20, layout.label0.WidthRequest);
+
+ Device.OS = TargetPlatform.Android;
+ layout = new OnPlatform(useCompiledXaml);
+ Assert.AreEqual(30, layout.label0.WidthRequest);
+ }
+
+ [TestCase(false)]
+ [TestCase(true)]
+ public void StringToText(bool useCompiledXaml)
+ {
+ Device.OS = TargetPlatform.iOS;
+ var layout = new OnPlatform(useCompiledXaml);
+ Assert.AreEqual("Foo", layout.label0.Text);
+
+ Device.OS = TargetPlatform.Android;
+ layout = new OnPlatform(useCompiledXaml);
+ Assert.AreEqual("Bar", layout.label0.Text);
+ }
+
+ [TestCase(false)]
+ [TestCase(true)]
+ public void OnPlatformAsResource(bool useCompiledXaml)
+ {
+ var layout = new OnPlatform(useCompiledXaml);
+ var onplat = layout.Resources ["fontAttributes"] as OnPlatform<FontAttributes>;
+ Assert.NotNull(onplat);
+ Assert.AreEqual(FontAttributes.Bold, onplat.iOS);
+
+ Assert.AreEqual(FontAttributes.Italic, onplat.Android);
+ }
+
+ [TestCase(false)]
+ [TestCase(true)]
+ public void OnPlatformAsResourceAreApplied(bool useCompiledXaml)
+ {
+ Device.OS = TargetPlatform.iOS;
+ var layout = new OnPlatform(useCompiledXaml);
+ var onidiom = layout.Resources ["fontSize"] as OnIdiom<double>;
+ Assert.NotNull(onidiom);
+ Assert.That(onidiom.Phone, Is.TypeOf<double>());
+ Assert.AreEqual(20, onidiom.Phone);
+ Assert.AreEqual(FontAttributes.Bold, layout.label0.FontAttributes);
+
+ Device.OS = TargetPlatform.Android;
+ layout = new OnPlatform(useCompiledXaml);
+ Assert.AreEqual(FontAttributes.Italic, layout.label0.FontAttributes);
+ }
}
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Xaml.UnitTests/StaticExtensionTests.cs b/Xamarin.Forms.Xaml.UnitTests/StaticExtensionTests.cs
deleted file mode 100644
index 86e02fe7..00000000
--- a/Xamarin.Forms.Xaml.UnitTests/StaticExtensionTests.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-using System;
-using NUnit.Framework;
-using System.Xml;
-
-using Xamarin.Forms.Core.UnitTests;
-using System.Reflection;
-
-namespace Xamarin.Forms.Xaml.UnitTests
-{
- [TestFixture]
- public class StaticExtensionTests : BaseTestFixture
- {
- IXamlTypeResolver typeResolver;
-
- [SetUp]
- public override void Setup ()
- {
- base.Setup ();
- var nsManager = new XmlNamespaceManager (new NameTable ());
- nsManager.AddNamespace ("local", "clr-namespace:Xamarin.Forms.Xaml.UnitTests;assembly=Xamarin.Forms.Xaml.UnitTests");
- nsManager.AddNamespace ("x", "http://schemas.microsoft.com/winfx/2006/xaml");
-
- typeResolver = new Internals.XamlTypeResolver (nsManager, XamlParser.GetElementType, Assembly.GetCallingAssembly ());
- }
-
- [Test]
- public void TestxStatic ()
- {
- //{x:Static Member=prefix:typeName.staticMemberName}
- //{x:Static prefix:typeName.staticMemberName}
-
- //The code entity that is referenced must be one of the following:
- // - A constant
- // - A static property
- // - A field
- // - An enumeration value
- // All other cases should throw
-
- var serviceProvider = new Internals.XamlServiceProvider (null, null) {
- IXamlTypeResolver = typeResolver,
- };
-
- //Static property
- var markupString = @"{x:Static Member=""local:MockxStatic.MockStaticProperty""}";
- Assert.AreEqual ("Property", (new MarkupExtensionParser ()).ParseExpression (ref markupString, serviceProvider));
-
- //constant
- markupString = @"{x:Static Member=""local:MockxStatic.MockConstant""}";
- Assert.AreEqual ("Constant", (new MarkupExtensionParser ()).ParseExpression (ref markupString, serviceProvider));
-
- //field
- markupString = @"{x:Static Member=""local:MockxStatic.MockField""}";
- Assert.AreEqual ("Field", (new MarkupExtensionParser ()).ParseExpression (ref markupString, serviceProvider));
-
- //enum
- markupString = @"{x:Static Member=""local:MockEnum.Second""}";
- Assert.AreEqual (MockEnum.Second, (new MarkupExtensionParser ()).ParseExpression (ref markupString, serviceProvider));
-
- //throw on InstanceProperty
- markupString = @"{x:Static Member=""local:MockxStatic.InstanceProperty""}";
- Assert.Throws<XamlParseException> (()=> (new MarkupExtensionParser ()).ParseExpression (ref markupString, serviceProvider));
-
- //quotes are optional
- markupString = @"{x:Static Member=local:MockxStatic.MockStaticProperty}";
- Assert.AreEqual ("Property", (new MarkupExtensionParser ()).ParseExpression (ref markupString, serviceProvider));
-
- //Member is optional
- markupString = @"{x:Static local:MockxStatic.MockStaticProperty}";
- Assert.AreEqual ("Property", (new MarkupExtensionParser ()).ParseExpression (ref markupString, serviceProvider));
- }
- }
-} \ No newline at end of file
diff --git a/Xamarin.Forms.Xaml.UnitTests/Validation/SetterOnNonBP.xaml b/Xamarin.Forms.Xaml.UnitTests/Validation/SetterOnNonBP.xaml
index 87252208..a40489cf 100644
--- a/Xamarin.Forms.Xaml.UnitTests/Validation/SetterOnNonBP.xaml
+++ b/Xamarin.Forms.Xaml.UnitTests/Validation/SetterOnNonBP.xaml
@@ -1,14 +1,14 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Xamarin.Forms.Xaml.UnitTests.SetterOnNonBP"
xmlns:local="clr-namespace:Xamarin.Forms.Xaml.UnitTests;assembly=Xamarin.Forms.Xaml.UnitTests">
- <local:FakeVisualElement>
- <local:FakeVisualElement.Style>
- <Style TargetType="local:FakeVisualElement">
+ <local:FakeView>
+ <local:FakeView.Style>
+ <Style TargetType="local:FakeView">
<Setter Property="NonBindable" Value="Should Fail"/>
</Style>
- </local:FakeVisualElement.Style>
- </local:FakeVisualElement>
+ </local:FakeView.Style>
+ </local:FakeView>
</ContentPage> \ No newline at end of file
diff --git a/Xamarin.Forms.Xaml.UnitTests/Validation/SetterOnNonBP.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Validation/SetterOnNonBP.xaml.cs
index f6d8ffea..cf1b0294 100644
--- a/Xamarin.Forms.Xaml.UnitTests/Validation/SetterOnNonBP.xaml.cs
+++ b/Xamarin.Forms.Xaml.UnitTests/Validation/SetterOnNonBP.xaml.cs
@@ -3,11 +3,12 @@
using Xamarin.Forms;
namespace Xamarin.Forms.Xaml.UnitTests
{
- public class FakeVisualElement : VisualElement
+ public class FakeView : View
{
public string NonBindable { get; set; }
}
+ [XamlCompilation(XamlCompilationOptions.Skip)]
public partial class SetterOnNonBP : ContentPage
{
public SetterOnNonBP ()
@@ -27,7 +28,10 @@ namespace Xamarin.Forms.Xaml.UnitTests
[TestCase (true)]
public void ShouldThrow (bool useCompiledXaml)
{
- Assert.Throws (new XamlParseExceptionConstraint (10, 13), () => new SetterOnNonBP (useCompiledXaml));
+ if (!useCompiledXaml)
+ Assert.Throws(new XamlParseExceptionConstraint(10, 13), () => new SetterOnNonBP(useCompiledXaml));
+ else
+ Assert.Throws(new XamlParseExceptionConstraint(10, 13), () => MockCompiler.Compile(typeof(SetterOnNonBP)));
}
}
}
diff --git a/Xamarin.Forms.Xaml.UnitTests/XStatic.xaml b/Xamarin.Forms.Xaml.UnitTests/XStatic.xaml
index 7c2910cd..32d2945e 100644
--- a/Xamarin.Forms.Xaml.UnitTests/XStatic.xaml
+++ b/Xamarin.Forms.Xaml.UnitTests/XStatic.xaml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Xamarin.Forms.Xaml.UnitTests"
@@ -10,5 +10,11 @@
Text="{x:Static local:MockxStatic.MockStaticProperty}" />
<Label x:Name="color"
TextColor="{x:Static local:MockxStatic.BackgroundColor}" />
+ <Label x:Name="constant"
+ Text="{x:Static local:MockxStatic.MockConstant}"/>
+ <Label x:Name="field"
+ Text="{x:Static local:MockxStatic.MockField}"/>
+ <ScrollView x:Name="enuM"
+ Orientation="{x:Static ScrollOrientation.Both}"/>
</StackLayout>
</ContentPage> \ No newline at end of file
diff --git a/Xamarin.Forms.Xaml.UnitTests/XStatic.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/XStatic.xaml.cs
index ff1f0199..d8a466e9 100644
--- a/Xamarin.Forms.Xaml.UnitTests/XStatic.xaml.cs
+++ b/Xamarin.Forms.Xaml.UnitTests/XStatic.xaml.cs
@@ -1,9 +1,5 @@
-using System;
-using System.Collections.Generic;
-
-using Xamarin.Forms;
-
-using NUnit.Framework;
+using NUnit.Framework;
+using Xamarin.Forms.Core.UnitTests;
namespace Xamarin.Forms.Xaml.UnitTests
{
@@ -16,7 +12,7 @@ namespace Xamarin.Forms.Xaml.UnitTests
public static readonly Color BackgroundColor = Color.Fuchsia;
}
- public enum MockEnum
+ public enum MockEnum : long
{
First,
Second,
@@ -37,6 +33,28 @@ namespace Xamarin.Forms.Xaml.UnitTests
[TestFixture]
public class Tests
{
+ //{x:Static Member=prefix:typeName.staticMemberName}
+ //{x:Static prefix:typeName.staticMemberName}
+
+ //The code entity that is referenced must be one of the following:
+ // - A constant
+ // - A static property
+ // - A field
+ // - An enumeration value
+ // All other cases should throw
+
+ [SetUp]
+ public void Setup()
+ {
+ Device.PlatformServices = new MockPlatformServices();
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ Device.PlatformServices = null;
+ }
+
[TestCase (false)]
[TestCase (true)]
public void StaticProperty (bool useCompiledXaml)
@@ -60,6 +78,30 @@ namespace Xamarin.Forms.Xaml.UnitTests
var layout = new XStatic (useCompiledXaml);
Assert.AreEqual (Color.Fuchsia, layout.color.TextColor);
}
+
+ [TestCase(false)]
+ [TestCase(true)]
+ public void Constant(bool useCompiledXaml)
+ {
+ var layout = new XStatic(useCompiledXaml);
+ Assert.AreEqual("Constant", layout.constant.Text);
+ }
+
+ [TestCase(false)]
+ [TestCase(true)]
+ public void Field(bool useCompiledXaml)
+ {
+ var layout = new XStatic(useCompiledXaml);
+ Assert.AreEqual("Field", layout.field.Text);
+ }
+
+ [TestCase(false)]
+ [TestCase(true)]
+ public void Enum(bool useCompiledXaml)
+ {
+ var layout = new XStatic(useCompiledXaml);
+ Assert.AreEqual(ScrollOrientation.Both, layout.enuM.Orientation);
+ }
}
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Xaml.UnitTests/XStaticException.xaml b/Xamarin.Forms.Xaml.UnitTests/XStaticException.xaml
new file mode 100644
index 00000000..58d3cb10
--- /dev/null
+++ b/Xamarin.Forms.Xaml.UnitTests/XStaticException.xaml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ xmlns:local="clr-namespace:Xamarin.Forms.Xaml.UnitTests"
+ x:Class="Xamarin.Forms.Xaml.UnitTests.XStaticException">
+ <Label x:Name="shouldThrow"
+ Text="{x:Static Member=local:MockxStatic.InstanceProperty}" />
+</ContentPage> \ No newline at end of file
diff --git a/Xamarin.Forms.Xaml.UnitTests/XStaticException.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/XStaticException.xaml.cs
new file mode 100644
index 00000000..261de06a
--- /dev/null
+++ b/Xamarin.Forms.Xaml.UnitTests/XStaticException.xaml.cs
@@ -0,0 +1,55 @@
+using NUnit.Framework;
+using Xamarin.Forms.Core.UnitTests;
+
+namespace Xamarin.Forms.Xaml.UnitTests
+{
+ [XamlCompilation(XamlCompilationOptions.Skip)]
+ public partial class XStaticException : ContentPage
+ {
+ public XStaticException()
+ {
+ InitializeComponent();
+ }
+
+ public XStaticException(bool useCompiledXaml)
+ {
+ //this stub will be replaced at compile time
+ }
+
+ [TestFixture]
+ public class Tests
+ {
+ //{x:Static Member=prefix:typeName.staticMemberName}
+ //{x:Static prefix:typeName.staticMemberName}
+
+ //The code entity that is referenced must be one of the following:
+ // - A constant
+ // - A static property
+ // - A field
+ // - An enumeration value
+ // All other cases should throw
+
+ [SetUp]
+ public void Setup()
+ {
+ Device.PlatformServices = new MockPlatformServices();
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ Device.PlatformServices = null;
+ }
+
+ [TestCase(false)]
+ [TestCase(true)]
+ public void ThrowOnInstanceProperty(bool useCompiledXaml)
+ {
+ if (!useCompiledXaml)
+ Assert.Throws(new XamlParseExceptionConstraint(7, 6), () => new XStaticException(useCompiledXaml));
+ else
+ Assert.Throws(new XamlParseExceptionConstraint(7, 6), () => MockCompiler.Compile(typeof(XStaticException)));
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj b/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj
index 49dbec10..dc7f7ea1 100644
--- a/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj
+++ b/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj
@@ -46,7 +46,6 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NoWarn>0672;0219;0414</NoWarn>
</PropertyGroup>
- <Import Project="..\Xamarin.Forms.Core\SignWithXamarinKey.props" />
<ItemGroup>
<Reference Include="Mono.Cecil, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.dll</HintPath>
@@ -82,6 +81,9 @@
<Link>MockPlatformServices.cs</Link>
</Compile>
<Compile Include="FontConverterTests.cs" />
+ <Compile Include="Issues\Bz43450.xaml.cs">
+ <DependentUpon>Bz43450.xaml</DependentUpon>
+ </Compile>
<Compile Include="Issues\Bz41296.xaml.cs">
<DependentUpon>Bz41296.xaml</DependentUpon>
</Compile>
@@ -94,7 +96,6 @@
<Compile Include="MarkupExtensionTests.cs" />
<Compile Include="NameScopeTests.cs" />
<Compile Include="OnPlatformTests.cs" />
- <Compile Include="StaticExtensionTests.cs" />
<Compile Include="NullExtensionTests.cs" />
<Compile Include="TypeExtensionTests.cs" />
<Compile Include="FactoryMethodTests.cs" />
@@ -360,6 +361,16 @@
<Compile Include="TypeExtension.xaml.cs">
<DependentUpon>TypeExtension.xaml</DependentUpon>
</Compile>
+ <Compile Include="NativeViewsAndBindings.xaml.cs">
+ <DependentUpon>NativeViewsAndBindings.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="MockCompiler.cs" />
+ <Compile Include="XStaticException.xaml.cs">
+ <DependentUpon>XStaticException.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="CompiledTypeConverter.xaml.cs" >
+ <DependentUpon>CompiledTypeConverter.xaml</DependentUpon>
+ </Compile>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="..\.nuspec\Xamarin.Forms.Debug.targets" />
@@ -380,12 +391,10 @@
<Project>{96D89208-4EB9-4451-BE73-8A9DF3D9D7B7}</Project>
<Name>Xamarin.Forms.Build.Tasks</Name>
</ProjectReference>
-<!-- Xamarin.Forms.Controls cannot be built at the moment
<ProjectReference Include="..\Xamarin.Forms.Controls\Xamarin.Forms.Controls.csproj">
<Project>{CB9C96CE-125C-4A68-B6A1-C3FF1FBF93E1}</Project>
<Name>Xamarin.Forms.Controls</Name>
</ProjectReference>
--->
<ProjectReference Include="..\Xamarin.Forms.Maps\Xamarin.Forms.Maps.csproj">
<Project>{7D13BAC2-C6A4-416A-B07E-C169B199E52B}</Project>
<Name>Xamarin.Forms.Maps</Name>
@@ -503,11 +512,9 @@
<EmbeddedResource Include="Speed\SimpleContentPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
-<!-- Disabling Issue3076 test because it depends on Xamarin.Forms.Controls
<EmbeddedResource Include="Issues\Issue3076.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
--->
<EmbeddedResource Include="ConstraintExpression.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
@@ -643,6 +650,15 @@
<EmbeddedResource Include="TypeExtension.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
+ <EmbeddedResource Include="NativeViewsAndBindings.xaml">
+ <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+ </EmbeddedResource>
+ <EmbeddedResource Include="XStaticException.xaml">
+ <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+ </EmbeddedResource>
+ <EmbeddedResource Include="CompiledTypeConverter.xaml" >
+ <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+ </EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
@@ -668,4 +684,9 @@
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
-</Project> \ No newline at end of file
+ <ItemGroup>
+ <EmbeddedResource Include="Issues\Bz43450.xaml">
+ <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+ </EmbeddedResource>
+ </ItemGroup>
+</Project>
diff --git a/Xamarin.Forms.Xaml.Xamlg/Xamarin.Forms.Xaml.Xamlg.csproj b/Xamarin.Forms.Xaml.Xamlg/Xamarin.Forms.Xaml.Xamlg.csproj
index 63074a8b..39d2e0d7 100644
--- a/Xamarin.Forms.Xaml.Xamlg/Xamarin.Forms.Xaml.Xamlg.csproj
+++ b/Xamarin.Forms.Xaml.Xamlg/Xamarin.Forms.Xaml.Xamlg.csproj
@@ -45,7 +45,6 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NoWarn>0618</NoWarn>
</PropertyGroup>
- <Import Project="..\Xamarin.Forms.Core\SignWithXamarinKey.props" />
<ItemGroup>
<Reference Include="Microsoft.Build" />
<Reference Include="Microsoft.Build.Framework" />
diff --git a/Xamarin.Forms.Xaml/ApplyPropertiesVisitor.cs b/Xamarin.Forms.Xaml/ApplyPropertiesVisitor.cs
index f2d325ac..36f5b7fd 100644
--- a/Xamarin.Forms.Xaml/ApplyPropertiesVisitor.cs
+++ b/Xamarin.Forms.Xaml/ApplyPropertiesVisitor.cs
@@ -7,6 +7,8 @@ using System.Xml;
using Xamarin.Forms.Internals;
using Xamarin.Forms.Xaml.Internals;
+using static System.String;
+
namespace Xamarin.Forms.Xaml
{
internal class ApplyPropertiesVisitor : IXamlNodeVisitor
@@ -26,20 +28,17 @@ namespace Xamarin.Forms.Xaml
StopOnResourceDictionary = stopOnResourceDictionary;
}
- Dictionary<INode, object> Values
- {
+ Dictionary<INode, object> Values {
get { return Context.Values; }
}
HydratationContext Context { get; }
- public bool VisitChildrenFirst
- {
+ public bool VisitChildrenFirst {
get { return true; }
}
- public bool StopOnDataTemplate
- {
+ public bool StopOnDataTemplate {
get { return true; }
}
@@ -48,12 +47,11 @@ namespace Xamarin.Forms.Xaml
public void Visit(ValueNode node, INode parentNode)
{
var parentElement = parentNode as IElementNode;
- var value = Values[node];
- var source = Values[parentNode];
+ var value = Values [node];
+ var source = Values [parentNode];
XmlName propertyName;
- if (TryGetPropertyName(node, parentNode, out propertyName))
- {
+ if (TryGetPropertyName(node, parentNode, out propertyName)) {
if (Skips.Contains(propertyName))
return;
if (parentElement.SkipProperties.Contains(propertyName))
@@ -62,13 +60,10 @@ namespace Xamarin.Forms.Xaml
propertyName.LocalName == "Ignorable")
return;
SetPropertyValue(source, propertyName, value, Context.RootElement, node, Context, node);
- }
- else if (IsCollectionItem(node, parentNode) && parentNode is IElementNode)
- {
+ } else if (IsCollectionItem(node, parentNode) && parentNode is IElementNode) {
// Collection element, implicit content, or implicit collection element.
- var contentProperty = GetContentPropertyName(Context.Types[parentElement].GetTypeInfo());
- if (contentProperty != null)
- {
+ var contentProperty = GetContentPropertyName(Context.Types [parentElement].GetTypeInfo());
+ if (contentProperty != null) {
var name = new XmlName(((ElementNode)parentNode).NamespaceURI, contentProperty);
if (Skips.Contains(name))
return;
@@ -85,19 +80,17 @@ namespace Xamarin.Forms.Xaml
public void Visit(ElementNode node, INode parentNode)
{
- var value = Values[node];
+ var value = Values [node];
var parentElement = parentNode as IElementNode;
var markupExtension = value as IMarkupExtension;
var valueProvider = value as IValueProvider;
- if (markupExtension != null)
- {
+ if (markupExtension != null) {
var serviceProvider = new XamlServiceProvider(node, Context);
value = markupExtension.ProvideValue(serviceProvider);
}
- if (valueProvider != null)
- {
+ if (valueProvider != null) {
var serviceProvider = new XamlServiceProvider(node, Context);
value = valueProvider.ProvideValue(serviceProvider);
}
@@ -124,37 +117,29 @@ namespace Xamarin.Forms.Xaml
SetTemplate(source as ElementTemplate, node);
else
SetPropertyValue(source, propertyName, value, Context.RootElement, node, Context, node);
- }
- else if (IsCollectionItem(node, parentNode) && parentNode is IElementNode)
- {
+ } else if (IsCollectionItem(node, parentNode) && parentNode is IElementNode) {
// Collection element, implicit content, or implicit collection element.
string contentProperty;
- if (typeof (IEnumerable).GetTypeInfo().IsAssignableFrom(Context.Types[parentElement].GetTypeInfo()))
- {
- var source = Values[parentNode];
- if (!(typeof (ResourceDictionary).IsAssignableFrom(Context.Types[parentElement])))
- {
+ if (typeof(IEnumerable).GetTypeInfo().IsAssignableFrom(Context.Types [parentElement].GetTypeInfo())) {
+ var source = Values [parentNode];
+ if (!(typeof(ResourceDictionary).IsAssignableFrom(Context.Types [parentElement]))) {
var addMethod =
- Context.Types[parentElement].GetRuntimeMethods().First(mi => mi.Name == "Add" && mi.GetParameters().Length == 1);
- addMethod.Invoke(source, new[] { value });
+ Context.Types [parentElement].GetRuntimeMethods().First(mi => mi.Name == "Add" && mi.GetParameters().Length == 1);
+ addMethod.Invoke(source, new [] { value });
}
- }
- else if ((contentProperty = GetContentPropertyName(Context.Types[parentElement].GetTypeInfo())) != null)
- {
+ } else if ((contentProperty = GetContentPropertyName(Context.Types [parentElement].GetTypeInfo())) != null) {
var name = new XmlName(node.NamespaceURI, contentProperty);
if (Skips.Contains(name))
return;
if (parentElement.SkipProperties.Contains(propertyName))
return;
- var source = Values[parentNode];
+ var source = Values [parentNode];
SetPropertyValue(source, name, value, Context.RootElement, node, Context, node);
}
- }
- else if (IsCollectionItem(node, parentNode) && parentNode is ListNode)
- {
+ } else if (IsCollectionItem(node, parentNode) && parentNode is ListNode) {
var parentList = (ListNode)parentNode;
- var source = Values[parentNode.Parent];
+ var source = Values [parentNode.Parent];
if (Skips.Contains(parentList.XmlName))
return;
@@ -165,15 +150,11 @@ namespace Xamarin.Forms.Xaml
GetRealNameAndType(ref elementType, parentList.XmlName.NamespaceURI, ref localname, Context, node);
PropertyInfo propertyInfo = null;
- try
- {
+ try {
propertyInfo = elementType.GetRuntimeProperty(localname);
- }
- catch (AmbiguousMatchException)
- {
+ } catch (AmbiguousMatchException) {
// Get most derived instance of property
- foreach (var property in elementType.GetRuntimeProperties().Where(prop => prop.Name == localname))
- {
+ foreach (var property in elementType.GetRuntimeProperties().Where(prop => prop.Name == localname)) {
if (propertyInfo == null || propertyInfo.DeclaringType.IsAssignableFrom(property.DeclaringType))
propertyInfo = property;
}
@@ -184,7 +165,7 @@ namespace Xamarin.Forms.Xaml
if (!propertyInfo.CanRead || (getter = propertyInfo.GetMethod) == null)
throw new XamlParseException(string.Format("Property {0} does not have an accessible getter", localname), node);
IEnumerable collection;
- if ((collection = getter.Invoke(source, new object[] { }) as IEnumerable) == null)
+ if ((collection = getter.Invoke(source, new object [] { }) as IEnumerable) == null)
throw new XamlParseException(string.Format("Property {0} is null or is not IEnumerable", localname), node);
MethodInfo addMethod;
if (
@@ -192,7 +173,7 @@ namespace Xamarin.Forms.Xaml
collection.GetType().GetRuntimeMethods().First(mi => mi.Name == "Add" && mi.GetParameters().Length == 1)) == null)
throw new XamlParseException(string.Format("Value of {0} does not have a Add() method", localname), node);
- addMethod.Invoke(collection, new[] { Values[node] });
+ addMethod.Invoke(collection, new [] { Values [node] });
}
}
@@ -210,8 +191,7 @@ namespace Xamarin.Forms.Xaml
var parentElement = parentNode as IElementNode;
if (parentElement == null)
return false;
- foreach (var kvp in parentElement.Properties)
- {
+ foreach (var kvp in parentElement.Properties) {
if (kvp.Value != node)
continue;
name = kvp.Key;
@@ -230,8 +210,7 @@ namespace Xamarin.Forms.Xaml
internal static string GetContentPropertyName(TypeInfo typeInfo)
{
- while (typeInfo != null)
- {
+ while (typeInfo != null) {
var propName = GetContentPropertyName(typeInfo.CustomAttributes);
if (propName != null)
return propName;
@@ -246,8 +225,8 @@ namespace Xamarin.Forms.Xaml
attributes.FirstOrDefault(cad => ContentPropertyAttribute.ContentPropertyTypes.Contains(cad.AttributeType.FullName));
if (contentAttribute == null || contentAttribute.ConstructorArguments.Count != 1)
return null;
- if (contentAttribute.ConstructorArguments[0].ArgumentType == typeof (string))
- return (string)contentAttribute.ConstructorArguments[0].Value;
+ if (contentAttribute.ConstructorArguments [0].ArgumentType == typeof(string))
+ return (string)contentAttribute.ConstructorArguments [0].Value;
return null;
}
@@ -255,8 +234,7 @@ namespace Xamarin.Forms.Xaml
HydratationContext context, IXmlLineInfo lineInfo)
{
var dotIdx = localname.IndexOf('.');
- if (dotIdx > 0)
- {
+ if (dotIdx > 0) {
var typename = localname.Substring(0, dotIdx);
localname = localname.Substring(dotIdx + 1);
XamlParseException xpe;
@@ -272,19 +250,11 @@ namespace Xamarin.Forms.Xaml
static BindableProperty GetBindableProperty(Type elementType, string localName, IXmlLineInfo lineInfo,
bool throwOnError = false)
{
- var propertyName = localName + "Property";
- Type currentType = elementType;
- FieldInfo bindableFieldInfo = null;
-
- while (bindableFieldInfo == null && currentType != null) {
- bindableFieldInfo =
- currentType.GetFields().FirstOrDefault(fi => fi.Name == propertyName && fi.IsStatic && fi.IsPublic);
- currentType = currentType.BaseType;
- }
+ var bindableFieldInfo =
+ elementType.GetFields().FirstOrDefault(fi => fi.Name == localName + "Property" && fi.IsStatic && fi.IsPublic);
Exception exception = null;
- if (exception == null && bindableFieldInfo == null)
- {
+ if (exception == null && bindableFieldInfo == null) {
exception =
new XamlParseException(
string.Format("BindableProperty {0} not found on {1}", localName + "Property", elementType.Name), lineInfo);
@@ -297,148 +267,204 @@ namespace Xamarin.Forms.Xaml
return null;
}
- public static void SetPropertyValue(object xamlelement, XmlName propertyName, object value, object rootElement,
- INode node, HydratationContext context, IXmlLineInfo lineInfo)
+ public static void SetPropertyValue(object xamlelement, XmlName propertyName, object value, object rootElement, INode node, HydratationContext context, IXmlLineInfo lineInfo)
{
- var elementType = xamlelement.GetType();
- var localname = propertyName.LocalName;
-
+ var localName = propertyName.LocalName;
var serviceProvider = new XamlServiceProvider(node, context);
+ Exception xpe = null;
//If it's an attached BP, update elementType and propertyName
- var attached = GetRealNameAndType(ref elementType, propertyName.NamespaceURI, ref localname, context, lineInfo);
+ var bpOwnerType = xamlelement.GetType();
+ var attached = GetRealNameAndType(ref bpOwnerType, propertyName.NamespaceURI, ref localName, context, lineInfo);
+ var property = GetBindableProperty(bpOwnerType, localName, lineInfo, false);
//If the target is an event, connect
- var eventInfo = elementType.GetRuntimeEvent(localname);
- if (eventInfo != null && value is string)
- {
- var methodInfo = rootElement.GetType().GetRuntimeMethods().FirstOrDefault(mi => mi.Name == (string)value);
- if (methodInfo == null) {
- var xpe = new XamlParseException (string.Format ("No method {0} found on type {1}", value, rootElement.GetType ()), lineInfo);
- if (context.DoNotThrowOnExceptions) {
- System.Diagnostics.Debug.WriteLine (xpe.Message);
- return;
- } else
- throw xpe;
- }
- try
- {
- eventInfo.AddEventHandler(xamlelement, methodInfo.CreateDelegate(eventInfo.EventHandlerType, rootElement));
- }
- catch (ArgumentException)
- {
- var xpe = new XamlParseException (string.Format ("Method {0} does not have the correct signature", value), lineInfo);
- if (context.DoNotThrowOnExceptions)
- System.Diagnostics.Debug.WriteLine (xpe.Message);
- else
- throw xpe;
- }
+ if (xpe == null && TryConnectEvent(xamlelement, localName, value, rootElement, lineInfo, out xpe))
+ return;
+ //If Value is DynamicResource and it's a BP, SetDynamicResource
+ if (xpe == null && TrySetDynamicResource(xamlelement, property, value, lineInfo, out xpe))
return;
- }
- var property = GetBindableProperty(elementType, localname, lineInfo, false);
+ //If value is BindingBase, SetBinding
+ if (xpe == null && TrySetBinding(xamlelement, property, localName, value, lineInfo, out xpe))
+ return;
- //If Value is DynamicResource and it's a BP, SetDynamicResource
- if (value is DynamicResource && property != null)
- {
- if (!(xamlelement.GetType()).GetTypeInfo().IsSubclassOf(typeof (BindableObject)))
- throw new XamlParseException(string.Format("{0} is not a BindableObject", xamlelement.GetType().Name), lineInfo);
- ((BindableObject)xamlelement).SetDynamicResource(property, ((DynamicResource)value).Key);
+ //If it's a BindableProberty, SetValue
+ if (xpe == null && TrySetValue(xamlelement, property, attached, value, lineInfo, serviceProvider, out xpe))
return;
- }
- //If value is BindingBase, and target is a BindableProperty, SetBinding
- if (value is BindingBase && property != null)
- {
- if (!(xamlelement.GetType()).GetTypeInfo().IsSubclassOf(typeof (BindableObject)))
- throw new XamlParseException(string.Format("{0} is not a BindableObject", xamlelement.GetType().Name), lineInfo);
+ //If we can assign that value to a normal property, let's do it
+ if (xpe == null && TrySetProperty(xamlelement, localName, value, lineInfo, serviceProvider, out xpe))
+ return;
- ((BindableObject)xamlelement).SetBinding(property, value as BindingBase);
+ //If it's an already initialized property, add to it
+ if (xpe == null && TryAddToProperty(xamlelement, localName, value, lineInfo, serviceProvider, out xpe))
return;
+
+ xpe = xpe ?? new XamlParseException($"Cannot assign property \"{localName}\": Property does not exists, or is not assignable, or mismatching type between value and property", lineInfo);
+ if (context.DoNotThrowOnExceptions)
+ System.Diagnostics.Debug.WriteLine(xpe.Message);
+ else
+ throw xpe;
+ }
+
+ static bool TryConnectEvent(object element, string localName, object value, object rootElement, IXmlLineInfo lineInfo, out Exception exception)
+ {
+ exception = null;
+
+ var elementType = element.GetType();
+ var eventInfo = elementType.GetRuntimeEvent(localName);
+ var stringValue = value as string;
+
+ if (eventInfo == null || IsNullOrEmpty(stringValue))
+ return false;
+
+ var methodInfo = rootElement.GetType().GetRuntimeMethods().FirstOrDefault(mi => mi.Name == (string)value);
+ if (methodInfo == null) {
+ exception = new XamlParseException($"No method {value} found on type {rootElement.GetType()}", lineInfo);
+ return false;
}
- //If it's a BindableProberty, SetValue
+ try {
+ eventInfo.AddEventHandler(element, methodInfo.CreateDelegate(eventInfo.EventHandlerType, rootElement));
+ return true;
+ } catch (ArgumentException ae) {
+ exception = new XamlParseException($"Method {stringValue} does not have the correct signature", lineInfo, ae);
+ }
+ return false;
+ }
+
+ static bool TrySetDynamicResource(object element, BindableProperty property, object value, IXmlLineInfo lineInfo, out Exception exception)
+ {
+ exception = null;
+
+ var elementType = element.GetType();
+ var dynamicResource = value as DynamicResource;
+ var bindable = element as BindableObject;
+
+ if (dynamicResource == null || property == null)
+ return false;
+
+ if (bindable == null) {
+ exception = new XamlParseException($"{elementType.Name} is not a BindableObject", lineInfo);
+ return false;
+ }
+
+ bindable.SetDynamicResource(property, dynamicResource.Key);
+ return true;
+ }
+
+ static bool TrySetBinding(object element, BindableProperty property, string localName, object value, IXmlLineInfo lineInfo, out Exception exception)
+ {
+ exception = null;
+
+ var elementType = element.GetType();
+ var binding = value as BindingBase;
+ var bindable = element as BindableObject;
+ var nativeBindingService = DependencyService.Get<INativeBindingService>();
+
+ if (binding == null)
+ return false;
+
+ if (bindable != null && property != null) {
+ bindable.SetBinding(property, binding);
+ return true;
+ }
+
+ if (nativeBindingService != null && property != null && nativeBindingService.TrySetBinding(element, property, binding))
+ return true;
+
+ if (nativeBindingService != null && nativeBindingService.TrySetBinding(element, localName, binding))
+ return true;
+
if (property != null)
- {
- if (!(xamlelement.GetType()).GetTypeInfo().IsSubclassOf(typeof (BindableObject)))
- throw new XamlParseException(string.Format("{0} is not a BindableObject", xamlelement.GetType().Name), lineInfo);
- Func<MemberInfo> minforetriever;
- if (attached)
- minforetriever = () => elementType.GetRuntimeMethod("Get" + localname, new[] { typeof (BindableObject) });
- else
- minforetriever = () => elementType.GetRuntimeProperty(localname);
+ exception = new XamlParseException($"{elementType.Name} is not a BindableObject or does not support native bindings", lineInfo);
+
+ return false;
+ }
+
+ static bool TrySetValue(object element, BindableProperty property, bool attached, object value, IXmlLineInfo lineInfo, XamlServiceProvider serviceProvider, out Exception exception)
+ {
+ exception = null;
- var convertedValue = value.ConvertTo(property.ReturnType, minforetriever, serviceProvider);
+ var elementType = element.GetType();
+ var bindable = element as BindableObject;
+ var nativeBindingService = DependencyService.Get<INativeBindingService>();
+ if (property == null)
+ return false;
+
+ Func<MemberInfo> minforetriever;
+ if (attached)
+ minforetriever = () => property.DeclaringType.GetRuntimeMethod("Get" + property.PropertyName, new [] { typeof(BindableObject) });
+ else
+ minforetriever = () => property.DeclaringType.GetRuntimeProperty(property.PropertyName);
+ var convertedValue = value.ConvertTo(property.ReturnType, minforetriever, serviceProvider);
+
+ if (bindable != null) {
//SetValue doesn't throw on mismatching type, so check before to get a chance to try the property setting or the collection adding
var nullable = property.ReturnTypeInfo.IsGenericType &&
- property.ReturnTypeInfo.GetGenericTypeDefinition() == typeof (Nullable<>);
+ property.ReturnTypeInfo.GetGenericTypeDefinition() == typeof(Nullable<>);
if ((convertedValue == null && (!property.ReturnTypeInfo.IsValueType || nullable)) ||
- (property.ReturnType.IsInstanceOfType(convertedValue)))
- {
- ((BindableObject)xamlelement).SetValue(property, convertedValue);
- return;
+ (property.ReturnType.IsInstanceOfType(convertedValue))) {
+ bindable.SetValue(property, convertedValue);
+ return true;
}
+ return false;
}
- var exception = new XamlParseException(
- String.Format("No Property of name {0} found", propertyName.LocalName), lineInfo);
+ if (nativeBindingService != null && nativeBindingService.TrySetValue(element, property, convertedValue))
+ return true;
+
+ exception = new XamlParseException($"{elementType.Name} is not a BindableObject or does not support setting native BindableProperties", lineInfo);
+ return false;
+ }
- //If we can assign that value to a normal property, let's do it
- var propertyInfo = elementType.GetRuntimeProperties().FirstOrDefault(p => p.Name == localname);
+ static bool TrySetProperty(object element, string localName, object value, IXmlLineInfo lineInfo, XamlServiceProvider serviceProvider, out Exception exception)
+ {
+ exception = null;
+
+ var elementType = element.GetType();
+ var propertyInfo = elementType.GetRuntimeProperties().FirstOrDefault(p => p.Name == localName);
MethodInfo setter;
- if (propertyInfo != null && propertyInfo.CanWrite && (setter = propertyInfo.SetMethod) != null)
- {
- object convertedValue = value.ConvertTo(propertyInfo.PropertyType, () => propertyInfo, serviceProvider);
- if (convertedValue == null || propertyInfo.PropertyType.IsInstanceOfType(convertedValue))
- {
- try
- {
- setter.Invoke(xamlelement, new[] { convertedValue });
- return;
- }
- catch (ArgumentException)
- {
- }
- }
- else
- {
- exception = new XamlParseException(
- String.Format("Cannot assign property \"{0}\": type mismatch between \"{1}\" and \"{2}\"", propertyName.LocalName,
- value.GetType(), propertyInfo.PropertyType), lineInfo);
- }
- }
+ if (propertyInfo == null || !propertyInfo.CanWrite || (setter = propertyInfo.SetMethod) == null)
+ return false;
- //If it's an already initialized property, add to it
+ object convertedValue = value.ConvertTo(propertyInfo.PropertyType, () => propertyInfo, serviceProvider);
+ if (convertedValue != null && !propertyInfo.PropertyType.IsInstanceOfType(convertedValue))
+ return false;
+
+ setter.Invoke(element, new object [] { convertedValue });
+ return true;
+ }
+
+ static bool TryAddToProperty(object element, string localName, object value, IXmlLineInfo lineInfo, XamlServiceProvider serviceProvider, out Exception exception)
+ {
+ exception = null;
+
+ var elementType = element.GetType();
+ var propertyInfo = elementType.GetRuntimeProperties().FirstOrDefault(p => p.Name == localName);
MethodInfo getter;
- if (propertyInfo != null && propertyInfo.CanRead && (getter = propertyInfo.GetMethod) != null)
- {
- IEnumerable collection;
- MethodInfo addMethod;
- if ((collection = getter.Invoke(xamlelement, new object[] { }) as IEnumerable) != null
- &&
- (addMethod =
- collection.GetType().GetRuntimeMethods().First(mi => mi.Name == "Add" && mi.GetParameters().Length == 1)) !=
- null)
- {
- addMethod.Invoke(collection,
- new[] { value.ConvertTo(addMethod.GetParameters()[0].ParameterType, (Func<TypeConverter>)null, serviceProvider) });
- return;
- }
- }
+ if (propertyInfo == null || !propertyInfo.CanRead || (getter = propertyInfo.GetMethod) == null)
+ return false;
- if (context.DoNotThrowOnExceptions)
- System.Diagnostics.Debug.WriteLine (exception.Message);
- else
- throw exception;
+ var collection = getter.Invoke(element, new object [] { }) as IEnumerable;
+ if (collection == null)
+ return false;
+
+ var addMethod = collection.GetType().GetRuntimeMethods().First(mi => mi.Name == "Add" && mi.GetParameters().Length == 1);
+ if (addMethod == null)
+ return false;
+
+ addMethod.Invoke(collection, new [] { value.ConvertTo(addMethod.GetParameters() [0].ParameterType, (Func<TypeConverter>)null, serviceProvider) });
+ return true;
}
void SetTemplate(ElementTemplate dt, INode node)
{
#pragma warning disable 0612
- ((IDataTemplate)dt).LoadTemplate = () =>
- {
+ ((IDataTemplate)dt).LoadTemplate = () => {
#pragma warning restore 0612
var cnode = node.Clone();
var context = new HydratationContext { ParentContext = Context, RootElement = Context.RootElement };
@@ -449,7 +475,7 @@ namespace Xamarin.Forms.Xaml
cnode.Accept(new RegisterXNamesVisitor(context), null);
cnode.Accept(new FillResourceDictionariesVisitor(context), null);
cnode.Accept(new ApplyPropertiesVisitor(context, true), null);
- return context.Values[cnode];
+ return context.Values [cnode];
};
}
}
diff --git a/Xamarin.Forms.Xaml/CreateValuesVisitor.cs b/Xamarin.Forms.Xaml/CreateValuesVisitor.cs
index d6848033..25a936fa 100644
--- a/Xamarin.Forms.Xaml/CreateValuesVisitor.cs
+++ b/Xamarin.Forms.Xaml/CreateValuesVisitor.cs
@@ -74,8 +74,7 @@ namespace Xamarin.Forms.Xaml
else if (!type.GetTypeInfo().DeclaredConstructors.Any(ci => ci.IsPublic && ci.GetParameters().Length == 0) &&
!ValidateCtorArguments(type, node, out ctorargname))
{
- throw new XamlParseException(
- String.Format("The Property {0} is required to create a {1} object.", ctorargname, type.FullName), node);
+ throw new XamlParseException($"The Property {ctorargname} is required to create a {type.FullName} object.", node);
}
else
{
@@ -199,12 +198,27 @@ namespace Xamarin.Forms.Xaml
var factoryMethod = ((string)((ValueNode)node.Properties[XmlName.xFactoryMethod]).Value);
Type[] types = arguments == null ? new Type[0] : arguments.Select(a => a.GetType()).ToArray();
- var mi = nodeType.GetRuntimeMethod(factoryMethod, types);
- if (mi == null || !mi.IsStatic)
- {
- throw new MissingMemberException(String.Format("No static method found for {0}::{1} ({2})", nodeType.FullName,
- factoryMethod, string.Join(", ", types.Select(t => t.FullName))));
- }
+ Func<MethodInfo, bool> isMatch = m => {
+ if (m.Name != factoryMethod)
+ return false;
+ var p = m.GetParameters();
+ if (p.Length != types.Length)
+ return false;
+ if (!m.IsStatic)
+ return false;
+ for (var i = 0; i < p.Length; i++) {
+ if ((p [i].ParameterType.IsAssignableFrom(types [i])))
+ continue;
+ var op_impl = p [i].ParameterType.GetRuntimeMethod("op_Implicit", new [] { types [i]});
+ if (op_impl == null)
+ return false;
+ arguments [i] = op_impl.Invoke(null, new [] { arguments [i]});
+ }
+ return true;
+ };
+ var mi = nodeType.GetRuntimeMethods().FirstOrDefault(isMatch);
+ if (mi == null)
+ throw new MissingMemberException($"No static method found for {nodeType.FullName}::{factoryMethod} ({string.Join(", ", types.Select(t => t.FullName))})");
return mi.Invoke(null, arguments);
}
diff --git a/Xamarin.Forms.Xaml/MarkupExtensions/BindingExtension.cs b/Xamarin.Forms.Xaml/MarkupExtensions/BindingExtension.cs
index f9af72a4..5b519e62 100644
--- a/Xamarin.Forms.Xaml/MarkupExtensions/BindingExtension.cs
+++ b/Xamarin.Forms.Xaml/MarkupExtensions/BindingExtension.cs
@@ -23,9 +23,11 @@ namespace Xamarin.Forms.Xaml
public object Source { get; set; }
+ public string UpdateSourceEventName { get; set; }
+
BindingBase IMarkupExtension<BindingBase>.ProvideValue(IServiceProvider serviceProvider)
{
- return new Binding(Path, Mode, Converter, ConverterParameter, StringFormat, Source);
+ return new Binding(Path, Mode, Converter, ConverterParameter, StringFormat, Source) { UpdateSourceEventName = UpdateSourceEventName };
}
object IMarkupExtension.ProvideValue(IServiceProvider serviceProvider)
diff --git a/Xamarin.Forms.Xaml/MarkupExtensions/StaticExtension.cs b/Xamarin.Forms.Xaml/MarkupExtensions/StaticExtension.cs
index 7585eb6e..8de0ebf4 100644
--- a/Xamarin.Forms.Xaml/MarkupExtensions/StaticExtension.cs
+++ b/Xamarin.Forms.Xaml/MarkupExtensions/StaticExtension.cs
@@ -5,7 +5,7 @@ using System.Xml;
namespace Xamarin.Forms.Xaml
{
- [ContentProperty("Member")]
+ [ContentProperty(nameof(Member))]
public class StaticExtension : IMarkupExtension
{
public string Member { get; set; }
@@ -16,7 +16,7 @@ namespace Xamarin.Forms.Xaml
IXmlLineInfo lineInfo;
if (serviceProvider == null)
- throw new ArgumentNullException("serviceProvider");
+ throw new ArgumentNullException(nameof(serviceProvider));
var typeResolver = serviceProvider.GetService(typeof (IXamlTypeResolver)) as IXamlTypeResolver;
if (typeResolver == null)
throw new ArgumentException("No IXamlTypeResolver in IServiceProvider");
@@ -44,7 +44,7 @@ namespace Xamarin.Forms.Xaml
lineInfoProvider = serviceProvider.GetService(typeof (IXmlLineInfoProvider)) as IXmlLineInfoProvider;
lineInfo = (lineInfoProvider != null) ? lineInfoProvider.XmlLineInfo : new XmlLineInfo();
- throw new XamlParseException(String.Format("No static member found for {0}", Member), lineInfo);
+ throw new XamlParseException($"No static member found for {Member}", lineInfo);
}
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Xaml/MarkupExtensions/StaticResourceExtension.cs b/Xamarin.Forms.Xaml/MarkupExtensions/StaticResourceExtension.cs
index cf672a3d..a7f59be8 100644
--- a/Xamarin.Forms.Xaml/MarkupExtensions/StaticResourceExtension.cs
+++ b/Xamarin.Forms.Xaml/MarkupExtensions/StaticResourceExtension.cs
@@ -11,7 +11,7 @@ namespace Xamarin.Forms.Xaml
public object ProvideValue(IServiceProvider serviceProvider)
{
if (serviceProvider == null)
- throw new ArgumentNullException("serviceProvider");
+ throw new ArgumentNullException(nameof(serviceProvider));
if (Key == null)
{
var lineInfoProvider = serviceProvider.GetService(typeof (IXmlLineInfoProvider)) as IXmlLineInfoProvider;
@@ -23,6 +23,7 @@ namespace Xamarin.Forms.Xaml
throw new ArgumentException();
var xmlLineInfoProvider = serviceProvider.GetService(typeof (IXmlLineInfoProvider)) as IXmlLineInfoProvider;
var xmlLineInfo = xmlLineInfoProvider != null ? xmlLineInfoProvider.XmlLineInfo : null;
+ object resource = null;
foreach (var p in valueProvider.ParentObjects)
{
@@ -30,35 +31,27 @@ namespace Xamarin.Forms.Xaml
var resDict = ve?.Resources ?? p as ResourceDictionary;
if (resDict == null)
continue;
- object res;
- if (resDict.TryGetValue(Key, out res))
- {
- return ConvertCompiledOnPlatform(res);
- }
- }
- if (Application.Current != null && Application.Current.Resources != null &&
- Application.Current.Resources.ContainsKey(Key))
- {
- var resource = Application.Current.Resources[Key];
-
- return ConvertCompiledOnPlatform(resource);
+ if (resDict.TryGetValue(Key, out resource))
+ break;
}
+ if (resource == null && Application.Current != null && Application.Current.Resources != null &&
+ Application.Current.Resources.ContainsKey(Key))
+ resource = Application.Current.Resources [Key];
- throw new XamlParseException($"StaticResource not found for key {Key}", xmlLineInfo);
- }
+ if (resource == null)
+ throw new XamlParseException($"StaticResource not found for key {Key}", xmlLineInfo);
- static object ConvertCompiledOnPlatform(object resource)
- {
- var actualType = resource.GetType();
- if (actualType.GetTypeInfo().IsGenericType && actualType.GetGenericTypeDefinition() == typeof(OnPlatform<>))
- {
- // If we're accessing OnPlatform via a StaticResource in compiled XAML
- // we'll have to handle the cast to the target type manually
- // (Normally the compiled XAML handles this by calling `implicit` explicitly,
- // but it doesn't know to do that when it's using a static resource)
- var method = actualType.GetRuntimeMethod("op_Implicit", new[] { actualType });
- resource = method.Invoke(resource, new[] { resource });
- }
+ var bp = valueProvider.TargetProperty as BindableProperty;
+ var pi = valueProvider.TargetProperty as PropertyInfo;
+ var propertyType = bp?.ReturnType ?? pi?.PropertyType;
+ if (propertyType == null)
+ return resource;
+ if (propertyType.IsAssignableFrom(resource.GetType()))
+ return resource;
+ var implicit_op = resource.GetType().GetRuntimeMethod("op_Implicit", new [] { resource.GetType() });
+ //This will invoke the op_implicit on OnPlatform<>
+ if (implicit_op != null && propertyType.IsAssignableFrom(implicit_op.ReturnType))
+ return implicit_op.Invoke(resource, new [] { resource });
return resource;
}
diff --git a/Xamarin.Forms.Xaml/Properties/AssemblyInfo.cs b/Xamarin.Forms.Xaml/Properties/AssemblyInfo.cs
index 4ad3200e..58c48d26 100644
--- a/Xamarin.Forms.Xaml/Properties/AssemblyInfo.cs
+++ b/Xamarin.Forms.Xaml/Properties/AssemblyInfo.cs
@@ -20,9 +20,7 @@ using Xamarin.Forms.Internals;
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
-/*
[assembly: InternalsVisibleTo("Xamarin.Forms.Xaml.UnitTests")]
[assembly: InternalsVisibleTo("Xamarin.Forms.Build.Tasks")]
[assembly: InternalsVisibleTo("Xamarin.Forms.Xaml.Design")]
-*/
[assembly: Preserve] \ No newline at end of file
diff --git a/Xamarin.Forms.Xaml/TypeConversionExtensions.cs b/Xamarin.Forms.Xaml/TypeConversionExtensions.cs
index a81ed11d..7e377ea4 100644
--- a/Xamarin.Forms.Xaml/TypeConversionExtensions.cs
+++ b/Xamarin.Forms.Xaml/TypeConversionExtensions.cs
@@ -1,5 +1,5 @@
//
-// InternalExtensions.cs
+// TypeConversionExtensions.cs
//
// Author:
// Stephane Delcroix <stephane@mi8.be>
@@ -153,9 +153,18 @@ namespace Xamarin.Forms.Xaml
if (value != null)
{
var cast = value.GetType().GetRuntimeMethod("op_Implicit", new[] { value.GetType() });
- if (cast != null && cast.ReturnType == toType)
- value = cast.Invoke(null, new[] { value });
+ if (cast != null && cast.ReturnType == toType) {
+ value = cast.Invoke(null, new [] { value });
+ return value;
+ }
}
+
+ var nativeValueConverterService = DependencyService.Get<INativeValueConverterService>();
+
+ object nativeValue = null;
+ if (nativeValueConverterService != null && nativeValueConverterService.ConvertTo(value, toType, out nativeValue))
+ return nativeValue;
+
return value;
}
}
diff --git a/Xamarin.Forms.Xaml/Xamarin.Forms.Xaml.csproj b/Xamarin.Forms.Xaml/Xamarin.Forms.Xaml.csproj
index d75d5475..f521d362 100644
--- a/Xamarin.Forms.Xaml/Xamarin.Forms.Xaml.csproj
+++ b/Xamarin.Forms.Xaml/Xamarin.Forms.Xaml.csproj
@@ -3,10 +3,14 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>12.0.0</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{9DB2F292-8034-4E06-89AD-98BBDA4306B9}</ProjectGuid>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<RootNamespace>Xamarin.Forms.Xaml</RootNamespace>
<AssemblyName>Xamarin.Forms.Xaml</AssemblyName>
+ <TargetFrameworkProfile>Profile259</TargetFrameworkProfile>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
</PropertyGroup>
@@ -39,17 +43,11 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
- <WarningLevel>4</WarningLevel>
- <Optimize>false</Optimize>
</PropertyGroup>
- <Import Project="..\Xamarin.Forms.Core\SignWithXamarinKey.props" />
<ItemGroup>
<Compile Include="..\Xamarin.Forms.Core\Properties\GlobalAssemblyInfo.cs">
<Link>Properties\GlobalAssemblyInfo.cs</Link>
</Compile>
- <Compile Include="..\Xamarin.Forms.Core\Properties\ExposeInternalsToXamarin.cs">
- <Link>Properties\ExposeInternalsToXamarin.cs</Link>
- </Compile>
<Compile Include="MarkupExtensions\TemplateBindingExtension.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="MarkupExpressionParser.cs" />
@@ -85,7 +83,7 @@
<Compile Include="TypeArgumentsParser.cs" />
<Compile Include="PruneIgnoredNodesVisitor.cs" />
</ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\Xamarin.Forms.Core\Xamarin.Forms.Core.csproj">
<Project>{57B8B73D-C3B5-4C42-869E-7B2F17D354AC}</Project>
@@ -93,10 +91,4 @@
</ProjectReference>
</ItemGroup>
<ItemGroup />
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Xml" />
- <Reference Include="System.Xaml" />
- </ItemGroup>
</Project> \ No newline at end of file
diff --git a/Xamarin.Forms.Xaml/XamlNode.cs b/Xamarin.Forms.Xaml/XamlNode.cs
index f794428b..a19e7d5c 100644
--- a/Xamarin.Forms.Xaml/XamlNode.cs
+++ b/Xamarin.Forms.Xaml/XamlNode.cs
@@ -52,10 +52,9 @@ namespace Xamarin.Forms.Xaml
}
public string NamespaceUri { get; }
-
public string Name { get; }
-
public IList<XmlType> TypeArguments { get; private set; }
+
}
internal abstract class BaseNode : IXmlLineInfo, INode
diff --git a/Xamarin.Forms.Xaml/XamlParser.cs b/Xamarin.Forms.Xaml/XamlParser.cs
index 7dd79d77..60424754 100644
--- a/Xamarin.Forms.Xaml/XamlParser.cs
+++ b/Xamarin.Forms.Xaml/XamlParser.cs
@@ -38,7 +38,10 @@ namespace Xamarin.Forms.Xaml
{
public static void ParseXaml(RootNode rootNode, XmlReader reader)
{
- var attributes = ParseXamlAttributes(reader);
+ IList<KeyValuePair<string, string>> xmlns;
+ var attributes = ParseXamlAttributes(reader, out xmlns);
+ var prefixes = PrefixesToIgnore(xmlns);
+ (rootNode.IgnorablePrefixes ?? (rootNode.IgnorablePrefixes=new List<string>())).AddRange(prefixes);
rootNode.Properties.AddRange(attributes);
ParseXamlElementFor(rootNode, reader);
}
@@ -136,8 +139,10 @@ namespace Xamarin.Forms.Xaml
var elementName = reader.Name;
var elementNsUri = reader.NamespaceURI;
var elementXmlInfo = (IXmlLineInfo)reader;
+ IList<KeyValuePair<string, string>> xmlns;
- var attributes = ParseXamlAttributes(reader);
+ var attributes = ParseXamlAttributes(reader, out xmlns);
+ var prefixes = PrefixesToIgnore(xmlns);
IList<XmlType> typeArguments = null;
if (attributes.Any(kvp => kvp.Key == XmlName.xTypeArguments))
@@ -149,6 +154,7 @@ namespace Xamarin.Forms.Xaml
node = new ElementNode(new XmlType(elementNsUri, elementName, typeArguments), elementNsUri,
reader as IXmlNamespaceResolver, elementXmlInfo.LineNumber, elementXmlInfo.LinePosition);
((IElementNode)node).Properties.AddRange(attributes);
+ (node.IgnorablePrefixes ?? (node.IgnorablePrefixes = new List<string>())).AddRange(prefixes);
ParseXamlElementFor((IElementNode)node, reader);
nodes.Add(node);
@@ -170,17 +176,20 @@ namespace Xamarin.Forms.Xaml
throw new XamlParseException("Closing PropertyElement expected", (IXmlLineInfo)reader);
}
- static IList<KeyValuePair<XmlName, INode>> ParseXamlAttributes(XmlReader reader)
+ static IList<KeyValuePair<XmlName, INode>> ParseXamlAttributes(XmlReader reader, out IList<KeyValuePair<string,string>> xmlns)
{
Debug.Assert(reader.NodeType == XmlNodeType.Element);
var attributes = new List<KeyValuePair<XmlName, INode>>();
+ xmlns = new List<KeyValuePair<string, string>>();
for (var i = 0; i < reader.AttributeCount; i++)
{
reader.MoveToAttribute(i);
//skip xmlns
- if (reader.NamespaceURI == "http://www.w3.org/2000/xmlns/")
+ if (reader.NamespaceURI == "http://www.w3.org/2000/xmlns/") {
+ xmlns.Add(new KeyValuePair<string, string>(reader.LocalName, reader.Value));
continue;
+ }
var propertyName = new XmlName(reader.NamespaceURI, reader.LocalName);
@@ -239,6 +248,23 @@ namespace Xamarin.Forms.Xaml
return attributes;
}
+ static IList<string> PrefixesToIgnore(IList<KeyValuePair<string, string>> xmlns)
+ {
+ var prefixes = new List<string>();
+ foreach (var kvp in xmlns) {
+ var prefix = kvp.Key;
+
+ string typeName = null, ns = null, asm = null, targetPlatform = null;
+ XmlnsHelper.ParseXmlns(kvp.Value, out typeName, out ns, out asm, out targetPlatform);
+ if (targetPlatform == null)
+ continue;
+ TargetPlatform os;
+ if (Enum.TryParse<TargetPlatform>(targetPlatform, out os) && os != Device.OS)
+ prefixes.Add(prefix);
+ }
+ return prefixes;
+ }
+
static IValueNode GetValueNode(object value, XmlReader reader)
{
var valueString = value as string;
@@ -264,31 +290,26 @@ namespace Xamarin.Forms.Xaml
var typeArguments = xmlType.TypeArguments;
exception = null;
- List<Tuple<string, Assembly>> lookupAssemblies = new List<Tuple<string, Assembly>>();
- List<string> lookupNames = new List<string>();
+ var lookupAssemblies = new List<Tuple<string, string>>(); //namespace, assemblyqualifiednamed
+ var lookupNames = new List<string>();
if (!XmlnsHelper.IsCustom(namespaceURI))
{
- lookupAssemblies.Add(new Tuple<string, Assembly>("Xamarin.Forms", typeof (View).GetTypeInfo().Assembly));
- lookupAssemblies.Add(new Tuple<string, Assembly>("Xamarin.Forms.Xaml", typeof (XamlLoader).GetTypeInfo().Assembly));
+ lookupAssemblies.Add(new Tuple<string, string>("Xamarin.Forms", typeof (View).GetTypeInfo().Assembly.FullName));
+ lookupAssemblies.Add(new Tuple<string, string>("Xamarin.Forms.Xaml", typeof (XamlLoader).GetTypeInfo().Assembly.FullName));
}
else if (namespaceURI == "http://schemas.microsoft.com/winfx/2009/xaml" ||
namespaceURI == "http://schemas.microsoft.com/winfx/2006/xaml")
{
- lookupAssemblies.Add(new Tuple<string, Assembly>("Xamarin.Forms.Xaml", typeof (XamlLoader).GetTypeInfo().Assembly));
- lookupAssemblies.Add(new Tuple<string, Assembly>("System", typeof (object).GetTypeInfo().Assembly));
- lookupAssemblies.Add(new Tuple<string, Assembly>("System", typeof (Uri).GetTypeInfo().Assembly)); //System.dll
+ lookupAssemblies.Add(new Tuple<string, string>("Xamarin.Forms.Xaml", typeof (XamlLoader).GetTypeInfo().Assembly.FullName));
+ lookupAssemblies.Add(new Tuple<string, string>("System", typeof (object).GetTypeInfo().Assembly.FullName)); //mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ lookupAssemblies.Add(new Tuple<string, string>("System", typeof (Uri).GetTypeInfo().Assembly.FullName)); //System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
}
else
{
- string ns;
- string typename;
- string asmstring;
- Assembly asm;
-
- XmlnsHelper.ParseXmlns(namespaceURI, out typename, out ns, out asmstring);
- asm = asmstring == null ? currentAssembly : Assembly.Load(new AssemblyName(asmstring));
- lookupAssemblies.Add(new Tuple<string, Assembly>(ns, asm));
+ string ns, asmstring, _;
+ XmlnsHelper.ParseXmlns(namespaceURI, out _, out ns, out asmstring, out _);
+ lookupAssemblies.Add(new Tuple<string, string>(ns, asmstring ?? currentAssembly.FullName));
}
lookupNames.Add(elementName);
@@ -305,16 +326,12 @@ namespace Xamarin.Forms.Xaml
}
Type type = null;
- foreach (var asm in lookupAssemblies)
- {
- if (type != null)
- break;
+ foreach (var asm in lookupAssemblies) {
foreach (var name in lookupNames)
- {
- if (type != null)
+ if ((type = Type.GetType($"{asm.Item1}.{name}, {asm.Item2}")) != null)
break;
- type = asm.Item2.GetType(asm.Item1 + "." + name);
- }
+ if (type != null)
+ break;
}
if (type != null && typeArguments != null)
@@ -340,11 +357,7 @@ namespace Xamarin.Forms.Xaml
}
if (type == null)
- {
- exception = new XamlParseException(string.Format("Type {0} not found in xmlns {1}", elementName, namespaceURI),
- xmlInfo);
- return null;
- }
+ exception = new XamlParseException($"Type {elementName} not found in xmlns {namespaceURI}", xmlInfo);
return type;
}
diff --git a/Xamarin.Forms.Xaml/XamlServiceProvider.cs b/Xamarin.Forms.Xaml/XamlServiceProvider.cs
index 77ed6345..5599cbbc 100644
--- a/Xamarin.Forms.Xaml/XamlServiceProvider.cs
+++ b/Xamarin.Forms.Xaml/XamlServiceProvider.cs
@@ -89,7 +89,7 @@ namespace Xamarin.Forms.Xaml.Internals
}
}
- internal class XamlValueTargetProvider : IProvideParentValues, IProvideValueTarget
+ class XamlValueTargetProvider : IProvideParentValues, IProvideValueTarget
{
public XamlValueTargetProvider(object targetObject, INode node, HydratationContext context, object targetProperty)
{
@@ -102,14 +102,8 @@ namespace Xamarin.Forms.Xaml.Internals
INode Node { get; }
HydratationContext Context { get; }
-
public object TargetObject { get; }
-
- public object TargetProperty
- {
- get { throw new NotImplementedException(); }
- private set { }
- }
+ public object TargetProperty { get; } = null;
IEnumerable<object> IProvideParentValues.ParentObjects
{
@@ -141,15 +135,17 @@ namespace Xamarin.Forms.Xaml.Internals
public class SimpleValueTargetProvider : IProvideParentValues, IProvideValueTarget
{
readonly object[] objectAndParents;
+ readonly object targetProperty;
- public SimpleValueTargetProvider(object[] objectAndParents)
+ public SimpleValueTargetProvider(object[] objectAndParents, object targetProperty)
{
if (objectAndParents == null)
- throw new ArgumentNullException("objectAndParents");
+ throw new ArgumentNullException(nameof(objectAndParents));
if (objectAndParents.Length == 0)
throw new ArgumentException();
this.objectAndParents = objectAndParents;
+ this.targetProperty = targetProperty;
}
IEnumerable<object> IProvideParentValues.ParentObjects
@@ -164,7 +160,7 @@ namespace Xamarin.Forms.Xaml.Internals
object IProvideValueTarget.TargetProperty
{
- get { throw new NotImplementedException(); }
+ get { return targetProperty; }
}
}
@@ -249,7 +245,7 @@ namespace Xamarin.Forms.Xaml.Internals
XmlType xmlType, IXmlLineInfo xmlInfo, Assembly currentAssembly, out XamlParseException exception);
}
- internal class XamlRootObjectProvider : IRootObjectProvider
+ class XamlRootObjectProvider : IRootObjectProvider
{
public XamlRootObjectProvider(object rootObject)
{
@@ -269,7 +265,7 @@ namespace Xamarin.Forms.Xaml.Internals
public IXmlLineInfo XmlLineInfo { get; }
}
- internal interface INameScopeProvider
+ interface INameScopeProvider
{
INameScope NameScope { get; }
}
diff --git a/Xamarin.Forms.Xaml/XmlnsHelper.cs b/Xamarin.Forms.Xaml/XmlnsHelper.cs
index 778d2947..e3e37de4 100644
--- a/Xamarin.Forms.Xaml/XmlnsHelper.cs
+++ b/Xamarin.Forms.Xaml/XmlnsHelper.cs
@@ -20,15 +20,16 @@ namespace Xamarin.Forms.Xaml
string typeName;
string ns;
string asm;
+ string targetPlatform;
- ParseXmlns(xmlns, out typeName, out ns, out asm);
+ ParseXmlns(xmlns, out typeName, out ns, out asm, out targetPlatform);
return ns;
}
- public static void ParseXmlns(string xmlns, out string typeName, out string ns, out string asm)
+ public static void ParseXmlns(string xmlns, out string typeName, out string ns, out string asm, out string targetPlatform)
{
- typeName = ns = asm = null;
+ typeName = ns = asm = targetPlatform = null;
foreach (var decl in xmlns.Split(';'))
{
@@ -42,6 +43,10 @@ namespace Xamarin.Forms.Xaml
asm = decl.Substring(9, decl.Length - 9);
continue;
}
+ if (decl.StartsWith("targetPlatform=", StringComparison.Ordinal)) {
+ targetPlatform = decl.Substring(15, decl.Length - 15);
+ continue;
+ }
var nsind = decl.LastIndexOf(".", StringComparison.Ordinal);
if (nsind > 0)
{
diff --git a/Xamarin.Forms.sln b/Xamarin.Forms.sln
index 168583a8..0f848551 100644
--- a/Xamarin.Forms.sln
+++ b/Xamarin.Forms.sln
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
-VisualStudioVersion = 14.0.25123.0
+VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Xamarin.Forms", "Xamarin.Forms", "{9AD757F5-E57A-459D-A0A7-E0675E045B84}"
EndProject
@@ -13,19 +13,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Control Gallery", "Control
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Xamarin.Forms.Xaml", "Xamarin.Forms.Xaml", "{32F608E2-6406-4DCF-9105-E2A7CB7085CF}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Forms.Platform.iOS.Classic", "Xamarin.Forms.Platform.iOS\Xamarin.Forms.Platform.iOS.Classic.csproj", "{4A47B5DF-DDFC-476B-AC41-5105FF3B9B8B}"
- ProjectSection(ProjectDependencies) = postProject
- {C7131F14-274F-4B55-ACA9-E81731AD012F} = {C7131F14-274F-4B55-ACA9-E81731AD012F}
- EndProjectSection
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Forms.Platform.iOS", "Xamarin.Forms.Platform.iOS\Xamarin.Forms.Platform.iOS.csproj", "{271193C1-6E7C-429C-A36D-3F1BE5267231}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Forms.Platform.Android", "Xamarin.Forms.Platform.Android\Xamarin.Forms.Platform.Android.csproj", "{0E16E70A-D6DD-4323-AD5D-363ABFF42D6A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Forms.Core.UnitTests", "Xamarin.Forms.Core.UnitTests\Xamarin.Forms.Core.UnitTests.csproj", "{00259593-A283-47A5-ACB7-9C3819B16364}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Forms.ControlGallery.iOS.Classic", "Xamarin.Forms.ControlGallery.iOS\Xamarin.Forms.ControlGallery.iOS.Classic.csproj", "{DEEC5844-D609-4F35-BCF0-5B71C91C8133}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Forms.ControlGallery.Android", "Xamarin.Forms.ControlGallery.Android\Xamarin.Forms.ControlGallery.Android.csproj", "{1346A7F1-4457-4BB4-A371-2C8E28BBD53E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Forms.Xaml.Xamlg", "Xamarin.Forms.Xaml.Xamlg\Xamarin.Forms.Xaml.Xamlg.csproj", "{D597E3C6-1A50-4042-99FA-3E7CE28E4819}"
@@ -90,8 +83,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Forms.Core.Android.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Forms.CustomAttributes", "Xamarin.Forms.CustomAttributes\Xamarin.Forms.CustomAttributes.csproj", "{4DCD0420-1168-4B77-86DB-6196EE4BD491}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Forms.Maps.iOS.Classic", "Xamarin.Forms.Maps.iOS\Xamarin.Forms.Maps.iOS.Classic.csproj", "{CA10FACD-22AB-463F-A20E-379C212B0858}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Forms.ControlGallery.iOS", "Xamarin.Forms.ControlGallery.iOS\Xamarin.Forms.ControlGallery.iOS.csproj", "{C7131F14-274F-4B55-ACA9-E81731AD012F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Forms.Platform", "Xamarin.Forms.Platform\Xamarin.Forms.Platform.csproj", "{67F9D3A8-F71E-4428-913F-C37AE82CDB24}"
@@ -100,8 +91,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Forwarders", "Forwarders",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Forms.Platform.Android (Forwarders)", "Stubs\Xamarin.Forms.Platform.Android\Xamarin.Forms.Platform.Android (Forwarders).csproj", "{6E53FEB1-1100-46AE-8013-17BBA35CC197}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Forms.Platform.iOS.Classic (Forwarders)", "Stubs\Xamarin.Forms.Platform.iOS.Classic\Xamarin.Forms.Platform.iOS.Classic (Forwarders).csproj", "{3E443AEF-3EC0-48C4-A524-7C6996339E1B}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Forms.Platform.iOS (Forwarders)", "Stubs\Xamarin.Forms.Platform.iOS\Xamarin.Forms.Platform.iOS (Forwarders).csproj", "{39B3457F-01D8-43D0-8E84-D8C4F73CF48D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Forms.Platform.WP8 (Forwarders)", "Stubs\Xamarin.Forms.Platform.WP8\Xamarin.Forms.Platform.WP8 (Forwarders).csproj", "{483CDAE7-4353-4AB2-9C20-145A9F148FAD}"
@@ -148,21 +137,21 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PagesGallery", "PagesGaller
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PagesGallery.Droid", "PagesGallery\PagesGallery.Droid\PagesGallery.Droid.csproj", "{5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PagesGallery.iOS", "PagesGallery\PagesGallery.iOS\PagesGallery.iOS.csproj", "{392156B2-760A-4EE3-A822-CABD3238A21D}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PagesGallery.UWP", "PagesGallery\PagesGallery.UWP\PagesGallery.UWP.csproj", "{95FEB8D4-D57E-4B96-A8D8-59D241C0501B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Forms.Platform.Android.AppLinks", "Xamarin.Forms.Platform.Android.AppLinks\Xamarin.Forms.Platform.Android.AppLinks.csproj", "{42DB052E-0909-45D2-8240-187F99F393FB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Forms.Pages.Azure", "Xamarin.Forms.Pages.Azure\Xamarin.Forms.Pages.Azure.csproj", "{C9696465-7657-4843-872E-3C01891C4A9B}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PagesGallery.iOS", "PagesGallery\PagesGallery.iOS\PagesGallery.iOS.csproj", "{392156B2-760A-4EE3-A822-CABD3238A21D}"
+EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
- docs\APIDocs.projitems*{dc1f3933-ac99-4887-8b09-e13c2b346d4f}*SharedItemsImports = 13
- Xamarin.Forms.Controls.Issues\Xamarin.Forms.Controls.Issues.Shared\Xamarin.Forms.Controls.Issues.Shared.projitems*{a34ebe01-25bf-4e69-a2dc-2288dc625541}*SharedItemsImports = 4
Xamarin.Forms.Controls.Issues\Xamarin.Forms.Controls.Issues.Shared\Xamarin.Forms.Controls.Issues.Shared.projitems*{0a39a74b-6f7a-4d41-84f2-b0ccdce899df}*SharedItemsImports = 4
Xamarin.Forms.Controls.Issues\Xamarin.Forms.Controls.Issues.Shared\Xamarin.Forms.Controls.Issues.Shared.projitems*{0f0db9cc-ea65-429c-9363-38624bf8f49c}*SharedItemsImports = 13
+ Xamarin.Forms.Controls.Issues\Xamarin.Forms.Controls.Issues.Shared\Xamarin.Forms.Controls.Issues.Shared.projitems*{a34ebe01-25bf-4e69-a2dc-2288dc625541}*SharedItemsImports = 4
Xamarin.Forms.Controls.Issues\Xamarin.Forms.Controls.Issues.Shared\Xamarin.Forms.Controls.Issues.Shared.projitems*{cb9c96ce-125c-4a68-b6a1-c3ff1fbf93e1}*SharedItemsImports = 4
+ docs\APIDocs.projitems*{dc1f3933-ac99-4887-8b09-e13c2b346d4f}*SharedItemsImports = 13
Xamarin.Forms.Controls.Issues\Xamarin.Forms.Controls.Issues.Shared\Xamarin.Forms.Controls.Issues.Shared.projitems*{eadd8100-b3ae-4a31-92c4-267a64a1c6eb}*SharedItemsImports = 4
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -182,32 +171,6 @@ Global
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {4A47B5DF-DDFC-476B-AC41-5105FF3B9B8B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {4A47B5DF-DDFC-476B-AC41-5105FF3B9B8B}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {4A47B5DF-DDFC-476B-AC41-5105FF3B9B8B}.Debug|ARM.ActiveCfg = Debug|Any CPU
- {4A47B5DF-DDFC-476B-AC41-5105FF3B9B8B}.Debug|ARM.Build.0 = Debug|Any CPU
- {4A47B5DF-DDFC-476B-AC41-5105FF3B9B8B}.Debug|iPhone.ActiveCfg = Debug|Any CPU
- {4A47B5DF-DDFC-476B-AC41-5105FF3B9B8B}.Debug|iPhone.Build.0 = Debug|Any CPU
- {4A47B5DF-DDFC-476B-AC41-5105FF3B9B8B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
- {4A47B5DF-DDFC-476B-AC41-5105FF3B9B8B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
- {4A47B5DF-DDFC-476B-AC41-5105FF3B9B8B}.Debug|Templates.ActiveCfg = Debug|Any CPU
- {4A47B5DF-DDFC-476B-AC41-5105FF3B9B8B}.Debug|x64.ActiveCfg = Debug|Any CPU
- {4A47B5DF-DDFC-476B-AC41-5105FF3B9B8B}.Debug|x64.Build.0 = Debug|Any CPU
- {4A47B5DF-DDFC-476B-AC41-5105FF3B9B8B}.Debug|x86.ActiveCfg = Debug|Any CPU
- {4A47B5DF-DDFC-476B-AC41-5105FF3B9B8B}.Debug|x86.Build.0 = Debug|Any CPU
- {4A47B5DF-DDFC-476B-AC41-5105FF3B9B8B}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {4A47B5DF-DDFC-476B-AC41-5105FF3B9B8B}.Release|Any CPU.Build.0 = Release|Any CPU
- {4A47B5DF-DDFC-476B-AC41-5105FF3B9B8B}.Release|ARM.ActiveCfg = Release|Any CPU
- {4A47B5DF-DDFC-476B-AC41-5105FF3B9B8B}.Release|ARM.Build.0 = Release|Any CPU
- {4A47B5DF-DDFC-476B-AC41-5105FF3B9B8B}.Release|iPhone.ActiveCfg = Release|Any CPU
- {4A47B5DF-DDFC-476B-AC41-5105FF3B9B8B}.Release|iPhone.Build.0 = Release|Any CPU
- {4A47B5DF-DDFC-476B-AC41-5105FF3B9B8B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
- {4A47B5DF-DDFC-476B-AC41-5105FF3B9B8B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
- {4A47B5DF-DDFC-476B-AC41-5105FF3B9B8B}.Release|Templates.ActiveCfg = Release|Any CPU
- {4A47B5DF-DDFC-476B-AC41-5105FF3B9B8B}.Release|x64.ActiveCfg = Release|Any CPU
- {4A47B5DF-DDFC-476B-AC41-5105FF3B9B8B}.Release|x64.Build.0 = Release|Any CPU
- {4A47B5DF-DDFC-476B-AC41-5105FF3B9B8B}.Release|x86.ActiveCfg = Release|Any CPU
- {4A47B5DF-DDFC-476B-AC41-5105FF3B9B8B}.Release|x86.Build.0 = Release|Any CPU
{271193C1-6E7C-429C-A36D-3F1BE5267231}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{271193C1-6E7C-429C-A36D-3F1BE5267231}.Debug|Any CPU.Build.0 = Debug|Any CPU
{271193C1-6E7C-429C-A36D-3F1BE5267231}.Debug|ARM.ActiveCfg = Debug|Any CPU
@@ -286,30 +249,6 @@ Global
{00259593-A283-47A5-ACB7-9C3819B16364}.Release|x64.Build.0 = Release|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Release|x86.ActiveCfg = Release|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Release|x86.Build.0 = Release|Any CPU
- {DEEC5844-D609-4F35-BCF0-5B71C91C8133}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
- {DEEC5844-D609-4F35-BCF0-5B71C91C8133}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
- {DEEC5844-D609-4F35-BCF0-5B71C91C8133}.Debug|Any CPU.Deploy.0 = Debug|iPhoneSimulator
- {DEEC5844-D609-4F35-BCF0-5B71C91C8133}.Debug|ARM.ActiveCfg = Debug|iPhone
- {DEEC5844-D609-4F35-BCF0-5B71C91C8133}.Debug|iPhone.ActiveCfg = Debug|iPhone
- {DEEC5844-D609-4F35-BCF0-5B71C91C8133}.Debug|iPhone.Build.0 = Debug|iPhone
- {DEEC5844-D609-4F35-BCF0-5B71C91C8133}.Debug|iPhone.Deploy.0 = Debug|iPhone
- {DEEC5844-D609-4F35-BCF0-5B71C91C8133}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
- {DEEC5844-D609-4F35-BCF0-5B71C91C8133}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
- {DEEC5844-D609-4F35-BCF0-5B71C91C8133}.Debug|Templates.ActiveCfg = Debug|iPhoneSimulator
- {DEEC5844-D609-4F35-BCF0-5B71C91C8133}.Debug|x64.ActiveCfg = Debug|iPhone
- {DEEC5844-D609-4F35-BCF0-5B71C91C8133}.Debug|x86.ActiveCfg = Debug|iPhone
- {DEEC5844-D609-4F35-BCF0-5B71C91C8133}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator
- {DEEC5844-D609-4F35-BCF0-5B71C91C8133}.Release|Any CPU.Build.0 = Release|iPhoneSimulator
- {DEEC5844-D609-4F35-BCF0-5B71C91C8133}.Release|Any CPU.Deploy.0 = Release|iPhoneSimulator
- {DEEC5844-D609-4F35-BCF0-5B71C91C8133}.Release|ARM.ActiveCfg = Release|iPhone
- {DEEC5844-D609-4F35-BCF0-5B71C91C8133}.Release|iPhone.ActiveCfg = Release|iPhone
- {DEEC5844-D609-4F35-BCF0-5B71C91C8133}.Release|iPhone.Build.0 = Release|iPhone
- {DEEC5844-D609-4F35-BCF0-5B71C91C8133}.Release|iPhone.Deploy.0 = Release|iPhone
- {DEEC5844-D609-4F35-BCF0-5B71C91C8133}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
- {DEEC5844-D609-4F35-BCF0-5B71C91C8133}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
- {DEEC5844-D609-4F35-BCF0-5B71C91C8133}.Release|Templates.ActiveCfg = Release|iPhoneSimulator
- {DEEC5844-D609-4F35-BCF0-5B71C91C8133}.Release|x64.ActiveCfg = Release|iPhone
- {DEEC5844-D609-4F35-BCF0-5B71C91C8133}.Release|x86.ActiveCfg = Release|iPhone
{1346A7F1-4457-4BB4-A371-2C8E28BBD53E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1346A7F1-4457-4BB4-A371-2C8E28BBD53E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1346A7F1-4457-4BB4-A371-2C8E28BBD53E}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
@@ -830,32 +769,6 @@ Global
{4DCD0420-1168-4B77-86DB-6196EE4BD491}.Release|x64.Build.0 = Release|Any CPU
{4DCD0420-1168-4B77-86DB-6196EE4BD491}.Release|x86.ActiveCfg = Release|Any CPU
{4DCD0420-1168-4B77-86DB-6196EE4BD491}.Release|x86.Build.0 = Release|Any CPU
- {CA10FACD-22AB-463F-A20E-379C212B0858}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {CA10FACD-22AB-463F-A20E-379C212B0858}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {CA10FACD-22AB-463F-A20E-379C212B0858}.Debug|ARM.ActiveCfg = Debug|Any CPU
- {CA10FACD-22AB-463F-A20E-379C212B0858}.Debug|ARM.Build.0 = Debug|Any CPU
- {CA10FACD-22AB-463F-A20E-379C212B0858}.Debug|iPhone.ActiveCfg = Debug|Any CPU
- {CA10FACD-22AB-463F-A20E-379C212B0858}.Debug|iPhone.Build.0 = Debug|Any CPU
- {CA10FACD-22AB-463F-A20E-379C212B0858}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
- {CA10FACD-22AB-463F-A20E-379C212B0858}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
- {CA10FACD-22AB-463F-A20E-379C212B0858}.Debug|Templates.ActiveCfg = Debug|Any CPU
- {CA10FACD-22AB-463F-A20E-379C212B0858}.Debug|x64.ActiveCfg = Debug|Any CPU
- {CA10FACD-22AB-463F-A20E-379C212B0858}.Debug|x64.Build.0 = Debug|Any CPU
- {CA10FACD-22AB-463F-A20E-379C212B0858}.Debug|x86.ActiveCfg = Debug|Any CPU
- {CA10FACD-22AB-463F-A20E-379C212B0858}.Debug|x86.Build.0 = Debug|Any CPU
- {CA10FACD-22AB-463F-A20E-379C212B0858}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {CA10FACD-22AB-463F-A20E-379C212B0858}.Release|Any CPU.Build.0 = Release|Any CPU
- {CA10FACD-22AB-463F-A20E-379C212B0858}.Release|ARM.ActiveCfg = Release|Any CPU
- {CA10FACD-22AB-463F-A20E-379C212B0858}.Release|ARM.Build.0 = Release|Any CPU
- {CA10FACD-22AB-463F-A20E-379C212B0858}.Release|iPhone.ActiveCfg = Release|Any CPU
- {CA10FACD-22AB-463F-A20E-379C212B0858}.Release|iPhone.Build.0 = Release|Any CPU
- {CA10FACD-22AB-463F-A20E-379C212B0858}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
- {CA10FACD-22AB-463F-A20E-379C212B0858}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
- {CA10FACD-22AB-463F-A20E-379C212B0858}.Release|Templates.ActiveCfg = Release|Any CPU
- {CA10FACD-22AB-463F-A20E-379C212B0858}.Release|x64.ActiveCfg = Release|Any CPU
- {CA10FACD-22AB-463F-A20E-379C212B0858}.Release|x64.Build.0 = Release|Any CPU
- {CA10FACD-22AB-463F-A20E-379C212B0858}.Release|x86.ActiveCfg = Release|Any CPU
- {CA10FACD-22AB-463F-A20E-379C212B0858}.Release|x86.Build.0 = Release|Any CPU
{C7131F14-274F-4B55-ACA9-E81731AD012F}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
{C7131F14-274F-4B55-ACA9-E81731AD012F}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
{C7131F14-274F-4B55-ACA9-E81731AD012F}.Debug|ARM.ActiveCfg = Debug|iPhone
@@ -928,32 +841,6 @@ Global
{6E53FEB1-1100-46AE-8013-17BBA35CC197}.Release|x64.Build.0 = Release|Any CPU
{6E53FEB1-1100-46AE-8013-17BBA35CC197}.Release|x86.ActiveCfg = Release|Any CPU
{6E53FEB1-1100-46AE-8013-17BBA35CC197}.Release|x86.Build.0 = Release|Any CPU
- {3E443AEF-3EC0-48C4-A524-7C6996339E1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {3E443AEF-3EC0-48C4-A524-7C6996339E1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {3E443AEF-3EC0-48C4-A524-7C6996339E1B}.Debug|ARM.ActiveCfg = Debug|Any CPU
- {3E443AEF-3EC0-48C4-A524-7C6996339E1B}.Debug|ARM.Build.0 = Debug|Any CPU
- {3E443AEF-3EC0-48C4-A524-7C6996339E1B}.Debug|iPhone.ActiveCfg = Debug|Any CPU
- {3E443AEF-3EC0-48C4-A524-7C6996339E1B}.Debug|iPhone.Build.0 = Debug|Any CPU
- {3E443AEF-3EC0-48C4-A524-7C6996339E1B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
- {3E443AEF-3EC0-48C4-A524-7C6996339E1B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
- {3E443AEF-3EC0-48C4-A524-7C6996339E1B}.Debug|Templates.ActiveCfg = Debug|Any CPU
- {3E443AEF-3EC0-48C4-A524-7C6996339E1B}.Debug|x64.ActiveCfg = Debug|Any CPU
- {3E443AEF-3EC0-48C4-A524-7C6996339E1B}.Debug|x64.Build.0 = Debug|Any CPU
- {3E443AEF-3EC0-48C4-A524-7C6996339E1B}.Debug|x86.ActiveCfg = Debug|Any CPU
- {3E443AEF-3EC0-48C4-A524-7C6996339E1B}.Debug|x86.Build.0 = Debug|Any CPU
- {3E443AEF-3EC0-48C4-A524-7C6996339E1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {3E443AEF-3EC0-48C4-A524-7C6996339E1B}.Release|Any CPU.Build.0 = Release|Any CPU
- {3E443AEF-3EC0-48C4-A524-7C6996339E1B}.Release|ARM.ActiveCfg = Release|Any CPU
- {3E443AEF-3EC0-48C4-A524-7C6996339E1B}.Release|ARM.Build.0 = Release|Any CPU
- {3E443AEF-3EC0-48C4-A524-7C6996339E1B}.Release|iPhone.ActiveCfg = Release|Any CPU
- {3E443AEF-3EC0-48C4-A524-7C6996339E1B}.Release|iPhone.Build.0 = Release|Any CPU
- {3E443AEF-3EC0-48C4-A524-7C6996339E1B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
- {3E443AEF-3EC0-48C4-A524-7C6996339E1B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
- {3E443AEF-3EC0-48C4-A524-7C6996339E1B}.Release|Templates.ActiveCfg = Release|Any CPU
- {3E443AEF-3EC0-48C4-A524-7C6996339E1B}.Release|x64.ActiveCfg = Release|Any CPU
- {3E443AEF-3EC0-48C4-A524-7C6996339E1B}.Release|x64.Build.0 = Release|Any CPU
- {3E443AEF-3EC0-48C4-A524-7C6996339E1B}.Release|x86.ActiveCfg = Release|Any CPU
- {3E443AEF-3EC0-48C4-A524-7C6996339E1B}.Release|x86.Build.0 = Release|Any CPU
{39B3457F-01D8-43D0-8E84-D8C4F73CF48D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{39B3457F-01D8-43D0-8E84-D8C4F73CF48D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{39B3457F-01D8-43D0-8E84-D8C4F73CF48D}.Debug|ARM.ActiveCfg = Debug|Any CPU
@@ -1534,25 +1421,6 @@ Global
{5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Release|x86.ActiveCfg = Release|Any CPU
{5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Release|x86.Build.0 = Release|Any CPU
{5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Release|x86.Deploy.0 = Release|Any CPU
- {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
- {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
- {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|ARM.ActiveCfg = Debug|iPhone
- {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|iPhone.ActiveCfg = Debug|iPhone
- {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|iPhone.Build.0 = Debug|iPhone
- {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
- {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
- {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|Templates.ActiveCfg = Debug|iPhone
- {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|x64.ActiveCfg = Debug|iPhone
- {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|x86.ActiveCfg = Debug|iPhone
- {392156B2-760A-4EE3-A822-CABD3238A21D}.Release|Any CPU.ActiveCfg = Release|iPhone
- {392156B2-760A-4EE3-A822-CABD3238A21D}.Release|ARM.ActiveCfg = Release|iPhone
- {392156B2-760A-4EE3-A822-CABD3238A21D}.Release|iPhone.ActiveCfg = Release|iPhone
- {392156B2-760A-4EE3-A822-CABD3238A21D}.Release|iPhone.Build.0 = Release|iPhone
- {392156B2-760A-4EE3-A822-CABD3238A21D}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
- {392156B2-760A-4EE3-A822-CABD3238A21D}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
- {392156B2-760A-4EE3-A822-CABD3238A21D}.Release|Templates.ActiveCfg = Release|iPhone
- {392156B2-760A-4EE3-A822-CABD3238A21D}.Release|x64.ActiveCfg = Release|iPhone
- {392156B2-760A-4EE3-A822-CABD3238A21D}.Release|x86.ActiveCfg = Release|iPhone
{95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Debug|Any CPU.ActiveCfg = Debug|x86
{95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Debug|Any CPU.Build.0 = Debug|x86
{95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Debug|Any CPU.Deploy.0 = Debug|x86
@@ -1637,16 +1505,33 @@ Global
{C9696465-7657-4843-872E-3C01891C4A9B}.Release|x64.Build.0 = Release|Any CPU
{C9696465-7657-4843-872E-3C01891C4A9B}.Release|x86.ActiveCfg = Release|Any CPU
{C9696465-7657-4843-872E-3C01891C4A9B}.Release|x86.Build.0 = Release|Any CPU
+ {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
+ {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
+ {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|ARM.ActiveCfg = Debug|iPhone
+ {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|iPhone.ActiveCfg = Debug|iPhone
+ {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|iPhone.Build.0 = Debug|iPhone
+ {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
+ {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
+ {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|Templates.ActiveCfg = Debug|iPhone
+ {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|x64.ActiveCfg = Debug|iPhone
+ {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|x86.ActiveCfg = Debug|iPhone
+ {392156B2-760A-4EE3-A822-CABD3238A21D}.Release|Any CPU.ActiveCfg = Release|iPhone
+ {392156B2-760A-4EE3-A822-CABD3238A21D}.Release|ARM.ActiveCfg = Release|iPhone
+ {392156B2-760A-4EE3-A822-CABD3238A21D}.Release|iPhone.ActiveCfg = Release|iPhone
+ {392156B2-760A-4EE3-A822-CABD3238A21D}.Release|iPhone.Build.0 = Release|iPhone
+ {392156B2-760A-4EE3-A822-CABD3238A21D}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
+ {392156B2-760A-4EE3-A822-CABD3238A21D}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
+ {392156B2-760A-4EE3-A822-CABD3238A21D}.Release|Templates.ActiveCfg = Release|iPhone
+ {392156B2-760A-4EE3-A822-CABD3238A21D}.Release|x64.ActiveCfg = Release|iPhone
+ {392156B2-760A-4EE3-A822-CABD3238A21D}.Release|x86.ActiveCfg = Release|iPhone
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
- {4A47B5DF-DDFC-476B-AC41-5105FF3B9B8B} = {29AC50BF-B4FB-450B-9386-0C5AD4B84226}
{271193C1-6E7C-429C-A36D-3F1BE5267231} = {29AC50BF-B4FB-450B-9386-0C5AD4B84226}
{0E16E70A-D6DD-4323-AD5D-363ABFF42D6A} = {29AC50BF-B4FB-450B-9386-0C5AD4B84226}
{00259593-A283-47A5-ACB7-9C3819B16364} = {33A20844-7EF4-441D-83DA-2ACAF5E1CDFA}
- {DEEC5844-D609-4F35-BCF0-5B71C91C8133} = {4F5E2D21-17F6-4A42-B8FB-D03D82E24EC8}
{1346A7F1-4457-4BB4-A371-2C8E28BBD53E} = {4F5E2D21-17F6-4A42-B8FB-D03D82E24EC8}
{D597E3C6-1A50-4042-99FA-3E7CE28E4819} = {32F608E2-6406-4DCF-9105-E2A7CB7085CF}
{4B14D295-C09B-4C38-B880-7CC768E50585} = {32F608E2-6406-4DCF-9105-E2A7CB7085CF}
@@ -1667,12 +1552,10 @@ Global
{EADD8100-B3AE-4A31-92C4-267A64A1C6EB} = {D4D57221-71D6-4031-A6F4-EC66AF0929D9}
{A34EBE01-25BF-4E69-A2DC-2288DC625541} = {D4D57221-71D6-4031-A6F4-EC66AF0929D9}
{4DCD0420-1168-4B77-86DB-6196EE4BD491} = {D4D57221-71D6-4031-A6F4-EC66AF0929D9}
- {CA10FACD-22AB-463F-A20E-379C212B0858} = {132FB9A4-613F-44CE-95D5-758D32D231DD}
{C7131F14-274F-4B55-ACA9-E81731AD012F} = {4F5E2D21-17F6-4A42-B8FB-D03D82E24EC8}
{67F9D3A8-F71E-4428-913F-C37AE82CDB24} = {29AC50BF-B4FB-450B-9386-0C5AD4B84226}
{5A2DADBC-9510-4DD1-BE58-01501F2DF65D} = {29AC50BF-B4FB-450B-9386-0C5AD4B84226}
{6E53FEB1-1100-46AE-8013-17BBA35CC197} = {5A2DADBC-9510-4DD1-BE58-01501F2DF65D}
- {3E443AEF-3EC0-48C4-A524-7C6996339E1B} = {5A2DADBC-9510-4DD1-BE58-01501F2DF65D}
{39B3457F-01D8-43D0-8E84-D8C4F73CF48D} = {5A2DADBC-9510-4DD1-BE58-01501F2DF65D}
{483CDAE7-4353-4AB2-9C20-145A9F148FAD} = {5A2DADBC-9510-4DD1-BE58-01501F2DF65D}
{F3FDD7AC-8899-4E41-BFD7-EC83403E736D} = {29AC50BF-B4FB-450B-9386-0C5AD4B84226}
@@ -1695,9 +1578,9 @@ Global
{447DC60E-C485-4427-8CF7-50074C6B61DE} = {33A20844-7EF4-441D-83DA-2ACAF5E1CDFA}
{7B5F9E6A-6334-4C74-9B77-A55B3DA60E41} = {80BAC3FB-357A-4D05-A050-9F234DF49C97}
{5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2} = {80BAC3FB-357A-4D05-A050-9F234DF49C97}
- {392156B2-760A-4EE3-A822-CABD3238A21D} = {80BAC3FB-357A-4D05-A050-9F234DF49C97}
{95FEB8D4-D57E-4B96-A8D8-59D241C0501B} = {80BAC3FB-357A-4D05-A050-9F234DF49C97}
{42DB052E-0909-45D2-8240-187F99F393FB} = {29AC50BF-B4FB-450B-9386-0C5AD4B84226}
{C9696465-7657-4843-872E-3C01891C4A9B} = {9AD757F5-E57A-459D-A0A7-E0675E045B84}
+ {392156B2-760A-4EE3-A822-CABD3238A21D} = {80BAC3FB-357A-4D05-A050-9F234DF49C97}
EndGlobalSection
EndGlobal
diff --git a/build b/build
deleted file mode 100755
index 5bf64705..00000000
--- a/build
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/bash
-
-if [ "$1" = "--rebuild" -o "$1" = "rebuild" -o "$1" = "--clean" -o "$1" = "clean" ] ; then
- [ -f xamarin.sln -a -f build ] || exit 6
- find -name bin -o -name obj | xargs rm -vrf
- if [ "$1" = "--clean" -o "$1" == "clean" ] ; then
- exit 0
- fi
-fi
-
-BAD=no
-for N in tizen application uifw; do
- if [ ! -d "../$N" ] ; then
- echo "ERROR: missing ../$N Please clone ssh://\$USER@165.213.149.170:29418/platform/core/csapi/$N"
- BAD=yes
- fi
-done
-if [ -f ../uifw/Xamarin.sln ] ; then
- echo "ERROR: Please checkout a recent version of devel branch in ../uifw"
- BAD=yes
-fi
-if [ "$BAD" = "yes" ] ; then
- exit 7
-fi
-
-#OPTS="/verbosity:minimal"
-OPTS="/verbosity:normal"
-
-set -e
-xbuild $OPTS Xamarin.Forms.Platform.Tizen/Xamarin.Forms.Platform.Tizen.csproj
-set +e
-
-for PROJ in `find samples -name '*.csproj'`; do
- if grep -q 'Xamarin.Forms.Platform.Tizen' $PROJ && ! grep -q 'Tizen.Application' $PROJ ; then
- echo "> Skipping $PROJ"
- continue
- fi
- xbuild $OPTS "$PROJ"
-done
-
-echo
-echo " - - - - - - - - - - -"
-echo " Libs can be found in the directory:"
-echo -e " \e[33mXamarin.Forms.Platform.Tizen/bin/Debug\e[0m"
-echo
-echo " Executables:"
-find samples -name '*.exe' -path '*/bin/*'
-echo
diff --git a/build-for-target.sh b/build-for-target.sh
deleted file mode 100644
index a23fc290..00000000
--- a/build-for-target.sh
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/bin/bash
-# author: Piotr Szydelko <p.szydelko@samsung.com>
-
-find_gbs_dir()
-{
- if [ -s GBS_DIR_RPMS ] ; then
- GBS_DIR_RPMS="$(< GBS_DIR_RPMS )"
- return
- fi
- if [ -d __dummy ] ; then
- rm -rf __dummy
- fi
- mkdir -p __dummy/packaging
- pushd __dummy > /dev/null
- printf 'Name: __dummy\nVersion: 0\nRelease: 0\n' > packaging/__dummy.spec
- git init -q
- git add packaging/__dummy.spec
- git commit -q -m spec
- echo "Executing dummy gbs build to determine the GBS_ROOT location ..."
- echo "> gbs $GBS_OPT build -A armv7l $PROFILE_OPT --keep-packs __dummy"
- gbs $GBS_OPT build $PROFILE_OPT -A armv7l $PROFILE_OPT --keep-packs 2>&1 | tee output
- echo " done"
- popd > /dev/null
- sed -n '/armv7l\/RPMS/ { s/^ *//; p }' __dummy/output > GBS_DIR_RPMS
- rm -rf __dummy
- GBS_DIR_RPMS="$(< GBS_DIR_RPMS )"
-}
-
-check_for_rpms() {
- while [ -n "$1" ] ; do
- for F in $GBS_DIR_RPMS/$1-*.rpm; do
- if [ ! -e "$F" ] ; then
- echo "ERROR: There is no file: $GBS_DIR_RPMS/$1-*.rpm"
- echo "ERROR: You have to build mono first, or place prebuilt RPMs in $GBS_DIR_RPMS"
- exit 1
- fi
- break
- done
- shift
- done
-}
-
-
-find_gbs_dir
-set -e
-check_for_rpms mono-compiler mono-core mono-devel
-
-echo "> gbs $GBS_OPT build $PROFILE_OPT -A armv7l --include-all --keep-packs --skip-srcrpm"
-gbs $GBS_OPT build $PROFILE_OPT -A armv7l --include-all --keep-packs --skip-srcrpm --clean
-
-echo " - - - - - - - - - - "
-echo " You can now install the following packages on the target"
-ls -1 "$GBS_DIR_RPMS"/mono-core-4*
-find "$GBS_DIR_RPMS" -name 'xamarin*rpm' -not -name '*debug*' -mmin -2
-echo
-echo " and try executing: sdb shell xamarin-sample"
diff --git a/docs/Xamarin.Forms.Core/Xamarin.Forms.Xaml/XamlParseException.xml b/docs/Xamarin.Forms.Core/Xamarin.Forms.Xaml/XamlParseException.xml
index 0ea33b8e..75eb2f60 100644
--- a/docs/Xamarin.Forms.Core/Xamarin.Forms.Xaml/XamlParseException.xml
+++ b/docs/Xamarin.Forms.Core/Xamarin.Forms.Xaml/XamlParseException.xml
@@ -23,15 +23,34 @@
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.5.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <Parameters>
+ <Parameter Name="message" Type="System.String" />
+ <Parameter Name="xmlInfo" Type="System.Xml.IXmlLineInfo" />
+ </Parameters>
+ <Docs>
+ <param name="message">To be added.</param>
+ <param name="xmlInfo">To be added.</param>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName=".ctor">
+ <MemberSignature Language="C#" Value="public XamlParseException (string message, System.Xml.IXmlLineInfo xmlInfo, Exception innerException = null);" />
+ <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string message, class System.Xml.IXmlLineInfo xmlInfo, class System.Exception innerException) cil managed" />
+ <MemberType>Constructor</MemberType>
+ <AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="message" Type="System.String" />
<Parameter Name="xmlInfo" Type="System.Xml.IXmlLineInfo" />
+ <Parameter Name="innerException" Type="System.Exception" />
</Parameters>
<Docs>
<param name="message">To be added.</param>
<param name="xmlInfo">To be added.</param>
+ <param name="innerException">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
</Docs>
diff --git a/docs/Xamarin.Forms.Core/Xamarin.Forms/ConstraintExpression.xml b/docs/Xamarin.Forms.Core/Xamarin.Forms/ConstraintExpression.xml
index 34a112f6..ad390321 100644
--- a/docs/Xamarin.Forms.Core/Xamarin.Forms/ConstraintExpression.xml
+++ b/docs/Xamarin.Forms.Core/Xamarin.Forms/ConstraintExpression.xml
@@ -1,6 +1,6 @@
<Type Name="ConstraintExpression" FullName="Xamarin.Forms.ConstraintExpression">
- <TypeSignature Language="C#" Value="public class ConstraintExpression : Xamarin.Forms.Xaml.IMarkupExtension" />
- <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit ConstraintExpression extends System.Object implements class Xamarin.Forms.Xaml.IMarkupExtension" />
+ <TypeSignature Language="C#" Value="public class ConstraintExpression : Xamarin.Forms.Xaml.IMarkupExtension&lt;Xamarin.Forms.Constraint&gt;" />
+ <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit ConstraintExpression extends System.Object implements class Xamarin.Forms.Xaml.IMarkupExtension, class Xamarin.Forms.Xaml.IMarkupExtension`1&lt;class Xamarin.Forms.Constraint&gt;" />
<AssemblyInfo>
<AssemblyName>Xamarin.Forms.Core</AssemblyName>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
@@ -16,7 +16,7 @@
</Base>
<Interfaces>
<Interface>
- <InterfaceName>Xamarin.Forms.Xaml.IMarkupExtension</InterfaceName>
+ <InterfaceName>Xamarin.Forms.Xaml.IMarkupExtension&lt;Xamarin.Forms.Constraint&gt;</InterfaceName>
</Interface>
</Interfaces>
<Docs>
@@ -181,7 +181,6 @@
<AssemblyVersion>1.3.0.0</AssemblyVersion>
<AssemblyVersion>1.4.0.0</AssemblyVersion>
<AssemblyVersion>1.5.0.0</AssemblyVersion>
- <AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Object</ReturnType>
@@ -196,6 +195,26 @@
<remarks>To be added.</remarks>
</Docs>
</Member>
+ <Member MemberName="ProvideValue">
+ <MemberSignature Language="C#" Value="public Xamarin.Forms.Constraint ProvideValue (IServiceProvider serviceProvider);" />
+ <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class Xamarin.Forms.Constraint ProvideValue(class System.IServiceProvider serviceProvider) cil managed" />
+ <MemberType>Method</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>Xamarin.Forms.Constraint</ReturnType>
+ </ReturnValue>
+ <Parameters>
+ <Parameter Name="serviceProvider" Type="System.IServiceProvider" />
+ </Parameters>
+ <Docs>
+ <param name="serviceProvider">To be added.</param>
+ <summary>To be added.</summary>
+ <returns>To be added.</returns>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
<Member MemberName="Type">
<MemberSignature Language="C#" Value="public Xamarin.Forms.ConstraintType Type { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype Xamarin.Forms.ConstraintType Type" />
@@ -218,5 +237,25 @@
<remarks>To be added.</remarks>
</Docs>
</Member>
+ <Member MemberName="Xamarin.Forms.Xaml.IMarkupExtension.ProvideValue">
+ <MemberSignature Language="C#" Value="object IMarkupExtension.ProvideValue (IServiceProvider serviceProvider);" />
+ <MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance object Xamarin.Forms.Xaml.IMarkupExtension.ProvideValue(class System.IServiceProvider serviceProvider) cil managed" />
+ <MemberType>Method</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>System.Object</ReturnType>
+ </ReturnValue>
+ <Parameters>
+ <Parameter Name="serviceProvider" Type="System.IServiceProvider" />
+ </Parameters>
+ <Docs>
+ <param name="serviceProvider">To be added.</param>
+ <summary>To be added.</summary>
+ <returns>To be added.</returns>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
</Members>
</Type>
diff --git a/docs/Xamarin.Forms.Xaml/Xamarin.Forms.Xaml.Internals/SimpleValueTargetProvider.xml b/docs/Xamarin.Forms.Xaml/Xamarin.Forms.Xaml.Internals/SimpleValueTargetProvider.xml
index 81070033..29e0060a 100644
--- a/docs/Xamarin.Forms.Xaml/Xamarin.Forms.Xaml.Internals/SimpleValueTargetProvider.xml
+++ b/docs/Xamarin.Forms.Xaml/Xamarin.Forms.Xaml.Internals/SimpleValueTargetProvider.xml
@@ -21,13 +21,30 @@
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.5.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <Parameters>
+ <Parameter Name="objectAndParents" Type="System.Object[]" />
+ </Parameters>
+ <Docs>
+ <param name="objectAndParents">To be added.</param>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName=".ctor">
+ <MemberSignature Language="C#" Value="public SimpleValueTargetProvider (object[] objectAndParents, object targetProperty);" />
+ <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(object[] objectAndParents, object targetProperty) cil managed" />
+ <MemberType>Constructor</MemberType>
+ <AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="objectAndParents" Type="System.Object[]" />
+ <Parameter Name="targetProperty" Type="System.Object" />
</Parameters>
<Docs>
<param name="objectAndParents">To be added.</param>
+ <param name="targetProperty">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
</Docs>
diff --git a/docs/Xamarin.Forms.Xaml/Xamarin.Forms.Xaml/BindingExtension.xml b/docs/Xamarin.Forms.Xaml/Xamarin.Forms.Xaml/BindingExtension.xml
index fd4e25be..f040bb89 100644
--- a/docs/Xamarin.Forms.Xaml/Xamarin.Forms.Xaml/BindingExtension.xml
+++ b/docs/Xamarin.Forms.Xaml/Xamarin.Forms.Xaml/BindingExtension.xml
@@ -148,6 +148,22 @@
<remarks>To be added.</remarks>
</Docs>
</Member>
+ <Member MemberName="UpdateSourceEventName">
+ <MemberSignature Language="C#" Value="public string UpdateSourceEventName { get; set; }" />
+ <MemberSignature Language="ILAsm" Value=".property instance string UpdateSourceEventName" />
+ <MemberType>Property</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>System.String</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>To be added.</summary>
+ <value>To be added.</value>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
<Member MemberName="Xamarin.Forms.Xaml.IMarkupExtension.ProvideValue">
<MemberSignature Language="C#" Value="object IMarkupExtension.ProvideValue (IServiceProvider serviceProvider);" />
<MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance object Xamarin.Forms.Xaml.IMarkupExtension.ProvideValue(class System.IServiceProvider serviceProvider) cil managed" />