Merge branch '3.0.0' into 3.1.0
This commit is contained in:
Коммит
a6a3b25ade
|
@ -13,10 +13,6 @@
|
|||
<description>Add support for deep linking and indexing app content using Xamarin.Forms on the Android Platform</description>
|
||||
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
|
||||
<dependencies>
|
||||
<group targetFramework="MonoAndroid10">
|
||||
<dependency id="Xamarin.Android.Support.v4" version="[23.3.0]"/>
|
||||
<dependency id="Xamarin.GooglePlayServices.AppIndexing" version="[29.0.0.1]"/>
|
||||
</group>
|
||||
<group targetFramework="MonoAndroid71">
|
||||
<dependency id="Xamarin.GooglePlayServices.AppIndexing" version="42.1021.1"/>
|
||||
</group>
|
||||
|
|
|
@ -16,18 +16,6 @@
|
|||
<group>
|
||||
<dependency id="Xamarin.Forms" version="$version$"/>
|
||||
</group>
|
||||
<group targetFramework="MonoAndroid10">
|
||||
<dependency id="Xamarin.GooglePlayServices.Maps" version="[29.0.0.1]"/>
|
||||
<dependency id="Xamarin.Android.Support.v7.MediaRouter" version="[23.3.0]"/>
|
||||
<dependency id="Xamarin.Android.Support.v7.AppCompat" version="[23.3.0]"/>
|
||||
<dependency id="Xamarin.Forms" version="$version$"/>
|
||||
</group>
|
||||
<group targetFramework="MonoAndroid70">
|
||||
<dependency id="Xamarin.GooglePlayServices.Maps" version="29.0.0.1"/>
|
||||
<dependency id="Xamarin.Android.Support.v7.MediaRouter" version="23.3.0"/>
|
||||
<dependency id="Xamarin.Android.Support.v7.AppCompat" version="23.3.0"/>
|
||||
<dependency id="Xamarin.Forms" version="$version$"/>
|
||||
</group>
|
||||
<group targetFramework="MonoAndroid71">
|
||||
<dependency id="Xamarin.GooglePlayServices.Maps" version="42.1021.1"/>
|
||||
<dependency id="Xamarin.Android.Support.v7.MediaRouter" version="25.4.0.2"/>
|
||||
|
|
|
@ -13,20 +13,6 @@
|
|||
<description>Build native UIs for iOS, Android, UWP, macOS, Tizen and many more from a single, shared C# codebase</description>
|
||||
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
|
||||
<dependencies>
|
||||
<group targetFramework="MonoAndroid10">
|
||||
<dependency id="Xamarin.Android.Support.v4" version="[23.3.0]"/>
|
||||
<dependency id="Xamarin.Android.Support.Design" version="[23.3.0]"/>
|
||||
<dependency id="Xamarin.Android.Support.v7.AppCompat" version="[23.3.0]"/>
|
||||
<dependency id="Xamarin.Android.Support.v7.CardView" version="[23.3.0]"/>
|
||||
<dependency id="Xamarin.Android.Support.v7.MediaRouter" version="[23.3.0]"/>
|
||||
</group>
|
||||
<group targetFramework="MonoAndroid70">
|
||||
<dependency id="Xamarin.Android.Support.v4" version="23.3.0"/>
|
||||
<dependency id="Xamarin.Android.Support.Design" version="23.3.0"/>
|
||||
<dependency id="Xamarin.Android.Support.v7.AppCompat" version="23.3.0"/>
|
||||
<dependency id="Xamarin.Android.Support.v7.CardView" version="23.3.0"/>
|
||||
<dependency id="Xamarin.Android.Support.v7.MediaRouter" version="23.3.0"/>
|
||||
</group>
|
||||
<group targetFramework="MonoAndroid71">
|
||||
<dependency id="Xamarin.Android.Support.v4" version="25.4.0.2"/>
|
||||
<dependency id="Xamarin.Android.Support.Design" version="25.4.0.2"/>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
|
||||
using Android.App;
|
||||
using Android.Content;
|
||||
using Android.OS;
|
||||
using Android.Runtime;
|
||||
using Plugin.CurrentActivity;
|
||||
|
@ -11,7 +12,9 @@ namespace Xamarin.Forms.ControlGallery.Android
|
|||
[Application]
|
||||
public class MainApplication : global::Android.App.Application, global::Android.App.Application.IActivityLifecycleCallbacks
|
||||
{
|
||||
public MainApplication(IntPtr handle, JniHandleOwnership transer)
|
||||
internal static Context ActivityContext { get; private set; }
|
||||
|
||||
public MainApplication(IntPtr handle, JniHandleOwnership transer)
|
||||
:base(handle, transer)
|
||||
{
|
||||
}
|
||||
|
@ -32,32 +35,39 @@ namespace Xamarin.Forms.ControlGallery.Android
|
|||
public void OnActivityCreated(Activity activity, Bundle savedInstanceState)
|
||||
{
|
||||
CrossCurrentActivity.Current.Activity = activity;
|
||||
}
|
||||
ActivityContext = activity;
|
||||
}
|
||||
|
||||
public void OnActivityDestroyed(Activity activity)
|
||||
{
|
||||
}
|
||||
{
|
||||
ActivityContext = activity;
|
||||
}
|
||||
|
||||
public void OnActivityPaused(Activity activity)
|
||||
{
|
||||
}
|
||||
{
|
||||
ActivityContext = activity;
|
||||
}
|
||||
|
||||
public void OnActivityResumed(Activity activity)
|
||||
{
|
||||
CrossCurrentActivity.Current.Activity = activity;
|
||||
}
|
||||
ActivityContext = activity;
|
||||
}
|
||||
|
||||
public void OnActivitySaveInstanceState(Activity activity, Bundle outState)
|
||||
{
|
||||
}
|
||||
{
|
||||
ActivityContext = activity;
|
||||
}
|
||||
|
||||
public void OnActivityStarted(Activity activity)
|
||||
{
|
||||
CrossCurrentActivity.Current.Activity = activity;
|
||||
}
|
||||
ActivityContext = activity;
|
||||
}
|
||||
|
||||
public void OnActivityStopped(Activity activity)
|
||||
{
|
||||
}
|
||||
{
|
||||
ActivityContext = activity;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.ControlGallery.Android;
|
||||
using Xamarin.Forms.Controls;
|
||||
|
||||
[assembly: Dependency(typeof(RegistrarValidationService))]
|
||||
namespace Xamarin.Forms.ControlGallery.Android
|
||||
{
|
||||
public class RegistrarValidationService : IRegistrarValidationService
|
||||
{
|
||||
readonly global::Android.Content.Context _context;
|
||||
|
||||
public RegistrarValidationService()
|
||||
{
|
||||
_context = MainApplication.ActivityContext;
|
||||
}
|
||||
|
||||
public bool Validate(VisualElement element, out string message)
|
||||
{
|
||||
message = "Success";
|
||||
|
||||
if (element == null)
|
||||
return true;
|
||||
|
||||
var renderer = Platform.Android.Platform.CreateRendererWithContext(element, _context);
|
||||
|
||||
if (renderer == null
|
||||
|| renderer.GetType().Name == "DefaultRenderer"
|
||||
)
|
||||
{
|
||||
message = $"Failed to load Android renderer for {element.GetType().Name}";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
using Android.Content;
|
||||
using Android.Widget;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.ControlGallery.Android;
|
||||
using Xamarin.Forms.Controls.Issues.Helpers;
|
||||
using Xamarin.Forms.Platform.Android;
|
||||
|
||||
[assembly: Dependency(typeof(SampleNativeControl))]
|
||||
namespace Xamarin.Forms.ControlGallery.Android
|
||||
{
|
||||
public class SampleNativeControl : ISampleNativeControl
|
||||
{
|
||||
readonly Context _context;
|
||||
|
||||
public SampleNativeControl()
|
||||
{
|
||||
_context = MainApplication.ActivityContext;
|
||||
}
|
||||
|
||||
public View View
|
||||
{
|
||||
get
|
||||
{
|
||||
var textView = new TextView(_context) { Text = "Sample Native Control", TextSize = 14 };
|
||||
return textView.ToView();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -201,9 +201,11 @@
|
|||
<Compile Include="PreApplicationClassActivity.cs" />
|
||||
<Compile Include="Properties\MapsKey.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RegistrarValidationService.cs" />
|
||||
<Compile Include="Resources\Resource.Designer.cs" />
|
||||
<Compile Include="CustomRenderers.cs" />
|
||||
<Compile Include="ColorPicker.cs" />
|
||||
<Compile Include="SampleNativeControl.cs" />
|
||||
<Compile Include="StringProvider.cs" />
|
||||
<Compile Include="TestCloudService.cs" />
|
||||
<Compile Include="_1909CustomRenderer.cs" />
|
||||
|
@ -250,6 +252,10 @@
|
|||
<AndroidResource Include="Resources\drawable\cover1.jpg" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PagesGallery\PagesGallery.Droid\PagesGallery.Droid.csproj">
|
||||
<Project>{5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}</Project>
|
||||
<Name>PagesGallery.Droid</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Stubs\Xamarin.Forms.Platform.Android\Xamarin.Forms.Platform.Android (Forwarders).csproj">
|
||||
<Project>{6e53feb1-1100-46ae-8013-17bba35cc197}</Project>
|
||||
<Name>Xamarin.Forms.Platform.Android (Forwarders)</Name>
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.ControlGallery.GTK;
|
||||
using Xamarin.Forms.Controls;
|
||||
using Xamarin.Forms.Platform.GTK;
|
||||
|
||||
[assembly: Dependency(typeof(RegistrarValidationService))]
|
||||
namespace Xamarin.Forms.ControlGallery.GTK
|
||||
{
|
||||
public class RegistrarValidationService : IRegistrarValidationService
|
||||
{
|
||||
public bool Validate(VisualElement element, out string message)
|
||||
{
|
||||
message = "Success";
|
||||
|
||||
if (element == null)
|
||||
return true;
|
||||
|
||||
var renderer = Platform.GTK.Platform.CreateRenderer(element);
|
||||
|
||||
if (renderer == null
|
||||
|| renderer.GetType().Name == "DefaultRenderer"
|
||||
)
|
||||
{
|
||||
message = $"Failed to load proper GTK renderer for {element.GetType().Name}";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.ControlGallery.GTK;
|
||||
using Xamarin.Forms.Controls.Issues.Helpers;
|
||||
using Xamarin.Forms.Platform.GTK;
|
||||
|
||||
[assembly: Dependency(typeof(SampleNativeControl))]
|
||||
namespace Xamarin.Forms.ControlGallery.GTK
|
||||
{
|
||||
public class SampleNativeControl : ISampleNativeControl
|
||||
{
|
||||
public View View
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Label { Text = "NativeViews not supported on GTK" };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -94,6 +94,8 @@
|
|||
<Compile Include="BasicOpenGLView.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RegistrarValidationService.cs" />
|
||||
<Compile Include="SampleNativeControl.cs" />
|
||||
<Compile Include="StringProvider.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.ControlGallery.MacOS;
|
||||
using Xamarin.Forms.Controls;
|
||||
using Xamarin.Forms.Platform.MacOS;
|
||||
|
||||
[assembly: Dependency(typeof(RegistrarValidationService))]
|
||||
namespace Xamarin.Forms.ControlGallery.MacOS
|
||||
{
|
||||
public class RegistrarValidationService : IRegistrarValidationService
|
||||
{
|
||||
public bool Validate(VisualElement element, out string message)
|
||||
{
|
||||
message = "Success";
|
||||
|
||||
if (element == null)
|
||||
return true;
|
||||
|
||||
var renderer = Platform.MacOS.Platform.CreateRenderer(element);
|
||||
|
||||
if (renderer == null
|
||||
|| renderer.GetType().Name == "DefaultRenderer"
|
||||
)
|
||||
{
|
||||
message = $"Failed to load proper MacOS renderer for {element.GetType().Name}";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
using AppKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.ControlGallery.MacOS;
|
||||
using Xamarin.Forms.Controls.Issues.Helpers;
|
||||
using Xamarin.Forms.Platform.MacOS;
|
||||
|
||||
[assembly: Dependency(typeof(SampleNativeControl))]
|
||||
namespace Xamarin.Forms.ControlGallery.MacOS
|
||||
{
|
||||
public class SampleNativeControl : ISampleNativeControl
|
||||
{
|
||||
public View View
|
||||
{
|
||||
get
|
||||
{
|
||||
var uiLabel = new NSTextField
|
||||
{
|
||||
StringValue = "Sample Native Control"
|
||||
};
|
||||
return uiLabel.ToView();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -105,6 +105,8 @@
|
|||
<Compile Include="NativeServices.cs" />
|
||||
<Compile Include="BrokenNativeControl.cs" />
|
||||
<Compile Include="CustomRenderers.cs" />
|
||||
<Compile Include="RegistrarValidationService.cs" />
|
||||
<Compile Include="SampleNativeControl.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Xamarin.Forms.Controls\Xamarin.Forms.Controls.csproj">
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.ControlGallery.Tizen;
|
||||
using Xamarin.Forms.Controls;
|
||||
using Xamarin.Forms.Platform.Tizen;
|
||||
|
||||
[assembly: Dependency(typeof(RegistrarValidationService))]
|
||||
namespace Xamarin.Forms.ControlGallery.Tizen
|
||||
{
|
||||
public class RegistrarValidationService : IRegistrarValidationService
|
||||
{
|
||||
public bool Validate(VisualElement element, out string message)
|
||||
{
|
||||
message = "Success";
|
||||
|
||||
if (element == null || element is OpenGLView)
|
||||
return true;
|
||||
|
||||
var renderer = Platform.Tizen.Platform.GetOrCreateRenderer(element);
|
||||
|
||||
if (renderer == null
|
||||
|| renderer.GetType().Name == "DefaultRenderer"
|
||||
)
|
||||
{
|
||||
message = $"Failed to load proper Tizen renderer for {element.GetType().Name}";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.ControlGallery.Tizen;
|
||||
using Xamarin.Forms.Controls.Issues.Helpers;
|
||||
using Xamarin.Forms.Platform.Tizen;
|
||||
|
||||
[assembly: Dependency(typeof(SampleNativeControl))]
|
||||
namespace Xamarin.Forms.ControlGallery.Tizen
|
||||
{
|
||||
public class SampleNativeControl : ISampleNativeControl
|
||||
{
|
||||
public View View
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Label { Text = "NativeViews not supported on Tizen" };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.ControlGallery.WPF;
|
||||
using Xamarin.Forms.Controls;
|
||||
using Xamarin.Forms.Platform.WPF;
|
||||
|
||||
[assembly: Dependency(typeof(RegistrarValidationService))]
|
||||
namespace Xamarin.Forms.ControlGallery.WPF
|
||||
{
|
||||
public class RegistrarValidationService : IRegistrarValidationService
|
||||
{
|
||||
public bool Validate(VisualElement element, out string message)
|
||||
{
|
||||
message = "Success";
|
||||
|
||||
if (element == null || element is OpenGLView)
|
||||
return true;
|
||||
|
||||
var renderer = Platform.WPF.Platform.GetOrCreateRenderer(element);
|
||||
|
||||
if (renderer == null
|
||||
|| renderer.GetType().Name == "DefaultRenderer"
|
||||
)
|
||||
{
|
||||
message = $"Failed to load proper WPF renderer for {element.GetType().Name}";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.ControlGallery.WPF;
|
||||
using Xamarin.Forms.Controls.Issues.Helpers;
|
||||
using Xamarin.Forms.Platform.WPF;
|
||||
|
||||
[assembly: Dependency(typeof(SampleNativeControl))]
|
||||
namespace Xamarin.Forms.ControlGallery.WPF
|
||||
{
|
||||
public class SampleNativeControl : ISampleNativeControl
|
||||
{
|
||||
public View View
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Label { Text = "NativeViews not supported on WPF" };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -69,6 +69,8 @@
|
|||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="OpenGLViewApp.cs" />
|
||||
<Compile Include="RegistrarValidationService.cs" />
|
||||
<Compile Include="SampleNativeControl.cs" />
|
||||
<Compile Include="StringProvider.cs" />
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.ControlGallery.WindowsUniversal;
|
||||
using Xamarin.Forms.Controls;
|
||||
using Xamarin.Forms.Platform.UWP;
|
||||
|
||||
[assembly: Dependency(typeof(RegistrarValidationService))]
|
||||
namespace Xamarin.Forms.ControlGallery.WindowsUniversal
|
||||
{
|
||||
public class RegistrarValidationService : IRegistrarValidationService
|
||||
{
|
||||
public bool Validate(VisualElement element, out string message)
|
||||
{
|
||||
message = "Success";
|
||||
|
||||
if (element == null || element is OpenGLView)
|
||||
return true;
|
||||
|
||||
var renderer = Platform.UWP.Platform.CreateRenderer(element);
|
||||
|
||||
if (renderer == null
|
||||
|| renderer.GetType().Name == "DefaultRenderer"
|
||||
)
|
||||
{
|
||||
message = $"Failed to load proper UWP renderer for {element.GetType().Name}";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.ControlGallery.WindowsUniversal;
|
||||
using Xamarin.Forms.Controls.Issues.Helpers;
|
||||
using Xamarin.Forms.Platform.UWP;
|
||||
|
||||
[assembly: Dependency(typeof(SampleNativeControl))]
|
||||
namespace Xamarin.Forms.ControlGallery.WindowsUniversal
|
||||
{
|
||||
public class SampleNativeControl : ISampleNativeControl
|
||||
{
|
||||
public View View
|
||||
{
|
||||
get
|
||||
{
|
||||
var textBlock = new TextBlock
|
||||
{
|
||||
Text = "Sample Native Control",
|
||||
FontSize = 14,
|
||||
FontFamily = new FontFamily("HelveticaNeue"),
|
||||
TextWrapping = TextWrapping.Wrap
|
||||
};
|
||||
return textBlock.ToView();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -127,6 +127,8 @@
|
|||
<Compile Include="AttachedStateEffectRenderer.cs" />
|
||||
<Compile Include="BorderEffect.cs" />
|
||||
<Compile Include="DisposePageRenderer.cs" />
|
||||
<Compile Include="RegistrarValidationService.cs" />
|
||||
<Compile Include="SampleNativeControl.cs" />
|
||||
<Compile Include="_2489CustomRenderer.cs" />
|
||||
<Compile Include="_57114Renderer.cs" />
|
||||
<Compile Include="_58406EffectRenderer.cs" />
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.ControlGallery.iOS;
|
||||
using Xamarin.Forms.Controls;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
[assembly: Dependency(typeof(RegistrarValidationService))]
|
||||
namespace Xamarin.Forms.ControlGallery.iOS
|
||||
{
|
||||
public class RegistrarValidationService : IRegistrarValidationService
|
||||
{
|
||||
public bool Validate(VisualElement element, out string message)
|
||||
{
|
||||
message = "Success";
|
||||
|
||||
if (element == null)
|
||||
return true;
|
||||
|
||||
var renderer = Platform.iOS.Platform.CreateRenderer(element);
|
||||
|
||||
if (renderer == null
|
||||
|| renderer.GetType().Name == "DefaultRenderer"
|
||||
|| (element is MasterDetailPage && Device.Idiom == TargetIdiom.Tablet && !(renderer is TabletMasterDetailRenderer))
|
||||
|| (element is MasterDetailPage && Device.Idiom == TargetIdiom.Phone && !(renderer is PhoneMasterDetailRenderer))
|
||||
)
|
||||
{
|
||||
message = $"Failed to load proper iOS renderer for {element.GetType().Name}";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.ControlGallery.iOS;
|
||||
using Xamarin.Forms.Controls.Issues.Helpers;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
[assembly: Dependency(typeof(SampleNativeControl))]
|
||||
namespace Xamarin.Forms.ControlGallery.iOS
|
||||
{
|
||||
public class SampleNativeControl : ISampleNativeControl
|
||||
{
|
||||
public View View
|
||||
{
|
||||
get
|
||||
{
|
||||
var uiLabel = new UILabel
|
||||
{
|
||||
MinimumFontSize = 14f,
|
||||
Lines = 0,
|
||||
LineBreakMode = UILineBreakMode.WordWrap,
|
||||
Text = "Sample Native Control",
|
||||
};
|
||||
return uiLabel.ToView();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -41,6 +41,8 @@
|
|||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||
<MtouchFloat32>False</MtouchFloat32>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<CodesignProvision />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
||||
<DebugType>none</DebugType>
|
||||
|
@ -110,6 +112,8 @@
|
|||
<Compile Include="Main.cs" />
|
||||
<Compile Include="AppDelegate.cs" />
|
||||
<Compile Include="PerformanceTrackerRenderer.cs" />
|
||||
<Compile Include="RegistrarValidationService.cs" />
|
||||
<Compile Include="SampleNativeControl.cs" />
|
||||
<Compile Include="_2489CustomRenderer.cs" />
|
||||
<Compile Include="_57114Renderer.cs" />
|
||||
<Compile Include="_58406EffectRenderer.cs" />
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Xamarin.Forms.Controls.Issues.Helpers
|
||||
{
|
||||
public interface ISampleNativeControl
|
||||
{
|
||||
View View { get; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Xamarin.Forms.Controls.Issues.Helpers
|
||||
{
|
||||
public static class ViewHelper
|
||||
{
|
||||
public static List<View> GetAllViews()
|
||||
{
|
||||
var controls = new List<View>
|
||||
{
|
||||
new ActivityIndicator { },
|
||||
new BoxView { },
|
||||
new Button { },
|
||||
new DatePicker { },
|
||||
new Editor { },
|
||||
new Entry { },
|
||||
new Image { },
|
||||
new Label { },
|
||||
new ListView { ItemsSource = Enumerable.Range(0,10), ItemTemplate = new DataTemplate(() => new ViewCell{ View = new View() }) },
|
||||
new ListView { ItemsSource = Enumerable.Range(0,10), ItemTemplate = new DataTemplate(typeof(TextCell)) },
|
||||
new ListView { ItemsSource = Enumerable.Range(0,10), ItemTemplate = new DataTemplate(typeof(ImageCell)) },
|
||||
new ListView { ItemsSource = Enumerable.Range(0,10), ItemTemplate = new DataTemplate(typeof(EntryCell)) },
|
||||
new ListView { ItemsSource = Enumerable.Range(0,10), ItemTemplate = new DataTemplate(typeof(SwitchCell)) },
|
||||
new OpenGLView { },
|
||||
new Picker { },
|
||||
new ProgressBar { },
|
||||
new SearchBar { },
|
||||
new Slider { },
|
||||
new Stepper { },
|
||||
new Switch { },
|
||||
new TableView { },
|
||||
new TimePicker { },
|
||||
GetNativeView()
|
||||
};
|
||||
|
||||
return controls;
|
||||
}
|
||||
|
||||
public static List<Page> GetAllPages()
|
||||
{
|
||||
var controls = new List<Page>
|
||||
{
|
||||
new MasterDetailPage { Master = new Page { Title = "Master" }, Detail = new Page() },
|
||||
new NavigationPage(new Page()),
|
||||
new Page(),
|
||||
new ContentPage(),
|
||||
new CarouselPage(),
|
||||
new TabbedPage(),
|
||||
new TemplatedPage(),
|
||||
};
|
||||
|
||||
return controls;
|
||||
}
|
||||
|
||||
public static View GetNativeView()
|
||||
{
|
||||
View view = null;
|
||||
view = DependencyService.Get<ISampleNativeControl>().View;
|
||||
return view;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,137 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Xamarin.Forms.CustomAttributes;
|
||||
using Xamarin.Forms.Internals;
|
||||
using Xamarin.Forms.PlatformConfiguration;
|
||||
using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
|
||||
|
||||
|
||||
#if UITEST
|
||||
using Xamarin.UITest;
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Forms.Controls.Issues
|
||||
{
|
||||
[Preserve(AllMembers = true)]
|
||||
[Issue(IssueTracker.Github, 2653, "[UWP] Grid insert z-order on UWP broken in Forms 3",
|
||||
PlatformAffected.UWP)]
|
||||
public class Issue2653 : TestContentPage
|
||||
{
|
||||
BoxView bv = null;
|
||||
Grid layout = null;
|
||||
const string ButtonText = "Insert Box View";
|
||||
const string MoveUp = "Move Box View Up";
|
||||
const string MoveDown = "Move Box View Down";
|
||||
const string BoxViewIsOverlappingButton = "Box View Is Overlapping";
|
||||
const string Success = "BoxView Not Overlapping";
|
||||
string instructions = $"Click {ButtonText}. If Box View shows up over me test has failed.";
|
||||
const string TestForButtonClicked = "Test For Clicked";
|
||||
|
||||
|
||||
protected override void Init()
|
||||
{
|
||||
layout = new Grid { BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand };
|
||||
|
||||
layout.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Star });
|
||||
layout.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Star });
|
||||
layout.Children.Add(new Button()
|
||||
{
|
||||
Text = ButtonText,
|
||||
BackgroundColor = Color.Green,
|
||||
Margin = 10,
|
||||
TextColor = Color.White,
|
||||
Command = new Command(() =>
|
||||
{
|
||||
if (!AddBoxView())
|
||||
{
|
||||
layout.Children.Remove(bv);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
this.On<iOS>().SetUseSafeArea(true);
|
||||
|
||||
var labelInstructions = new Label { Text = instructions };
|
||||
|
||||
Content = new StackLayout()
|
||||
{
|
||||
Children =
|
||||
{
|
||||
labelInstructions,
|
||||
new Button(){ Text = MoveUp, AutomationId = MoveUp, Command = new Command(() =>
|
||||
{
|
||||
AddBoxView();
|
||||
layout.RaiseChild(bv);
|
||||
}), HeightRequest = 45},
|
||||
new Button(){ Text = MoveDown, AutomationId = MoveDown, Command = new Command(() =>
|
||||
{
|
||||
AddBoxView();
|
||||
layout.LowerChild(bv);
|
||||
}), HeightRequest = 45},
|
||||
layout,
|
||||
new Button(){ Text = TestForButtonClicked, Command = new Command(() =>
|
||||
{
|
||||
if(!layout.Children.Contains(bv))
|
||||
{
|
||||
labelInstructions.Text = Success;
|
||||
}
|
||||
else
|
||||
{
|
||||
labelInstructions.Text = BoxViewIsOverlappingButton;
|
||||
}
|
||||
}), HeightRequest = 45}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
bool AddBoxView()
|
||||
{
|
||||
if (bv != null && layout.Children.Contains(bv))
|
||||
return false;
|
||||
|
||||
bv = new BoxView
|
||||
{
|
||||
Color = Color.Purple,
|
||||
WidthRequest = 3000,
|
||||
HeightRequest = 3000,
|
||||
HorizontalOptions = LayoutOptions.Center,
|
||||
VerticalOptions = LayoutOptions.Center
|
||||
};
|
||||
|
||||
layout.Children.Insert(0, bv);
|
||||
return true;
|
||||
}
|
||||
|
||||
#if UITEST
|
||||
[Test]
|
||||
public void ZIndexWhenInsertingChildren()
|
||||
{
|
||||
RunningApp.WaitForElement(x => x.Marked(ButtonText));
|
||||
RunningApp.Tap(x => x.Marked(ButtonText));
|
||||
RunningApp.Tap(x => x.Marked(ButtonText));
|
||||
RunningApp.Tap(x => x.Marked(TestForButtonClicked));
|
||||
RunningApp.WaitForElement(x => x.Marked(Success));
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void MoveUpAndMoveDown()
|
||||
{
|
||||
RunningApp.WaitForElement(x => x.Marked(MoveUp));
|
||||
RunningApp.Tap(x => x.Marked(ButtonText));
|
||||
RunningApp.Tap(x => x.Marked(TestForButtonClicked));
|
||||
RunningApp.WaitForElement(x => x.Marked(BoxViewIsOverlappingButton));
|
||||
|
||||
RunningApp.Tap(x => x.Marked(MoveUp));
|
||||
RunningApp.Tap(x => x.Marked(MoveDown));
|
||||
RunningApp.Tap(x => x.Marked(ButtonText));
|
||||
RunningApp.Tap(x => x.Marked(TestForButtonClicked));
|
||||
RunningApp.WaitForElement(x => x.Marked(Success));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Text;
|
||||
using Xamarin.Forms.CustomAttributes;
|
||||
using Xamarin.Forms.Internals;
|
||||
|
||||
|
||||
#if UITEST
|
||||
using Xamarin.UITest;
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Forms.Controls.Issues
|
||||
{
|
||||
[Preserve(AllMembers = true)]
|
||||
[Issue(IssueTracker.Github, 2681, "[UWP] Label inside Listview gets stuck inside infinite loop",
|
||||
PlatformAffected.UWP)]
|
||||
public class Issue2681 : TestNavigationPage
|
||||
{
|
||||
const string NavigateToPage = "Click Me.";
|
||||
protected override void Init()
|
||||
{
|
||||
PushAsync(new ContentPage() { Title = "Freeze Test", Content = new Button() { Text = NavigateToPage, Command = new Command(() => this.PushAsync(new FreezeMe())) } });
|
||||
}
|
||||
|
||||
[Preserve(AllMembers = true)]
|
||||
public partial class FreezeMe : ContentPage
|
||||
{
|
||||
public List<int> Items { get; set; }
|
||||
|
||||
public FreezeMe()
|
||||
{
|
||||
this.BindingContext = this;
|
||||
var lv = new ListView()
|
||||
{
|
||||
Margin = new Thickness(20, 5, 5, 5)
|
||||
};
|
||||
|
||||
lv.ItemTemplate = new DataTemplate(() =>
|
||||
{
|
||||
var label = new Label() { Text = "sassifrass" };
|
||||
label.SetBinding(Label.TextProperty, ".");
|
||||
return new ViewCell() { View = label };
|
||||
});
|
||||
|
||||
lv.SetBinding(ListView.ItemsSourceProperty, "Items");
|
||||
|
||||
this.Content = new ScrollView()
|
||||
{
|
||||
Content = new StackLayout()
|
||||
{
|
||||
Children =
|
||||
{
|
||||
new Label(){ Text = "If page is not frozen this test has passed" },
|
||||
new StackLayout()
|
||||
{
|
||||
Orientation = StackOrientation.Horizontal,
|
||||
Children = {lv }
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.Appearing += (s, e) =>
|
||||
{
|
||||
this.Items = new List<int> { 1, 2, 3 };
|
||||
this.OnPropertyChanged("Items");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#if UITEST
|
||||
[Test]
|
||||
public void ListViewDoesntFreezeApp()
|
||||
{
|
||||
RunningApp.Tap(x => x.Marked(NavigateToPage));
|
||||
RunningApp.WaitForElement("3");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
|
@ -240,12 +240,15 @@
|
|||
<Compile Include="$(MSBuildThisFileDirectory)Effects\AttachedStateEffect.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Effects\AttachedStateEffectList.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)GitHub1878.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Helpers\ISampleNativeControl.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Helpers\ViewHelper.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue1677.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue1801.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue1683.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue1705_2.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue1396.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue1415.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue2653.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue2247.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)GroupListViewHeaderIndexOutOfRange.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue1760.cs" />
|
||||
|
@ -308,6 +311,7 @@
|
|||
<DependentUpon>Issue2625.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue2681.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue2983.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue2963.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue2981.cs" />
|
||||
|
|
|
@ -443,6 +443,8 @@ namespace Xamarin.Forms.Controls
|
|||
{
|
||||
public CoreRootPage(Page rootPage, NavigationBehavior navigationBehavior = NavigationBehavior.PushAsync)
|
||||
{
|
||||
ValidateRegistrar();
|
||||
|
||||
IStringProvider stringProvider = DependencyService.Get<IStringProvider>();
|
||||
|
||||
Title = stringProvider.CoreGalleryTitle;
|
||||
|
@ -493,7 +495,23 @@ namespace Xamarin.Forms.Controls
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
void ValidateRegistrar()
|
||||
{
|
||||
foreach (var view in Issues.Helpers.ViewHelper.GetAllViews())
|
||||
{
|
||||
if (!DependencyService.Get<IRegistrarValidationService>().Validate(view, out string message))
|
||||
throw new InvalidOperationException(message);
|
||||
}
|
||||
|
||||
foreach (var page in Issues.Helpers.ViewHelper.GetAllPages())
|
||||
{
|
||||
if (!DependencyService.Get<IRegistrarValidationService>().Validate(page, out string message))
|
||||
throw new InvalidOperationException(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Preserve(AllMembers = true)]
|
||||
public interface IStringProvider
|
||||
{
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
namespace Xamarin.Forms.Controls
|
||||
{
|
||||
public interface IRegistrarValidationService
|
||||
{
|
||||
bool Validate(VisualElement element, out string message);
|
||||
}
|
||||
}
|
|
@ -337,9 +337,13 @@ namespace Xamarin.Forms
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
property = sourceType.GetDeclaredProperty(part.Content) ?? sourceType.BaseType?.GetProperty(part.Content);
|
||||
|
||||
else {
|
||||
TypeInfo type = sourceType;
|
||||
while (type != null && property == null) {
|
||||
property = type.GetDeclaredProperty(part.Content);
|
||||
type = type.BaseType?.GetTypeInfo();
|
||||
}
|
||||
}
|
||||
if (property != null)
|
||||
{
|
||||
if (property.CanRead && property.GetMethod.IsPublic && !property.GetMethod.IsStatic)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace Xamarin.Forms.Internals
|
||||
{
|
||||
|
@ -15,6 +16,8 @@ namespace Xamarin.Forms.Internals
|
|||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public class Performance
|
||||
{
|
||||
static long Reference;
|
||||
|
||||
public static IPerformanceProvider Provider { get; private set; }
|
||||
|
||||
public static void SetProvider(IPerformanceProvider instance)
|
||||
|
@ -22,7 +25,20 @@ namespace Xamarin.Forms.Internals
|
|||
Provider = instance;
|
||||
}
|
||||
|
||||
public static void Start(string reference, string tag = null, [CallerFilePath] string path = null, [CallerMemberName] string member = null)
|
||||
public static void Start(out string reference, string tag = null, [CallerFilePath] string path = null, [CallerMemberName] string member = null)
|
||||
{
|
||||
if (Provider == null)
|
||||
{
|
||||
reference = String.Empty;
|
||||
return;
|
||||
}
|
||||
|
||||
reference = Interlocked.Increment(ref Reference).ToString();
|
||||
Provider.Start(reference, tag, path, member);
|
||||
}
|
||||
|
||||
public static void Start(string reference, string tag = null, [CallerFilePath] string path = null,
|
||||
[CallerMemberName] string member = null)
|
||||
{
|
||||
Provider?.Start(reference, tag, path, member);
|
||||
}
|
||||
|
@ -46,11 +62,11 @@ namespace Xamarin.Forms.Internals
|
|||
|
||||
public DisposablePerformanceReference(string tag, string path, string member)
|
||||
{
|
||||
_reference = Guid.NewGuid().ToString();
|
||||
_tag = tag;
|
||||
_path = path;
|
||||
_member = member;
|
||||
Start(_reference, _tag, _path, _member);
|
||||
Start(out string reference, _tag, _path, _member);
|
||||
_reference = reference;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
@ -59,4 +75,4 @@ namespace Xamarin.Forms.Internals
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -165,8 +165,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
|
|||
|
||||
SizeRequest IPlatform.GetNativeSize(VisualElement view, double widthConstraint, double heightConstraint)
|
||||
{
|
||||
var reference = Guid.NewGuid().ToString();
|
||||
Performance.Start(reference);
|
||||
Performance.Start(out string reference);
|
||||
|
||||
// FIXME: potential crash
|
||||
IVisualElementRenderer visualElementRenderer = Android.Platform.GetRenderer(view);
|
||||
|
|
|
@ -23,8 +23,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
|
||||
public AView GetCell(Cell item, AView convertView, ViewGroup parent, Context context)
|
||||
{
|
||||
var reference = Guid.NewGuid().ToString();
|
||||
Performance.Start(reference);
|
||||
Performance.Start(out string reference);
|
||||
|
||||
Cell = item;
|
||||
Cell.PropertyChanged -= PropertyChangedHandler;
|
||||
|
@ -69,8 +68,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
|
||||
protected virtual AView GetCellCore(Cell item, AView convertView, ViewGroup parent, Context context)
|
||||
{
|
||||
var reference = Guid.NewGuid().ToString();
|
||||
Performance.Start(reference, "GetCellCore");
|
||||
Performance.Start(out string reference, "GetCellCore");
|
||||
|
||||
LayoutInflater inflater = LayoutInflater.FromContext(context);
|
||||
const int type = global::Android.Resource.Layout.SimpleListItem1;
|
||||
|
|
|
@ -12,8 +12,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
{
|
||||
protected override AView GetCellCore(Cell item, AView convertView, ViewGroup parent, Context context)
|
||||
{
|
||||
var reference = Guid.NewGuid().ToString();
|
||||
Performance.Start(reference, "GetCellCore");
|
||||
Performance.Start(out string reference, "GetCellCore");
|
||||
var cell = (ViewCell)item;
|
||||
|
||||
var container = convertView as ViewCellContainer;
|
||||
|
@ -150,9 +149,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
|
||||
public void Update(ViewCell cell)
|
||||
{
|
||||
var reference = Guid.NewGuid().ToString();
|
||||
Performance.Start(reference);
|
||||
|
||||
Performance.Start(out string reference);
|
||||
var renderer = GetChildAt(0) as IVisualElementRenderer;
|
||||
var viewHandlerType = Registrar.Registered.GetHandlerTypeForObject(cell.View) ?? typeof(Platform.DefaultRenderer);
|
||||
var reflectableType = renderer as System.Reflection.IReflectableType;
|
||||
|
@ -211,8 +208,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
|
||||
protected override void OnLayout(bool changed, int l, int t, int r, int b)
|
||||
{
|
||||
var reference = Guid.NewGuid().ToString();
|
||||
Performance.Start(reference);
|
||||
Performance.Start(out string reference);
|
||||
|
||||
double width = Context.FromPixels(r - l);
|
||||
double height = Context.FromPixels(b - t);
|
||||
|
@ -227,8 +223,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
|
||||
protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec)
|
||||
{
|
||||
var reference = Guid.NewGuid().ToString();
|
||||
Performance.Start(reference);
|
||||
Performance.Start(out string reference);
|
||||
|
||||
int width = MeasureSpec.GetSize(widthMeasureSpec);
|
||||
int height;
|
||||
|
|
|
@ -122,8 +122,7 @@ namespace Xamarin.Forms.Platform.Android.FastRenderers
|
|||
VisualElement oldElement = Button;
|
||||
Button = (Button)element;
|
||||
|
||||
var reference = Guid.NewGuid().ToString();
|
||||
Performance.Start(reference);
|
||||
Performance.Start(out string reference);
|
||||
|
||||
if (oldElement != null)
|
||||
{
|
||||
|
|
|
@ -112,8 +112,7 @@ namespace Xamarin.Forms.Platform.Android.FastRenderers
|
|||
Image oldElement = _element;
|
||||
_element = image;
|
||||
|
||||
var reference = Guid.NewGuid().ToString();
|
||||
Performance.Start(reference);
|
||||
Performance.Start(out string reference);
|
||||
|
||||
if (oldElement != null)
|
||||
oldElement.PropertyChanged -= OnElementPropertyChanged;
|
||||
|
|
|
@ -1232,8 +1232,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
|
||||
SizeRequest IPlatform.GetNativeSize(VisualElement view, double widthConstraint, double heightConstraint)
|
||||
{
|
||||
var reference = Guid.NewGuid().ToString();
|
||||
Performance.Start(reference);
|
||||
Performance.Start(out string reference);
|
||||
|
||||
// FIXME: potential crash
|
||||
IVisualElementRenderer visualElementRenderer = GetRenderer(view);
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
realListView.OnItemLongClickListener = this;
|
||||
|
||||
var platform = _listView.Platform;
|
||||
if (platform.GetType() == typeof(AppCompat.Platform))
|
||||
if (platform?.GetType() == typeof(AppCompat.Platform))
|
||||
MessagingCenter.Subscribe<AppCompat.Platform>(this, AppCompat.Platform.CloseContextActionsSignalName, p => CloseContextActions());
|
||||
else
|
||||
MessagingCenter.Subscribe<Platform>(this, Platform.CloseContextActionsSignalName, p => CloseContextActions());
|
||||
|
@ -194,8 +194,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
{
|
||||
Cell cell = null;
|
||||
|
||||
var reference = Guid.NewGuid().ToString();
|
||||
Performance.Start(reference);
|
||||
Performance.Start(out string reference);
|
||||
|
||||
ListViewCachingStrategy cachingStrategy = Controller.CachingStrategy;
|
||||
var nextCellIsHeader = false;
|
||||
|
|
|
@ -89,8 +89,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
|
||||
void AddChild(VisualElement view, IVisualElementRenderer oldRenderer = null, RendererPool pool = null, bool sameChildren = false)
|
||||
{
|
||||
var reference = Guid.NewGuid().ToString();
|
||||
Performance.Start(reference);
|
||||
Performance.Start(out string reference);
|
||||
|
||||
if (CompressedLayout.GetIsHeadless(view))
|
||||
{
|
||||
|
@ -165,8 +164,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
|
||||
void OnChildRemoved(object sender, ElementEventArgs e)
|
||||
{
|
||||
var reference = Guid.NewGuid().ToString();
|
||||
Performance.Start(reference);
|
||||
Performance.Start(out string reference);
|
||||
var view = e.Element as VisualElement;
|
||||
if (view != null)
|
||||
RemoveChild(view);
|
||||
|
@ -203,8 +201,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
|
||||
void SetElement(VisualElement oldElement, VisualElement newElement)
|
||||
{
|
||||
var reference = Guid.NewGuid().ToString();
|
||||
Performance.Start(reference);
|
||||
Performance.Start(out string reference);
|
||||
|
||||
var sameChildrenTypes = false;
|
||||
|
||||
|
|
|
@ -130,8 +130,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
|
||||
public void UpdateLayout()
|
||||
{
|
||||
var reference = Guid.NewGuid().ToString();
|
||||
Performance.Start(reference);
|
||||
Performance.Start(out string reference);
|
||||
Tracker?.UpdateLayout();
|
||||
Performance.Stop(reference);
|
||||
}
|
||||
|
|
|
@ -301,8 +301,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
|
||||
void UpdateNativeView(object sender, EventArgs e)
|
||||
{
|
||||
var reference = Guid.NewGuid().ToString();
|
||||
Performance.Start(reference);
|
||||
Performance.Start(out string reference);
|
||||
|
||||
VisualElement view = _renderer.Element;
|
||||
AView aview = _renderer.View;
|
||||
|
@ -328,8 +327,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
|
||||
void UpdateOpacity()
|
||||
{
|
||||
var reference = Guid.NewGuid().ToString();
|
||||
Performance.Start(reference);
|
||||
Performance.Start(out string reference);
|
||||
|
||||
VisualElement view = _renderer.Element;
|
||||
AView aview = _renderer.View;
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace Xamarin.Forms.Platform.UWP
|
|||
new CollectionViewSource { Source = Element.ItemsSource, IsSourceGrouped = Element.IsGroupingEnabled };
|
||||
}
|
||||
|
||||
List.UpdateLayout();
|
||||
Device.BeginInvokeOnMainThread(() => List.UpdateLayout());
|
||||
}
|
||||
|
||||
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
|
|
|
@ -15,7 +15,6 @@ namespace Xamarin.Forms.Platform.UWP
|
|||
readonly int _rowSpan;
|
||||
bool _disposed;
|
||||
bool _isLoaded;
|
||||
bool _isZChanged;
|
||||
|
||||
public VisualElementPackager(IVisualElementRenderer renderer)
|
||||
{
|
||||
|
@ -101,17 +100,10 @@ namespace Xamarin.Forms.Platform.UWP
|
|||
IVisualElementRenderer childRenderer = Platform.GetRenderer(child);
|
||||
|
||||
if (childRenderer == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Canvas.GetZIndex(childRenderer.ContainerElement) != (z + 1))
|
||||
{
|
||||
if (!_isZChanged)
|
||||
_isZChanged = true;
|
||||
|
||||
Canvas.SetZIndex(childRenderer.ContainerElement, z + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,7 +128,7 @@ namespace Xamarin.Forms.Platform.UWP
|
|||
|
||||
_panel.Children.Add(childRenderer.ContainerElement);
|
||||
|
||||
if (_isZChanged)
|
||||
if (ElementController.LogicalChildren[ElementController.LogicalChildren.Count - 1] != view)
|
||||
EnsureZIndex();
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,7 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
|
||||
public virtual UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
|
||||
{
|
||||
var reference = Guid.NewGuid().ToString();
|
||||
Performance.Start(reference);
|
||||
Performance.Start(out string reference);
|
||||
|
||||
var tvc = reusableCell as CellTableViewCell ?? new CellTableViewCell(UITableViewCellStyle.Default, item.GetType().FullName);
|
||||
|
||||
|
|
|
@ -11,8 +11,7 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
{
|
||||
public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
|
||||
{
|
||||
var reference = Guid.NewGuid().ToString();
|
||||
Performance.Start(reference);
|
||||
Performance.Start(out string reference);
|
||||
|
||||
var viewCell = (ViewCell)item;
|
||||
|
||||
|
@ -77,8 +76,7 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
|
||||
public override void LayoutSubviews()
|
||||
{
|
||||
var reference = Guid.NewGuid().ToString();
|
||||
Performance.Start(reference);
|
||||
Performance.Start(out string reference);
|
||||
|
||||
//This sets the content views frame.
|
||||
base.LayoutSubviews();
|
||||
|
@ -107,8 +105,7 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
|
||||
public override SizeF SizeThatFits(SizeF size)
|
||||
{
|
||||
var reference = Guid.NewGuid().ToString();
|
||||
Performance.Start(reference);
|
||||
Performance.Start(out string reference);
|
||||
|
||||
IVisualElementRenderer renderer;
|
||||
if (!_rendererRef.TryGetTarget(out renderer))
|
||||
|
@ -167,8 +164,7 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
|
||||
void UpdateCell(ViewCell cell)
|
||||
{
|
||||
var reference = Guid.NewGuid().ToString();
|
||||
Performance.Start(reference);
|
||||
Performance.Start(out string reference);
|
||||
|
||||
if (_viewCell != null)
|
||||
Device.BeginInvokeOnMainThread(_viewCell.SendDisappearing);
|
||||
|
|
|
@ -182,8 +182,7 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
|
||||
SizeRequest IPlatform.GetNativeSize(VisualElement view, double widthConstraint, double heightConstraint)
|
||||
{
|
||||
var reference = Guid.NewGuid().ToString();
|
||||
Performance.Start(reference);
|
||||
Performance.Start(out string reference);
|
||||
|
||||
var renderView = GetRenderer(view);
|
||||
if (renderView == null || renderView.NativeView == null)
|
||||
|
|
|
@ -42,7 +42,6 @@ using UIKit;
|
|||
[assembly: ExportRenderer(typeof(NavigationMenu), typeof(NavigationMenuRenderer))]
|
||||
[assembly: ExportRenderer(typeof(ListView), typeof(ListViewRenderer))]
|
||||
[assembly: ExportRenderer(typeof(OpenGLView), typeof(OpenGLViewRenderer))]
|
||||
[assembly: ExportRenderer(typeof(NativeViewWrapper), typeof(NativeViewWrapperRenderer))]
|
||||
[assembly: ExportRenderer(typeof(TabbedPage), typeof(TabbedRenderer))]
|
||||
[assembly: ExportRenderer(typeof(NavigationPage), typeof(NavigationRenderer))]
|
||||
[assembly: ExportRenderer(typeof(CarouselPage), typeof(CarouselPageRenderer))]
|
||||
|
@ -51,6 +50,7 @@ using UIKit;
|
|||
#endif
|
||||
|
||||
[assembly: ExportRenderer(typeof(MasterDetailPage), typeof(TabletMasterDetailRenderer), UIUserInterfaceIdiom.Pad)]
|
||||
[assembly: ExportRenderer(typeof(NativeViewWrapper), typeof(NativeViewWrapperRenderer))]
|
||||
|
||||
[assembly: ExportCell(typeof(Cell), typeof(CellRenderer))]
|
||||
[assembly: ExportCell(typeof(ImageCell), typeof(ImageCellRenderer))]
|
||||
|
|
|
@ -911,8 +911,7 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
Cell cell;
|
||||
UITableViewCell nativeCell;
|
||||
|
||||
var reference = Guid.NewGuid().ToString();
|
||||
Performance.Start(reference);
|
||||
Performance.Start(out string reference);
|
||||
|
||||
var cachingStrategy = List.CachingStrategy;
|
||||
if (cachingStrategy == ListViewCachingStrategy.RetainElement)
|
||||
|
|
|
@ -85,8 +85,7 @@ namespace Xamarin.Forms.Platform.MacOS
|
|||
{
|
||||
if (_isDisposed)
|
||||
return;
|
||||
var reference = Guid.NewGuid().ToString();
|
||||
Performance.Start(reference);
|
||||
Performance.Start(out string reference);
|
||||
if (CompressedLayout.GetIsHeadless(view))
|
||||
{
|
||||
var packager = new VisualElementPackager(Renderer, view);
|
||||
|
@ -173,8 +172,7 @@ namespace Xamarin.Forms.Platform.MacOS
|
|||
if (oldElement == newElement)
|
||||
return;
|
||||
|
||||
var reference = Guid.NewGuid().ToString();
|
||||
Performance.Start(reference);
|
||||
Performance.Start(out string reference);
|
||||
|
||||
_element = newElement;
|
||||
|
||||
|
|
|
@ -155,8 +155,7 @@ namespace Xamarin.Forms.Platform.MacOS
|
|||
var oldElement = Element;
|
||||
Element = element;
|
||||
|
||||
var reference = Guid.NewGuid().ToString();
|
||||
Performance.Start(reference);
|
||||
Performance.Start(out string reference);
|
||||
|
||||
if (oldElement != null)
|
||||
oldElement.PropertyChanged -= _propertyChangedHandler;
|
||||
|
|
|
@ -300,8 +300,7 @@ namespace Xamarin.Forms.Platform.MacOS
|
|||
|
||||
void UpdateNativeControl()
|
||||
{
|
||||
var reference = Guid.NewGuid().ToString();
|
||||
Performance.Start(reference);
|
||||
Performance.Start(out string reference);
|
||||
|
||||
if (_disposed)
|
||||
return;
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<local:Gh2632Base xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Xamarin.Forms.Xaml.UnitTests.Gh2632"
|
||||
xmlns:local="clr-namespace:Xamarin.Forms.Xaml.UnitTests"
|
||||
x:Name="Page">
|
||||
<Label Text="{Binding BindingContext.Foo, Source={x:Reference Page}}" />
|
||||
</local:Gh2632Base>
|
|
@ -0,0 +1,59 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Core.UnitTests;
|
||||
|
||||
namespace Xamarin.Forms.Xaml.UnitTests
|
||||
{
|
||||
public class Gh2632Base : ContentPage
|
||||
{
|
||||
public new Gh2632Context BindingContext {
|
||||
get => base.BindingContext as Gh2632Context;
|
||||
set => base.BindingContext = value;
|
||||
}
|
||||
|
||||
public class Gh2632Context
|
||||
{
|
||||
public string Foo { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Gh2632 : Gh2632Base
|
||||
{
|
||||
public Gh2632()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public Gh2632(bool useCompiledXaml)
|
||||
{
|
||||
//this stub will be replaced at compile time
|
||||
}
|
||||
|
||||
|
||||
[TestFixture]
|
||||
class Tests
|
||||
{
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Device.PlatformServices = new MockPlatformServices();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
Device.PlatformServices = null;
|
||||
}
|
||||
|
||||
[TestCase(false), TestCase(true)]
|
||||
public void BindingDoesNotThrowOnRedefinedProperty(bool useCompiledXaml)
|
||||
{
|
||||
var layout = new Gh2632(useCompiledXaml);
|
||||
layout.BindingContext = new Gh2632Base.Gh2632Context { Foo = "foo" };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -606,6 +606,9 @@
|
|||
<Compile Include="Issues\Gh2517.xaml.cs">
|
||||
<DependentUpon>Gh2517.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Issues\Gh2632.xaml.cs">
|
||||
<DependentUpon>Gh2632.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Issues\Gh2549.xaml.cs">
|
||||
<DependentUpon>Gh2549.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
@ -1108,6 +1111,10 @@
|
|||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Issues\Gh2632.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Issues\Gh2549.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
|
|
|
@ -544,6 +544,7 @@ namespace Xamarin.Forms.Xaml
|
|||
value = null;
|
||||
var elementType = element.GetType();
|
||||
PropertyInfo propertyInfo = null;
|
||||
#if NETSTANDARD1_0
|
||||
try {
|
||||
propertyInfo = elementType.GetRuntimeProperty(localName);
|
||||
} catch (AmbiguousMatchException) {
|
||||
|
@ -553,6 +554,12 @@ namespace Xamarin.Forms.Xaml
|
|||
propertyInfo = property;
|
||||
}
|
||||
}
|
||||
#else
|
||||
while (elementType != null && propertyInfo == null) {
|
||||
propertyInfo = elementType.GetProperty(localName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.DeclaredOnly);
|
||||
elementType = elementType.BaseType;
|
||||
}
|
||||
#endif
|
||||
MethodInfo getter;
|
||||
targetProperty = propertyInfo;
|
||||
if (propertyInfo == null || !propertyInfo.CanRead || (getter = propertyInfo.GetMethod) == null)
|
||||
|
|
Загрузка…
Ссылка в новой задаче