* Removed obsolete members

* Fixed a few build errors

* Map renderer build fix

* 2 WPF build fixes

* Removed more IPlatform mentions

* Removed Platform from Tizen FormsApplication

* Removed font property usage from tizen label renderer

* UAP label font build fix

* Resolved conflicts

* Add back the bits for XamlC

* Remove a few more obsolete items

* Color type removed

* Add the new .ctors

* Fix XAML tests

(possibly)

* Add back ctor

* Add back [PortHandler]

* Keep

* Remove tests for removed properties

* Remove previewer tests

* Fix tests

* Make sure it is a string

* Ignore some tests for now

Logged here: https://github.com/xamarin/Xamarin.Forms/issues/13815

* revert font changes

* Add back required method

* Removed test that no longer is valid

* Fix a few more tests

* Oops

* The shims seem to break automation

Co-authored-by: Domagoj Medo <domagojmedo@gmail.com>
Co-authored-by: Domagoj Medo <domagoj.medo@moberg.is>
Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
This commit is contained in:
Matthew Leibowitz 2021-02-21 20:41:32 +02:00 коммит произвёл GitHub
Родитель 505fc4b41b
Коммит b3eebf6da5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
255 изменённых файлов: 696 добавлений и 3962 удалений

Просмотреть файл

@ -23,6 +23,10 @@ namespace Xamarin.Forms.ControlGallery.Android
public class _51173CustomImageRenderer : ImageRenderer
#pragma warning restore 618
{
public _51173CustomImageRenderer(Context context) : base(context)
{
}
protected override async Task TryUpdateBitmap(Image previous = null)
{
try

Просмотреть файл

@ -185,9 +185,7 @@ namespace Xamarin.Forms.ControlGallery.Android
FlyoutPage _page;
bool _disposed;
#pragma warning disable 618
public NativeDroidFlyoutPage()
#pragma warning restore 618
public NativeDroidFlyoutPage(Context context) : base(context)
{
System.Diagnostics.Debug.WriteLine($">>>>> NativeDroidMasterDetail NativeDroidMasterDetail 53: This is the obsolete constructor being selected");
}
@ -259,9 +257,7 @@ namespace Xamarin.Forms.ControlGallery.Android
public class NativeListViewRenderer : ViewRenderer<NativeListView, global::Android.Widget.ListView>
{
#pragma warning disable 618
public NativeListViewRenderer()
#pragma warning restore 618
public NativeListViewRenderer(Context context) : base(context)
{
}
@ -446,19 +442,14 @@ namespace Xamarin.Forms.ControlGallery.Android
public class NativeAndroidListViewRenderer : ViewRenderer<NativeListView2, global::Android.Widget.ListView>
{
#pragma warning disable 618
public NativeAndroidListViewRenderer()
#pragma warning restore 618
public NativeAndroidListViewRenderer(Context context) : base(context)
{
}
protected override global::Android.Widget.ListView CreateNativeControl()
{
#pragma warning disable 618
// Disabled the warning so we have a test that this obsolete stuff still works
return new global::Android.Widget.ListView(Forms.Context);
#pragma warning restore 618
return new global::Android.Widget.ListView(Context);
}
protected override void OnElementChanged(ElementChangedEventArgs<NativeListView2> e)
@ -613,10 +604,8 @@ namespace Xamarin.Forms.ControlGallery.Android
[Preserve]
public class CustomContentRenderer : ViewRenderer
{
#pragma warning disable 618
[Preserve]
public CustomContentRenderer()
#pragma warning restore 618
public CustomContentRenderer(Context context) : base(context)
{
AutoPackage = true;
}
@ -932,6 +921,10 @@ namespace Xamarin.Forms.ControlGallery.Android
public class NoFlashTestNavigationPage
: Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer
{
public NoFlashTestNavigationPage(Context context) : base(context)
{
}
#if !FORMS_APPLICATION_ACTIVITY
protected override void SetupPageTransition(FragmentTransaction transaction, bool isPush)
{
@ -948,6 +941,10 @@ namespace Xamarin.Forms.ControlGallery.Android
bool _disposed;
NavigationPage _page;
public QuickCollectNavigationPageRenderer(Context context) : base(context)
{
}
protected override void OnElementChanged(ElementChangedEventArgs<NavigationPage> e)
{
base.OnElementChanged(e);

Просмотреть файл

@ -1,3 +1,4 @@
using Android.Content;
using Xamarin.Forms.Controls;
using Xamarin.Forms.Platform.Android;
@ -12,6 +13,10 @@ namespace Xamarin.Forms.ControlGallery.Android
#endif
#pragma warning restore 618
{
public DisposeLabelRenderer(Context context) : base(context)
{
}
protected override void Dispose (bool disposing)
{

Просмотреть файл

@ -1,12 +1,15 @@
using Android.Content;
using Xamarin.Forms.Controls;
using Xamarin.Forms.Platform.Android;
namespace Xamarin.Forms.ControlGallery.Android
{
#pragma warning disable 618
public class DisposePageRenderer : PageRenderer
#pragma warning restore 618
{
public DisposePageRenderer(Context context) : base(context)
{
}
protected override void Dispose (bool disposing)
{
if (disposing) {

Просмотреть файл

@ -71,9 +71,7 @@ namespace Xamarin.Forms.Controls.Issues
{
var jobId = new Label
{
#pragma warning disable 618
Font = Font.SystemFontOfSize(20),
#pragma warning restore 618
FontSize = 20,
WidthRequest = 105,
VerticalOptions = LayoutOptions.Center,
@ -93,9 +91,7 @@ namespace Xamarin.Forms.Controls.Issues
{
WidthRequest = 45,
VerticalOptions = LayoutOptions.Center,
#pragma warning disable 618
XAlign = TextAlignment.End,
#pragma warning restore 618
HorizontalTextAlignment = TextAlignment.End,
HorizontalOptions = LayoutOptions.EndAndExpand,
};

Просмотреть файл

@ -73,21 +73,14 @@ namespace Xamarin.Forms.Controls.Issues
Text = "Change Item Color",
Command = new Command(() =>
{
#pragma warning disable CS0618 // Type or member is obsolete
if (On<Android>().GetBarItemColor() == Color.Default)
#pragma warning restore CS0618 // Type or member is obsolete
if (On<Android>().Element.UnselectedTabColor == Color.Default)
{
#pragma warning disable CS0618 // Type or member is obsolete
On<Android>().SetBarItemColor(new Color(0, 255, 0, 128));
#pragma warning restore CS0618 // Type or member is obsolete
On<Android>().Element.UnselectedTabColor =new Color(0, 255, 0, 128);
btnChangeBarItemColorText.Text = $"Item Color: Less Green";
}
else
{
#pragma warning disable CS0618 // Type or member is obsolete
On<Android>().SetBarItemColor(Color.Default);
#pragma warning restore CS0618 // Type or member is obsolete
On<Android>().Element.UnselectedTabColor = Color.Default;
btnChangeBarItemColorText.Text = $"Item Color: Default";
}
})
@ -99,21 +92,14 @@ namespace Xamarin.Forms.Controls.Issues
Text = "Change Selected Item Color",
Command = new Command(() =>
{
#pragma warning disable CS0618 // Type or member is obsolete
if (On<Android>().GetBarSelectedItemColor() == Color.Default)
#pragma warning restore CS0618 // Type or member is obsolete
if (On<Android>().Element.SelectedTabColor == Color.Default)
{
#pragma warning disable CS0618 // Type or member is obsolete
On<Android>().SetBarSelectedItemColor(Color.Green);
#pragma warning restore CS0618 // Type or member is obsolete
On<Android>().Element.SelectedTabColor =Color.Green;
btnChangeBarSelectedItemColorText.Text = $"Selected Item Color: Green";
}
else
{
#pragma warning disable CS0618 // Type or member is obsolete
On<Android>().SetBarSelectedItemColor(Color.Default);
#pragma warning restore CS0618 // Type or member is obsolete
On<Android>().Element.SelectedTabColor= Color.Default;
btnChangeBarSelectedItemColorText.Text = $"Selected Item Color: Default";
}
})

Просмотреть файл

@ -5,13 +5,13 @@
<StackLayout Spacing="10">
<Button BackgroundColor="Color.Gray" Text="Click Me"></Button>
<Button BackgroundColor="Color.Gray" Image="coffee.png"></Button>
<Button BackgroundColor="Color.Gray" Image="coffee.png" Text="Click Me"></Button>
<Button BackgroundColor="Color.Gray" Image="coffee.png" Text="Click Me" ContentLayout="Top,10"></Button>
<Button BackgroundColor="Color.Gray" Image="coffee.png" Text="Click Me" ContentLayout="Bottom,10"></Button>
<Button BackgroundColor="Color.Gray" Image="coffee.png" Text="Click Me" ContentLayout="Right"></Button>
<Button BackgroundColor="Color.Gray" ImageSource="coffee.png"></Button>
<Button BackgroundColor="Color.Gray" ImageSource="coffee.png" Text="Click Me"></Button>
<Button BackgroundColor="Color.Gray" ImageSource="coffee.png" Text="Click Me" ContentLayout="Top,10"></Button>
<Button BackgroundColor="Color.Gray" ImageSource="coffee.png" Text="Click Me" ContentLayout="Bottom,10"></Button>
<Button BackgroundColor="Color.Gray" ImageSource="coffee.png" Text="Click Me" ContentLayout="Right"></Button>
<Button HeightRequest="125" WidthRequest="200" BackgroundColor="Lime" Image="coffee.png" HorizontalOptions="Center" VerticalOptions="Center"/>
<Button HeightRequest="125" WidthRequest="200" BackgroundColor="Lime" ImageSource="coffee.png" HorizontalOptions="Center" VerticalOptions="Center"/>
</StackLayout>
</ContentPage>

Просмотреть файл

@ -20,9 +20,7 @@ namespace Xamarin.Forms.Controls.Issues
VerticalOptions = LayoutOptions.FillAndExpand,
Children = {
new Label {
#pragma warning disable 618
XAlign = TextAlignment.Center,
#pragma warning restore 618
HorizontalTextAlignment = TextAlignment.Center,
Text = "Tap input field, then try to scroll"
},
new WebView {

Просмотреть файл

@ -98,9 +98,7 @@ namespace Xamarin.Forms.Controls.Issues
for (var i = 0; i < 100; i++)
sb.Append("View 1a with ScrollView +++ ");
#pragma warning disable 618
var label = new Label { Text = sb.ToString(), HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, XAlign = TextAlignment.Center, };
#pragma warning restore 618
var label = new Label { Text = sb.ToString(), HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, HorizontalTextAlignment = TextAlignment.Center, };
scrollView.Content = label;
@ -125,9 +123,7 @@ namespace Xamarin.Forms.Controls.Issues
for (var i = 0; i < 50; i++)
sb.Append("View 1b with ScrollView and recreation of content +++++ ");
#pragma warning disable 618
var label = new Label { Text = sb.ToString(), HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, XAlign = TextAlignment.Center, };
#pragma warning restore 618
var label = new Label { Text = sb.ToString(), HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, HorizontalTextAlignment = TextAlignment.Center, };
scrollView.Content = label;
@ -141,9 +137,7 @@ namespace Xamarin.Forms.Controls.Issues
public View2()
{
BackgroundColor = Color.Teal;
#pragma warning disable 618
Content = new Label { Text = "View 2", HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, XAlign = TextAlignment.Center, };
#pragma warning restore 618
Content = new Label { Text = "View 2", HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, HorizontalTextAlignment = TextAlignment.Center, };
}
}

Просмотреть файл

@ -38,9 +38,7 @@ namespace Xamarin.Forms.Controls.Issues
Text = "Add pins",
Command = new Command (() => {
foreach (var pin in map.Pins) {
#pragma warning disable CS0618
pin.Clicked -= PinClicked;
#pragma warning restore CS0618
pin.MarkerClicked -= PinClicked;
}
map.Pins.Clear ();
@ -61,9 +59,9 @@ namespace Xamarin.Forms.Controls.Issues
Type = PinType.Place,
Position = new Position (map.VisibleRegion.Center.Latitude + lat, map.VisibleRegion.Center.Longitude + lng)
};
#pragma warning disable CS0618
pin.Clicked += PinClicked;
#pragma warning restore CS0618
pin.MarkerClicked += PinClicked;
map.Pins.Add (pin);
}
})

Просмотреть файл

@ -1,146 +0,0 @@
using System;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
using Xamarin.Forms.Core.UITests;
#endif
namespace Xamarin.Forms.Controls.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 29247, "iOS Device.OpenUri breaks with encoded params", PlatformAffected.iOS, issueTestNumber: 1)]
#if UITEST
[Category(Core.UITests.UITestCategories.Bugzilla)]
// this doesn't fail on Uwp but it leaves a browser window open and breaks later tests
[Category(UITestCategories.UwpIgnore)]
#endif
public class Bugzilla29247 : TestContentPage
{
protected override void Init()
{
Content = new StackLayout
{
VerticalOptions = LayoutOptions.Center,
Children = {
new Label {
#pragma warning disable 618
XAlign = TextAlignment.Center,
#pragma warning restore 618
Text = "Welcome to Xamarin Forms!"
},
new Button {
Text = "Without Params (Works)",
AutomationId = "btnOpenUri1",
#pragma warning disable CS0618 // Type or member is obsolete
Command = new Command (() => Device.OpenUri (new Uri ("http://www.bing.com")))
#pragma warning restore CS0618 // Type or member is obsolete
}
}
};
}
#if UITEST
protected override bool Isolate => true;
[Test]
public void Bugzilla29247Test()
{
RunningApp.WaitForElement(q => q.Marked("btnOpenUri1"));
RunningApp.Tap(q => q.Marked("btnOpenUri1"));
}
#endif
}
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 29247, "iOS Device.OpenUri breaks with encoded params 2", PlatformAffected.iOS, issueTestNumber: 2)]
#if UITEST
// This one isn't failing on UWP but it opens a browser window
// and causes the rest to fail
[Category(UITestCategories.UwpIgnore)]
#endif
public class Bugzilla29247_2 : TestContentPage
{
protected override void Init()
{
Content = new StackLayout
{
VerticalOptions = LayoutOptions.Center,
Children = {
new Label {
#pragma warning disable 618
XAlign = TextAlignment.Center,
#pragma warning restore 618
Text = "Welcome to Xamarin Forms!"
},
new Button {
Text = "With encoded Params (Breaks)",
AutomationId = "btnOpenUri2",
#pragma warning disable CS0618 // Type or member is obsolete
Command = new Command (() => Device.OpenUri (new Uri ("http://www.bing.com/search?q=xamarin%20bombs%20on%20this")))
#pragma warning restore CS0618 // Type or member is obsolete
}
}
};
}
#if UITEST
protected override bool Isolate => true;
[Test]
public void Bugzilla29247EncodedParamsTest()
{
RunningApp.WaitForElement(q => q.Marked("btnOpenUri2"));
RunningApp.Tap(q => q.Marked("btnOpenUri2"));
}
#endif
}
#if UITEST
// This one isn't failing on UWP but it opens a browser window
// and causes the rest to fail
[Category(UITestCategories.UwpIgnore)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 29247, "iOS Device.OpenUri breaks with encoded params 3", PlatformAffected.iOS, issueTestNumber: 3)]
public class Bugzilla29247_3 : TestContentPage
{
protected override void Init()
{
Content = new StackLayout
{
VerticalOptions = LayoutOptions.Center,
Children = {
new Label {
#pragma warning disable 618
XAlign = TextAlignment.Center,
#pragma warning restore 618
Text = "Welcome to Xamarin Forms!"
},
new Button {
Text = "With decoded Params (Breaks)",
AutomationId = "btnOpenUri3",
#pragma warning disable CS0618 // Type or member is obsolete
Command = new Command (() => Device.OpenUri (new Uri ("http://www.bing.com/search?q=xamarin bombs on this")))
#pragma warning restore CS0618 // Type or member is obsolete
}
}
};
}
#if UITEST
protected override bool Isolate => true;
[Test]
public void Bugzilla29247DecodeParamsTest()
{
RunningApp.WaitForElement(q => q.Marked("btnOpenUri3"));
RunningApp.Tap(q => q.Marked("btnOpenUri3"));
}
#endif
}
}

Просмотреть файл

@ -24,9 +24,7 @@ namespace Xamarin.Forms.Controls.Issues
{
Children = {
new Label {
#pragma warning disable 618
XAlign = TextAlignment.Center,
#pragma warning restore 618
HorizontalTextAlignment = TextAlignment.Center,
Text = "Page 1"
}
}
@ -36,9 +34,7 @@ namespace Xamarin.Forms.Controls.Issues
{
Children = {
new Label {
#pragma warning disable 618
XAlign = TextAlignment.Center,
#pragma warning restore 618
HorizontalTextAlignment = TextAlignment.Center,
Text = "Page 2"
}
}

Просмотреть файл

@ -34,11 +34,9 @@ namespace Xamarin.Forms.Controls.Issues
Content = new StackLayout
{
Children = {
btn,
#pragma warning disable 618
new Label {Text = "GeneratedImage", Font=Font.BoldSystemFontOfSize(NamedSize.Medium)},
#pragma warning restore 618
generatedImage
btn,
new Label {Text = "GeneratedImage", FontAttributes = FontAttributes.Bold, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) },
generatedImage
},
Padding = new Thickness(0, 20, 0, 0),
VerticalOptions = LayoutOptions.StartAndExpand,

Просмотреть файл

@ -247,9 +247,7 @@ namespace Xamarin.Forms.Controls.Issues
_secondaryLabel = new Label() { HeightRequest = 40, FontSize = 16, TranslationY = -5, LineBreakMode = LineBreakMode.TailTruncation };
_secondaryLabel.SetBinding(Label.TextProperty, "SecondaryLabelText");
#pragma warning disable 618
_distanceLabel = new Label() { XAlign = TextAlignment.End, HorizontalOptions = LayoutOptions.EndAndExpand, FontSize = 11, LineBreakMode = LineBreakMode.NoWrap };
#pragma warning restore 618
_distanceLabel = new Label() { HorizontalTextAlignment = TextAlignment.End, HorizontalOptions = LayoutOptions.EndAndExpand, FontSize = 11, LineBreakMode = LineBreakMode.NoWrap };
_distanceLabel.SetBinding(Label.TextProperty, "OtherLabelText");
_statusCircle = new Label()

Просмотреть файл

@ -23,12 +23,9 @@ namespace Xamarin.Forms.Controls.Issues
stack.Children.Add(new Label()
{
VerticalOptions =
#pragma warning disable 618
LayoutOptions.Center,
XAlign = TextAlignment.Center,
VerticalOptions = LayoutOptions.Center,
HorizontalTextAlignment = TextAlignment.Center,
Text = "Page 1"
#pragma warning restore 618
});
Content = stack;

Просмотреть файл

@ -33,9 +33,7 @@ namespace Xamarin.Forms.Controls.Issues
};
var entryCell = new EntryCell { Text = "yaddayadda" };
#pragma warning disable 618
entryCell.XAlign = TextAlignment.End;
#pragma warning restore 618
entryCell.HorizontalTextAlignment = TextAlignment.End;
entryCell.Label = "Click Here";
entryCell.Tapped += (s, e) =>
{

Просмотреть файл

@ -21,9 +21,7 @@ namespace Xamarin.Forms.Controls.Issues
protected override void Init()
{
#pragma warning disable 618
var label = new Label() { XAlign = TextAlignment.Center };
#pragma warning restore 618
var label = new Label() { HorizontalTextAlignment = TextAlignment.Center };
var image = new Image();
image.PropertyChanged += (sender, e) =>

Просмотреть файл

@ -1,92 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
using Xamarin.UITest.iOS;
using Xamarin.Forms.Core.UITests;
#endif
namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
[NUnit.Framework.Category(Core.UITests.UITestCategories.Bugzilla)]
[NUnit.Framework.Category(Core.UITests.UITestCategories.UwpIgnore)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 34561, "[A] Navigation.PushAsync crashes when used in Context Actions (legacy)", PlatformAffected.Android)]
public class Bugzilla34561 : TestContentPage
{
protected override void Init()
{
var listView = new ListView()
{
ItemsSource = new List<string> { "item" },
ItemTemplate = new DataTemplate(typeof(ContextActionTemplate))
};
Content = listView;
}
[Preserve(AllMembers = true)]
public class NextPage : TestContentPage
{
protected override void Init()
{
Content = new Label
{
AutomationId = "NextPageLabel",
Text = "See if I'm here"
};
}
}
[Preserve(AllMembers = true)]
public class ContextActionTemplate : ViewCell
{
public ContextActionTemplate()
{
MenuItem newMenuItem = new MenuItem { Text = "Click" };
newMenuItem.Clicked += NewMenuItem_Clicked;
ContextActions.Add(newMenuItem);
View = new StackLayout
{
Children = {
new Label {
Text = "Click and hold",
AutomationId = "ListViewItem",
VerticalOptions = LayoutOptions.Center,
HorizontalOptions = LayoutOptions.Center
}
}
};
}
void NewMenuItem_Clicked(object sender, EventArgs e)
{
#pragma warning disable 618
ParentView.Navigation.PushAsync(new NextPage(), false);
#pragma warning restore 618
}
}
#if UITEST
[Test]
public void Bugzilla34561Test()
{
RunningApp.WaitForElement(q => q.Marked("ListViewItem"));
RunningApp.ActivateContextMenu("ListViewItem");
RunningApp.WaitForElement(q => q.Marked("Click"));
RunningApp.Tap(q => q.Marked("Click"));
RunningApp.WaitForElement(q => q.Marked("NextPageLabel"));
RunningApp.Screenshot("I see the next page");
}
#endif
}
}

Просмотреть файл

@ -23,9 +23,8 @@ namespace Xamarin.Forms.Controls.Issues
Label header = new Label
{
Text = "Should not see blue",
#pragma warning disable 618
Font = Font.BoldSystemFontOfSize(40),
#pragma warning restore 618
FontSize = 40,
FontAttributes = FontAttributes.Bold,
HorizontalOptions = LayoutOptions.Center,
TextColor = Color.Black
};

Просмотреть файл

@ -6,14 +6,15 @@
<local:TestContentPage.Resources>
<ResourceDictionary>
<OnPlatform
x:Key="SizeMedium"
x:TypeArguments="x:Double"
iOS="40"
Android="30"
WinPhone="60" />
<OnPlatform
x:Key="SizeMedium"
x:TypeArguments="x:Double">
<On Platform="iOS" Value="40"/>
<On Platform="Android" Value="30"/>
<On Platform="UWP" Value="60"/>
</OnPlatform>
<x:Double x:Key="SizeLarge">80</x:Double>
<x:Double x:Key="SizeLarge">80</x:Double>
</ResourceDictionary>
</local:TestContentPage.Resources>
@ -24,11 +25,12 @@
<Label Text="If there is a blue box and a red box below, this test has passed. If the application crashes, the test has not passed."></Label>
<BoxView HorizontalOptions="Center" VerticalOptions="Center" BackgroundColor="Blue" WidthRequest="{StaticResource SizeMedium}">
<BoxView.HeightRequest>
<OnPlatform
x:TypeArguments="x:Double"
iOS="40"
Android="30"
WinPhone="60" />
<OnPlatform
x:TypeArguments="x:Double">
<On Platform="iOS" Value="40"/>
<On Platform="Android" Value="30"/>
<On Platform="UWP" Value="60"/>
</OnPlatform>
</BoxView.HeightRequest>
</BoxView>
<BoxView HorizontalOptions="Center" VerticalOptions="Center" BackgroundColor="Red" WidthRequest="{StaticResource SizeLarge}">

Просмотреть файл

@ -16,9 +16,7 @@ namespace Xamarin.Forms.Controls.Issues
{
public RoundedButton(int radius)
{
#pragma warning disable 0618
base.BorderRadius = radius;
#pragma warning restore
base.CornerRadius = radius;
base.WidthRequest = 2 * radius;
base.HeightRequest = 2 * radius;
HorizontalOptions = LayoutOptions.Center;
@ -30,22 +28,18 @@ namespace Xamarin.Forms.Controls.Issues
//Image = new FileImageSource { File = "crimson.jpg" };
}
public new int BorderRadius
public new int CornerRadius
{
get
{
#pragma warning disable 0618
return base.BorderRadius;
#pragma warning restore
return base.CornerRadius;
}
set
{
base.WidthRequest = 2 * value;
base.HeightRequest = 2 * value;
#pragma warning disable 0618
base.BorderRadius = value;
#pragma warning restore
base.CornerRadius = value;
}
}
@ -60,9 +54,7 @@ namespace Xamarin.Forms.Controls.Issues
{
base.WidthRequest = value;
base.HeightRequest = value;
#pragma warning disable 0618
base.BorderRadius = ((int)value) / 2;
#pragma warning restore
base.CornerRadius = ((int)value) / 2;
}
}
@ -77,9 +69,7 @@ namespace Xamarin.Forms.Controls.Issues
{
base.WidthRequest = value;
base.HeightRequest = value;
#pragma warning disable 0618
base.BorderRadius = ((int)value) / 2;
#pragma warning restore
base.CornerRadius = ((int)value) / 2;
}
}
}

Просмотреть файл

@ -1,50 +0,0 @@
using System.Threading.Tasks;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
using Xamarin.Forms.Core.UITests;
#endif
namespace Xamarin.Forms.Controls.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 60691, "Device.OpenUri(new Uri(\"tel: 123 456\")) crashes the app (space in phone number)", PlatformAffected.iOS)]
#if UITEST
// this doesn't fail on Uwp but it leaves a browser window open and breaks later tests
[Category(UITestCategories.UwpIgnore)]
[NUnit.Framework.Category(Core.UITests.UITestCategories.Bugzilla)]
#endif
public class Bugzilla60691 : TestContentPage
{
protected override void Init()
{
Content = new StackLayout
{
Children = {
#pragma warning disable CS0618 // Type or member is obsolete
new Button { Text = "Call 123 4567", AutomationId = "tel", Command = new Command(() => Device.OpenUri(new System.Uri("tel:123 4567"))) },
new Button { Text = "Mail support@xamarin.com", AutomationId = "mailto", Command = new Command(() => Device.OpenUri(new System.Uri("mailto:support@xamarin.com"))) }
#pragma warning restore CS0618 // Type or member is obsolete
}
};
}
#if UITEST
protected override bool Isolate => true;
[Test]
[Ignore("This test opens a system dialog in iOS11+ that cannot be dismissed by UITest and covers subsequent tests.")]
public async Task Bugzilla60691_Tel()
{
RunningApp.WaitForElement(q => q.Marked("tel"));
RunningApp.Tap(q => q.Marked("tel"));
await Task.Delay(500);
RunningApp.Screenshot("Should have loaded phone with 123-4567");
}
#endif
}
}

Просмотреть файл

@ -68,14 +68,10 @@ namespace Xamarin.Forms.Controls.Issues
if (s_mImgRenewal == null)
s_mImgRenewal = ImageSource.FromFile("bank.png");
#pragma warning disable 618
var label1 = new Label { Text = "Label 1", Font = Font.SystemFontOfSize(NamedSize.Small, FontAttributes.Bold) };
#pragma warning restore 618
var label1 = new Label { Text = "Label 1", FontAttributes = FontAttributes.Bold, FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)) };
label1.SetBinding(Label.TextProperty, new Binding("."));
#pragma warning disable 618
var label2 = new Label { Text = "Label 2", Font = Font.SystemFontOfSize(NamedSize.Small) };
#pragma warning restore 618
var label2 = new Label { Text = "Label 2", FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)) };
// was ListButton?
var button = new Button
@ -89,9 +85,7 @@ namespace Xamarin.Forms.Controls.Issues
{
var b = (Button)sender;
var t = b.CommandParameter;
#pragma warning disable 618
((ContentPage)((ListView)((StackLayout)b.ParentView).ParentView).ParentView).DisplayAlert("Clicked",
#pragma warning restore 618
((ContentPage)((ListView)((StackLayout)b.Parent).Parent).Parent).DisplayAlert("Clicked",
t + " button was clicked", "OK");
Debug.WriteLine("clicked" + t);
};

Просмотреть файл

@ -32,9 +32,7 @@ namespace Xamarin.Forms.Controls.Issues
Text = "Subscribe with LinkedIn",
WidthRequest = 262,
HorizontalOptions = LayoutOptions.Center,
#pragma warning disable 0618
BorderRadius = 0,
#pragma warning restore
CornerRadius = 0,
},
new Entry {
Placeholder = "Professional email",
@ -75,20 +73,13 @@ namespace Xamarin.Forms.Controls.Issues
Text = "Create an account",
WidthRequest = 262,
HorizontalOptions = LayoutOptions.Center,
#pragma warning disable 0618
BorderRadius = 0,
#pragma warning restore
CornerRadius = 0,
},
new Label {
Text = "by subscribing, you accept the general conditions.",
TextColor = Color.White,
#pragma warning disable 618
XAlign = TextAlignment.Center,
#pragma warning restore 618
#pragma warning disable 618
Font = Font.SystemFontOfSize (NamedSize.Micro),
#pragma warning restore 618
HorizontalTextAlignment = TextAlignment.Center,
FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)),
WidthRequest = 262,
HorizontalOptions = LayoutOptions.Center,
},

Просмотреть файл

@ -32,9 +32,8 @@ namespace Xamarin.Forms.Controls.Issues
Label header = new Label
{
Text = "Picker",
#pragma warning disable 618
Font = Font.BoldSystemFontOfSize(50),
#pragma warning restore 618
FontAttributes = FontAttributes.Bold,
FontSize = 50,
HorizontalOptions = LayoutOptions.Center
};
@ -46,7 +45,7 @@ namespace Xamarin.Forms.Controls.Issues
foreach (string color in new string[]
{
"Aqua", "Black", "Blue", "Fuschia",
"Aqua", "Black", "Blue", "Fuchsia",
"Gray", "Green", "Lime", "Maroon",
"Navy", "Olive", "Purple", "Red",
"Silver", "Teal", "White", "Yellow"

Просмотреть файл

@ -34,14 +34,10 @@ namespace Xamarin.Forms.Controls.Issues
grid.Children.Add(label = new Label(), 0, 1);
label.SetBinding(Label.TextProperty, "LastName");
#pragma warning disable 618
grid.Children.Add(label = new Label { XAlign = TextAlignment.End }, 1, 0);
#pragma warning restore 618
grid.Children.Add(label = new Label { HorizontalTextAlignment = TextAlignment.End }, 1, 0);
label.SetBinding(Label.TextProperty, "Zip");
#pragma warning disable 618
grid.Children.Add(label = new Label { XAlign = TextAlignment.End }, 1, 1);
#pragma warning restore 618
grid.Children.Add(label = new Label { VerticalTextAlignment = TextAlignment.End }, 1, 1);
label.SetBinding(Label.TextProperty, "City");
View = grid;

Просмотреть файл

@ -19,17 +19,10 @@ namespace Xamarin.Forms.Controls.Issues
grid.Children.Add(new Label
{
Opacity = .75,
#pragma warning disable 618
YAlign = TextAlignment.Start,
#pragma warning restore 618
#pragma warning disable 618
XAlign = TextAlignment.End,
#pragma warning restore 618
VerticalTextAlignment = TextAlignment.Start,
HorizontalTextAlignment = TextAlignment.End,
Text = "top and flush right",
#pragma warning disable 618
Font = Font.SystemFontOfSize(NamedSize.Large),
#pragma warning restore 618
FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
VerticalOptions = LayoutOptions.Start,
HorizontalOptions = LayoutOptions.End,
HeightRequest = 30,
@ -38,13 +31,9 @@ namespace Xamarin.Forms.Controls.Issues
grid.Children.Add(new Label
{
Opacity = .75,
#pragma warning disable 618
YAlign = TextAlignment.End,
#pragma warning restore 618
VerticalTextAlignment = TextAlignment.End,
Text = "bottom and flush left",
#pragma warning disable 618
Font = Font.SystemFontOfSize(NamedSize.Large),
#pragma warning restore 618
FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
VerticalOptions = LayoutOptions.End,
HeightRequest = 40,
TextColor = Color.White,

Просмотреть файл

@ -108,14 +108,10 @@ namespace Xamarin.Forms.Controls.Issues
{
public ModuleMediaListItemTemplate()
{
#pragma warning disable 618
var title = new Label { YAlign = TextAlignment.Center };
#pragma warning restore 618
var title = new Label { VerticalTextAlignment = TextAlignment.Center };
title.SetBinding(Label.TextProperty, new Binding("Title", BindingMode.OneWay));
#pragma warning disable 618
var description = new Label { YAlign = TextAlignment.Center };
#pragma warning restore 618
var description = new Label { VerticalTextAlignment = TextAlignment.Center };
description.SetBinding(Label.TextProperty, new Binding("Description", BindingMode.OneWay));
View = new StackLayout
@ -132,9 +128,7 @@ namespace Xamarin.Forms.Controls.Issues
{
public ModuleMediaListHeaderTemplate()
{
#pragma warning disable 618
var title = new Label { TextColor = Color.White, YAlign = TextAlignment.Center };
#pragma warning restore 618
var title = new Label { TextColor = Color.White, VerticalTextAlignment = TextAlignment.Center };
title.SetBinding(Label.TextProperty, new Binding("SectionName", BindingMode.OneWay));
View = new StackLayout

Просмотреть файл

@ -19,9 +19,7 @@ namespace Xamarin.Forms.Controls.Issues
var title = new Label
{
Text = "Select League",
#pragma warning disable 618
Font = Font.SystemFontOfSize(NamedSize.Large),
#pragma warning restore 618
FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
TextColor = Color.White
};
@ -30,9 +28,7 @@ namespace Xamarin.Forms.Controls.Issues
var seasonLabel = new Label
{
Text = "Season",
#pragma warning disable 618
Font = Font.SystemFontOfSize(NamedSize.Small),
#pragma warning restore 618
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
TextColor = Color.White
};
@ -58,9 +54,7 @@ namespace Xamarin.Forms.Controls.Issues
var sportLabel = new Label
{
Text = "Sport",
#pragma warning disable 618
Font = Font.SystemFontOfSize(NamedSize.Small),
#pragma warning restore 618
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
TextColor = Color.White
};
@ -117,9 +111,7 @@ namespace Xamarin.Forms.Controls.Issues
{
var leagueName = new Label
{
#pragma warning disable 618
Font = Font.SystemFontOfSize(NamedSize.Large),
#pragma warning restore 618
FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
BackgroundColor = Color.Transparent,
TextColor = Color.White,
VerticalOptions = LayoutOptions.CenterAndExpand,

Просмотреть файл

@ -78,10 +78,8 @@ namespace Xamarin.Forms.Controls.Issues
new Label () {
Text = title,
VerticalOptions = LayoutOptions.CenterAndExpand,
#pragma warning disable 618
Font = Font.SystemFontOfSize (NamedSize.Large,
#pragma warning restore 618
FontAttributes.Bold)
FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
FontAttributes = FontAttributes.Bold
}
}
};

Просмотреть файл

@ -34,17 +34,10 @@ namespace Xamarin.Forms.Controls.Issues
var name = new Label
{
Text = "Foo",
#pragma warning disable 618
XAlign = TextAlignment.Center,
#pragma warning restore 618
#pragma warning disable 618
YAlign = TextAlignment.Center,
#pragma warning restore 618
#pragma warning disable 618
Font = Font.SystemFontOfSize(30, FontAttributes.Bold),
#pragma warning restore 618
HorizontalTextAlignment = TextAlignment.Center,
VerticalTextAlignment = TextAlignment.Center,
FontSize = 30,
FontAttributes = FontAttributes.Bold,
TextColor = Color.White,
};
@ -61,13 +54,8 @@ namespace Xamarin.Forms.Controls.Issues
var addressLabel = new Label
{
Text = "Loading address…",
#pragma warning disable 618
XAlign = TextAlignment.Center,
#pragma warning restore 618
#pragma warning disable 618
YAlign = TextAlignment.Center,
#pragma warning restore 618
HorizontalTextAlignment = TextAlignment.Center,
VerticalTextAlignment = TextAlignment.Center,
};
var map = new Map

Просмотреть файл

@ -8,7 +8,7 @@
<Label Text="HEADER" Font="40" />
</StackLayout>
<StackLayout Padding="22,0,22,22">
<Label x:Name="productNameLabel" Text="TESTING 345" XAlign="Center" YAlign="Center" TextColor="#808080"></Label>
<Label x:Name="productNameLabel" Text="TESTING 345" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" TextColor="#808080"></Label>
<StackLayout IsClippedToBounds="true">
<ScrollView HeightRequest="980" BackgroundColor="Aqua" IsClippedToBounds="true">
<StackLayout x:Name="addonGroupStack" Spacing="1" ></StackLayout>

Просмотреть файл

@ -8,7 +8,7 @@
<Label Text="HEADER" Font="40" />
</StackLayout>
<StackLayout Padding="22,0,22,22">
<Label x:Name="productNameLabel" Text="TESTING 345" XAlign="Center" YAlign="Center" TextColor="#808080"></Label>
<Label x:Name="productNameLabel" Text="TESTING 345" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" TextColor="#808080"></Label>
<ScrollView HeightRequest="980" BackgroundColor="Aqua" IsClippedToBounds="true">
<StackLayout x:Name="addonGroupStack" Spacing="1" ></StackLayout>
</ScrollView>

Просмотреть файл

@ -25,13 +25,8 @@ namespace Xamarin.Forms.Controls.Issues
Text = "I should have red text",
TextColor = Color.Red,
BackgroundColor = new Color(0.5, 0.5, 0.5),
#pragma warning disable 618
XAlign = TextAlignment.Center,
#pragma warning restore 618
#pragma warning disable 618
YAlign = TextAlignment.Center
#pragma warning restore 618
HorizontalTextAlignment = TextAlignment.Center,
VerticalTextAlignment = TextAlignment.Center
}
};
}

Просмотреть файл

@ -116,10 +116,8 @@ namespace Xamarin.Forms.Controls.Issues
tabbedPage.Children.Add(Issue1898PageOne);
tabbedPage.Children.Add(Issue1898PageTwo);
#pragma warning disable CS0618 // Type or member is obsolete
tabbedPage.On<Android>().SetBarItemColor(Color.Blue);
tabbedPage.On<Android>().SetBarSelectedItemColor(Color.Green);
#pragma warning restore CS0618 // Type or member is obsolete
tabbedPage.On<Android>().Element.UnselectedTabColor =Color.Blue;
tabbedPage.On<Android>().Element.SelectedTabColor = Color.Green;
tabbedPage.On<Android>().SetToolbarPlacement(placement);
tabbedPage.On<WindowsOS>().SetHeaderIconsEnabled(true);
}

Просмотреть файл

@ -45,7 +45,7 @@ namespace Xamarin.Forms.Controls.Issues
new Person ("Bob", new DateTime (1976, 2, 20), Color.Black),
new Person ("Cathy", new DateTime (1977, 3, 10), Color.Blue),
#pragma warning disable 618
new Person ("David", new DateTime (1978, 4, 25), Color.Fuschia),
new Person ("David", new DateTime (1978, 4, 25), Color.Fuchsia),
#pragma warning restore 618
};

Просмотреть файл

@ -20,13 +20,8 @@ namespace Xamarin.Forms.Controls.Issues
var label = new Label
{
Text = "I should have a toolbar item",
#pragma warning disable 618
XAlign = TextAlignment.Center,
#pragma warning restore 618
#pragma warning disable 618
YAlign = TextAlignment.Center
#pragma warning restore 618
HorizontalTextAlignment = TextAlignment.Center,
VerticalTextAlignment = TextAlignment.Center
};
var refreshBtn = new ToolbarItem("Refresh", null, () => label.Text = "Clicking it works");

Просмотреть файл

@ -6,7 +6,6 @@ using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#if UITEST
@ -180,9 +179,9 @@ namespace Xamarin.Forms.Controls.Issues
//if external link is clicked
Debug.WriteLine("WebView_OnNavigating, DIfferent Uri, so open in Native Browser");
e.Cancel = true;
#pragma warning disable CS0618 // Type or member is obsolete
Device.OpenUri(new Uri(e.Url));
#pragma warning restore CS0618 // Type or member is obsolete
// TODO: not sure what to do here since there is no OpenUri anymore
// Device.OpenUri(new Uri(e.Url));
}
}
}

Просмотреть файл

@ -30,13 +30,8 @@ namespace Xamarin.Forms.Controls.Issues
Content = new Label
{
Text = "Page " + i,
#pragma warning disable 618
XAlign = TextAlignment.Center,
#pragma warning restore 618
#pragma warning disable 618
YAlign = TextAlignment.Center
#pragma warning restore 618
HorizontalTextAlignment = TextAlignment.Center,
VerticalTextAlignment = TextAlignment.Center
}
}, random.NextDouble() > 0.5);
}

Просмотреть файл

@ -39,9 +39,7 @@ namespace Xamarin.Forms.Controls.Issues
_label = new Label
{
Text = "Stepper value is 0",
#pragma warning disable 618
Font = Font.SystemFontOfSize(NamedSize.Large),
#pragma warning restore 618
FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.CenterAndExpand
};

Просмотреть файл

@ -86,9 +86,8 @@ namespace Xamarin.Forms.Controls.Issues
var lblFirstNameLabel = new Label
{
Text = "First Name",
#pragma warning disable 618
Font = Font.SystemFontOfSize(NamedSize.Medium, FontAttributes.Bold),
#pragma warning restore 618
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
FontAttributes = FontAttributes.Bold,
TextColor = textColor
};
_firstNameEntry = new Entry
@ -105,9 +104,8 @@ namespace Xamarin.Forms.Controls.Issues
var lblMiddleNameLabel = new Label
{
Text = "Middle Name",
#pragma warning disable 618
Font = Font.SystemFontOfSize(NamedSize.Medium, FontAttributes.Bold),
#pragma warning restore 618
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
FontAttributes = FontAttributes.Bold,
TextColor = textColor
};
var entMiddleName = new Entry
@ -124,9 +122,8 @@ namespace Xamarin.Forms.Controls.Issues
var lblLastNameLabel = new Label
{
Text = "Last Name",
#pragma warning disable 618
Font = Font.SystemFontOfSize(NamedSize.Medium, FontAttributes.Bold),
#pragma warning restore 618
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
FontAttributes = FontAttributes.Bold,
TextColor = textColor
};
var entLastName = new Entry
@ -143,13 +140,10 @@ namespace Xamarin.Forms.Controls.Issues
var lblDobLabel = new Label
{
Text = "Date of Birth",
#pragma warning disable 618
Font = Font.SystemFontOfSize(NamedSize.Medium, FontAttributes.Bold),
#pragma warning restore 618
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
FontAttributes = FontAttributes.Bold,
TextColor = textColor,
#pragma warning disable 618
XAlign = TextAlignment.Start
#pragma warning restore 618
HorizontalTextAlignment = TextAlignment.Start
};
var entDob = new Entry
{
@ -165,13 +159,10 @@ namespace Xamarin.Forms.Controls.Issues
var lblGenderLabel = new Label
{
Text = "Gender",
#pragma warning disable 618
Font = Font.SystemFontOfSize(NamedSize.Medium, FontAttributes.Bold),
#pragma warning restore 618
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
FontAttributes = FontAttributes.Bold,
TextColor = textColor,
#pragma warning disable 618
XAlign = TextAlignment.Start
#pragma warning restore 618
HorizontalTextAlignment = TextAlignment.Start
};
slGender.Children.Add(lblGenderLabel);
@ -182,13 +173,10 @@ namespace Xamarin.Forms.Controls.Issues
var lblHomePhoneLabel = new Label
{
Text = "Home Phone",
#pragma warning disable 618
Font = Font.SystemFontOfSize(NamedSize.Medium, FontAttributes.Bold),
#pragma warning restore 618
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
FontAttributes = FontAttributes.Bold,
TextColor = textColor,
#pragma warning disable 618
XAlign = TextAlignment.Start
#pragma warning restore 618
HorizontalTextAlignment = TextAlignment.Start
};
var entHomePhone = new Entry
{
@ -208,13 +196,10 @@ namespace Xamarin.Forms.Controls.Issues
var lblMobilePhoneLabel = new Label
{
Text = "Mobile Phone",
#pragma warning disable 618
Font = Font.SystemFontOfSize(NamedSize.Medium, FontAttributes.Bold),
#pragma warning restore 618
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
FontAttributes = FontAttributes.Bold,
TextColor = textColor,
#pragma warning disable 618
XAlign = TextAlignment.Start
#pragma warning restore 618
HorizontalTextAlignment = TextAlignment.Start
};
var entMobilePhone = new Entry
{
@ -296,49 +281,31 @@ namespace Xamarin.Forms.Controls.Issues
};
Color txtColor = Color.Blue;
Font dataFont = Font.SystemFontOfSize(NamedSize.Medium);
var fontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label));
var nameData = new Label
{
TextColor = txtColor,
#pragma warning disable 618
Font = dataFont,
#pragma warning restore 618
#pragma warning disable 618
XAlign = TextAlignment.Start,
#pragma warning restore 618
#pragma warning disable 618
YAlign = TextAlignment.Center,
#pragma warning restore 618
FontSize= fontSize,
HorizontalTextAlignment = TextAlignment.Start,
VerticalTextAlignment = TextAlignment.Center,
VerticalOptions = LayoutOptions.Center
};
nameData.SetBinding(Label.TextProperty, "Name");
var genderData = new Label
{
TextColor = txtColor,
#pragma warning disable 618
Font = dataFont,
#pragma warning restore 618
#pragma warning disable 618
XAlign = TextAlignment.Start,
#pragma warning restore 618
#pragma warning disable 618
YAlign = TextAlignment.Center,
#pragma warning restore 618
FontSize = fontSize,
HorizontalTextAlignment = TextAlignment.Start,
VerticalTextAlignment = TextAlignment.Center,
VerticalOptions = LayoutOptions.Center
};
genderData.SetBinding(Label.TextProperty, "Gender");
var slNameGender = new StackLayout { Orientation = StackOrientation.Horizontal };
#pragma warning disable 618
var lblGender1 = new Label { Text = " (", Font = dataFont };
#pragma warning restore 618
var lblGender1 = new Label { Text = " (", FontSize = fontSize };
#pragma warning disable 618
var lblGender2 = new Label { Text = ")", Font = dataFont };
#pragma warning restore 618
var lblGender2 = new Label { Text = ")", FontSize = fontSize, };
slNameGender.Children.Add(nameData);
slNameGender.Children.Add(lblGender1);
slNameGender.Children.Add(genderData);
@ -349,24 +316,15 @@ namespace Xamarin.Forms.Controls.Issues
{
TextColor = txtColor,
Text = "DOB: ",
#pragma warning disable 618
Font = Font.SystemFontOfSize(NamedSize.Medium, FontAttributes.Bold)
#pragma warning restore 618
FontSize = fontSize,
FontAttributes = FontAttributes.Bold
};
var dobData = new Label
{
TextColor = txtColor,
#pragma warning disable 618
Font = dataFont,
#pragma warning restore 618
#pragma warning disable 618
XAlign = TextAlignment.Start,
#pragma warning restore 618
#pragma warning disable 618
YAlign = TextAlignment.Center,
#pragma warning restore 618
FontSize = fontSize,
HorizontalTextAlignment = TextAlignment.Start,
VerticalTextAlignment = TextAlignment.Center,
VerticalOptions = LayoutOptions.Center
};
dobData.SetBinding(Label.TextProperty, "DateOfBirth");
@ -375,7 +333,7 @@ namespace Xamarin.Forms.Controls.Issues
slDobPhone.Children.Add(dobData);
#pragma warning disable 618
var lblSpacer = new Label { Text = " ", Font = dataFont };
var lblSpacer = new Label { Text = " ", FontSize = fontSize };
#pragma warning restore 618
slDobPhone.Children.Add(lblSpacer);
@ -383,24 +341,15 @@ namespace Xamarin.Forms.Controls.Issues
{
TextColor = txtColor,
Text = "PHONE: ",
#pragma warning disable 618
Font = Font.SystemFontOfSize(NamedSize.Medium, FontAttributes.Bold)
#pragma warning restore 618
FontSize = fontSize,
FontAttributes = FontAttributes.Bold
};
var phoneData = new Label
{
TextColor = txtColor,
#pragma warning disable 618
Font = dataFont,
#pragma warning restore 618
#pragma warning disable 618
XAlign = TextAlignment.Start,
#pragma warning restore 618
#pragma warning disable 618
YAlign = TextAlignment.Center,
#pragma warning restore 618
FontSize = fontSize,
HorizontalTextAlignment = TextAlignment.Start,
VerticalTextAlignment = TextAlignment.Center,
VerticalOptions = LayoutOptions.Center
};
phoneData.SetBinding(Label.TextProperty, "PrimaryPhone");

Просмотреть файл

@ -174,10 +174,10 @@ namespace Xamarin.Forms.Controls.Issues
[Preserve(AllMembers = true)]
public class ButtonExtensions
{
#pragma warning disable 618
public static readonly BindableProperty IsPrimaryProperty = BindableProperty.CreateAttached<ButtonExtensions, bool>(
#pragma warning restore 618
bindable => GetIsPrimary(bindable),
public static readonly BindableProperty IsPrimaryProperty = BindableProperty.CreateAttached(
"IsPrimary",
typeof(bool),
typeof(ButtonExtensions),
false,
BindingMode.TwoWay,
null,

Просмотреть файл

@ -208,13 +208,8 @@ namespace Xamarin.Forms.Controls.Issues
new Label {
AutomationId = "lblHome",
Text = "Sample Home page",
#pragma warning disable 618
XAlign = TextAlignment.Center,
#pragma warning restore 618
#pragma warning disable 618
YAlign = TextAlignment.Center
#pragma warning restore 618
HorizontalTextAlignment = TextAlignment.Center,
VerticalTextAlignment = TextAlignment.Center
}
}
};
@ -245,13 +240,8 @@ namespace Xamarin.Forms.Controls.Issues
new Label {
AutomationId = "lblAbout",
Text = "Sample About page",
#pragma warning disable 618
XAlign = TextAlignment.Center,
#pragma warning restore 618
#pragma warning disable 618
YAlign = TextAlignment.Center
#pragma warning restore 618
HorizontalTextAlignment = TextAlignment.Center,
VerticalTextAlignment = TextAlignment.Center
}
}
};

Просмотреть файл

@ -81,9 +81,7 @@ namespace Xamarin.Forms.Controls.Issues
Padding = Device.RuntimePlatform == Device.iOS ? new Thickness(0, 20, 0, 0) : new Thickness(0),
Children = {
new Label {
#pragma warning disable 618
XAlign = TextAlignment.Center,
#pragma warning restore 618
HorizontalTextAlignment = TextAlignment.Center,
Text = Device.RuntimePlatform == Device.iOS ? "Custom renderer UITableView" : Device.RuntimePlatform == Device.Android ? "Custom renderer ListView" : "Custom renderer todo"
},
fasterListView
@ -156,9 +154,7 @@ namespace Xamarin.Forms.Controls.Issues
Padding = Device.RuntimePlatform == Device.iOS ? new Thickness(5, 20, 5, 0) : new Thickness(5, 0),
Children = {
new Label {
#pragma warning disable 618
XAlign = TextAlignment.Center,
#pragma warning restore 618
HorizontalTextAlignment = TextAlignment.Center,
Text = "Xamarin.Forms built-in ListView"
},
listView
@ -200,9 +196,7 @@ namespace Xamarin.Forms.Controls.Issues
Padding = Device.RuntimePlatform == Device.iOS ? new Thickness(0, 20, 0, 0) : new Thickness(0),
Children = {
new Label {
#pragma warning disable 618
XAlign = TextAlignment.Center,
#pragma warning restore 618
HorizontalTextAlignment = TextAlignment.Center,
Text = "Xamarin.Forms native Cell"
},
listView
@ -313,9 +307,7 @@ namespace Xamarin.Forms.Controls.Issues
Padding = Device.RuntimePlatform == Device.iOS ? new Thickness(0, 20, 0, 0) : new Thickness(0),
Children = {
new Label {
#pragma warning disable 618
XAlign = TextAlignment.Center,
#pragma warning restore 618
HorizontalTextAlignment = TextAlignment.Center,
Text = Device.RuntimePlatform == Device.iOS ? "Custom UITableView+UICell" : Device.RuntimePlatform == Device.Android ? "Custom ListView+Cell" : "Custom renderer todo"
},
nativeListView2

Просмотреть файл

@ -34,7 +34,7 @@ namespace Xamarin.Forms.Controls.Issues
var layout = new StackLayout { Padding = new Thickness(5, 10) };
var formattedString = new FormattedString();
formattedString.Spans.Add(new Span { Text = "Not Clickable, ", ForegroundColor = Color.Red, FontAttributes = FontAttributes.Bold, LineHeight = 1.8 });
formattedString.Spans.Add(new Span { Text = "Not Clickable, ", TextColor = Color.Red, FontAttributes = FontAttributes.Bold, LineHeight = 1.8 });
formattedString.Spans.Add(new Span { Text = Environment.NewLine });
formattedString.Spans.Add(new Span { Text = Environment.NewLine });
var span = new Span { Text = "Clickable, " };

Просмотреть файл

@ -1,24 +0,0 @@
<?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.Controls.Issues.Issue4915ContentPage"
xmlns:local="clr-namespace:Xamarin.Forms.Controls"
BackgroundImage="{Binding Image}"
Icon="{Binding Image}">
<ContentPage.ToolbarItems>
<ToolbarItem Name="MenuItem1" Order="Primary" Icon="{Binding Image}" Text="Item 1" Priority="0" />
<ToolbarItem Name="MenuItem1" Order="Primary" IconImageSource="{Binding ImageUrl}" Text="Item 1" Priority="0" />
</ContentPage.ToolbarItems>
<ContentPage.Content>
<ScrollView>
<StackLayout>
<Label Text="Nothing Crashed"></Label>
<Label Text="Verify that Button.Image, MenuItem.Icon, Page.BackgroundImage, Page.Icon, Slider.ThumbImage all have coffee cups"></Label>
<Button Image="{Binding Image}" Clicked="ButtonClicked"></Button>
<Slider ThumbImage="{Binding Image}"></Slider>
<Button AutomationId="Image1" ImageSource="{Binding ImageUrl}" Clicked="ButtonClicked"></Button>
<Slider ThumbImageSource="{Binding ImageUrl}"></Slider>
</StackLayout>
</ScrollView>
</ContentPage.Content>
</ContentPage>

Просмотреть файл

@ -1,118 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
using Xamarin.Forms.Xaml;
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
using Xamarin.Forms.Core.UITests;
#endif
namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
[NUnit.Framework.Category(Core.UITests.UITestCategories.Github5000)]
[NUnit.Framework.Category(Core.UITests.UITestCategories.UwpIgnore)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 4915, "Unify the image handling")]
public class Issue4915 : TestTabbedPage
{
protected override void Init()
{
var navPage = new NavigationPage(new Issue4915ContentPage()) { Title = "nav page 1" };
#pragma warning disable CS0618 // Type or member is obsolete
navPage.SetBinding(Page.IconProperty, "Image");
#pragma warning restore CS0618 // Type or member is obsolete
navPage.BindingContext = new Issue4915ContentPage.ViewModel();
var urlNavPage = new NavigationPage(new Issue4915ContentPage()) { Title = "nav page 2" };
urlNavPage.SetBinding(Page.IconImageSourceProperty, "ImageUrl");
urlNavPage.BindingContext = new Issue4915ContentPage.ViewModel();
var titleIconPage = new Issue4915ContentPage();
var justSetOnNavPage = new NavigationPage(titleIconPage) { Title = "nav page 3" };
#pragma warning disable CS0618 // Type or member is obsolete
NavigationPage.SetTitleIcon(titleIconPage, "coffee.png");
#pragma warning restore CS0618 // Type or member is obsolete
Children.Add(navPage);
Children.Add(urlNavPage);
Children.Add(justSetOnNavPage);
Children.Add(new Issue4915ContentPage() { Title = "page 2" });
}
#if UITEST
[Test]
public void LegacyImageSourceProperties()
{
RunningApp.WaitForElement("Nothing Crashed");
RunningApp.QueryUntilPresent(
() =>
{
var result = RunningApp.WaitForElement("Image1");
if (result[0].Rect.Height > 50)
return result;
return null;
}, 10, 2000);
// ensure url images have loaded
System.Threading.Thread.Sleep(2000);
}
#endif
}
[Preserve(AllMembers = true)]
public partial class Issue4915ContentPage : ContentPage
{
public Issue4915ContentPage()
{
#if APP
InitializeComponent();
#endif
BindingContext = new ViewModel();
}
private void ButtonClicked(object sender, EventArgs e)
{
ViewModel vm = null;
if ((BindingContext as ViewModel).Image != "oasis.png")
{
vm = new ViewModel()
{
Image = "oasis.png",
ImageUrl = "https://raw.githubusercontent.com/xamarin/Xamarin.Forms/78385f9fc1fc56dc88bd98e73bf9c8f2f2d0a90a/Xamarin.Forms.ControlGallery.iOS/Resources/jet.png"
};
}
else
{
vm = new ViewModel();
}
BindingContext = vm;
Parent.BindingContext = vm;
Parent.Parent.BindingContext = vm;
}
[Preserve(AllMembers = true)]
public class ViewModel
{
public string Image { get; set; } = "coffee.png";
public string ImageUrl { get; set; } = "https://raw.githubusercontent.com/xamarin/Xamarin.Forms/f27f5a3650f37894d4a1ac925d6fab4dc7350087/Xamarin.Forms.ControlGallery.iOS/oasis.jpg";
}
}
}

Просмотреть файл

@ -10,12 +10,12 @@
<StackLayout Spacing="0">
<StackLayout Orientation="Horizontal" Margin="0, 5, 0, 20">
<Label class="RadioText" HorizontalOptions="StartAndExpand" VerticalTextAlignment="Start" FontAttributes="Bold">Please review and confirm that you agree to our terms and conditions before continuing.</Label>
<Button Text="View" class="Primary" HorizontalOptions="End" VerticalOptions="Start" BorderRadius="8" WidthRequest="80"></Button>
<Button Text="View" class="Primary" HorizontalOptions="End" VerticalOptions="Start" CornerRadius="8" WidthRequest="80"></Button>
</StackLayout>
<StackLayout Orientation="Horizontal" Margin="0, 5, 0, 5">
<Label class="RadioText" FontAttributes="Bold" VerticalTextAlignment="Center">I agree</Label>
<Switch x:Name="rbTerms" HorizontalOptions="StartAndExpand" />
<Button x:Name="btnContinue" StyleClass="Primary" Text="Continue" HorizontalOptions="Center" BorderRadius="8" IsEnabled="False" WidthRequest="150"></Button>
<Button x:Name="btnContinue" StyleClass="Primary" Text="Continue" HorizontalOptions="Center" CornerRadius="8" IsEnabled="False" WidthRequest="150"></Button>
</StackLayout>
</StackLayout>
</Frame>

Просмотреть файл

@ -14,7 +14,7 @@
</DataTemplate>
<DataTemplate x:Key="EmptyTemplate">
<Frame Padding="10" AutomationId="{Binding BindingContext.EmptyTemplateAutomationId, Source={x:Reference ThePage}}"
BackgroundColor="Fuschia">
BackgroundColor="Fuchsia">
<Label Text="No items here" />
</Frame>
</DataTemplate>

Просмотреть файл

@ -43,7 +43,7 @@
Command="{Binding Source={x:Reference Issue9417Page}, Path=BindingContext.DeleteCommand}"
CommandParameter="{Binding .}"
Text="Delete"
Icon="{StaticResource TrashCanImage}"
IconImageSource="{StaticResource TrashCanImage}"
BackgroundColor="{StaticResource DeleteButtonColor}" />
</SwipeItems>
</SwipeView.RightItems>
@ -53,7 +53,7 @@
Command="{Binding Source={x:Reference Issue9417Page}, Path=BindingContext.EditCommand}"
CommandParameter="{Binding .}"
Text="Edit"
Icon="{StaticResource EditImage}"
IconImageSource="{StaticResource EditImage}"
BackgroundColor="{StaticResource SaveButtonColor}" />
</SwipeItems>
</SwipeView.LeftItems>

Просмотреть файл

@ -12,9 +12,8 @@ namespace Xamarin.Forms.Controls.Issues
var header = new Label
{
Text = "ScrollView",
#pragma warning disable 618
Font = Font.SystemFontOfSize(50, FontAttributes.Bold),
#pragma warning restore 618
FontSize = 50,
FontAttributes = FontAttributes.Bold,
HorizontalOptions = LayoutOptions.Center
};
@ -49,9 +48,7 @@ namespace Xamarin.Forms.Controls.Issues
"only at runtime, you should probably put it in " +
"a StackLayout just to be sure your stuff doesn't " +
"go running off the bottom of the screen.",
#pragma warning disable 618
Font = Font.SystemFontOfSize(NamedSize.Large)
#pragma warning restore 618
FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label))
}
};

Просмотреть файл

@ -26,19 +26,18 @@ namespace Xamarin.Forms.Controls.Issues
var winPrizeLabel = new Label
{
Text = "Win a Xamarin Prize",
#pragma warning disable 618
XAlign = TextAlignment.Center,
#pragma warning restore 618
#pragma warning disable 618
YAlign = TextAlignment.Center,
#pragma warning restore 618
HorizontalTextAlignment = TextAlignment.Center,
VerticalTextAlignment = TextAlignment.Center,
VerticalOptions = LayoutOptions.FillAndExpand
};
#pragma warning disable 618
Device.OnPlatform(iOS: () => winPrizeLabel.Font = Font.OfSize("HelveticaNeue-UltraLight", NamedSize.Large));
#pragma warning restore 618
switch (Device.RuntimePlatform)
{
case Device.iOS:
winPrizeLabel.FontFamily = "HelveticaNeue-UltraLight";
winPrizeLabel.FontSize = Device.GetNamedSize( NamedSize.Large, winPrizeLabel);
break;
}
StackLayout form = MakeForm();

Просмотреть файл

@ -105,8 +105,8 @@
<Label Text="Image" Margin="0,0,0,-10" />
<StackLayout Orientation="Horizontal">
<Button Image="bank.png" Text="Enabled" HorizontalOptions="FillAndExpand" />
<Button Image="bank.png" Text="Disabled" IsEnabled="false" HorizontalOptions="FillAndExpand" />
<Button ImageSource="bank.png" Text="Enabled" HorizontalOptions="FillAndExpand" />
<Button ImageSource="bank.png" Text="Disabled" IsEnabled="false" HorizontalOptions="FillAndExpand" />
</StackLayout>
<Label Text="Custom Background" Margin="0,0,0,-10" />
@ -123,8 +123,8 @@
<Label Text="Custom Text &amp; Image" Margin="0,0,0,-10" />
<StackLayout Orientation="Horizontal">
<Button Image="bank.png" Text="Enabled" TextColor="{StaticResource LightRedColor}" HorizontalOptions="FillAndExpand" />
<Button Image="bank.png" Text="Disabled" TextColor="{StaticResource LightRedColor}" IsEnabled="false" HorizontalOptions="FillAndExpand" />
<Button ImageSource="bank.png" Text="Enabled" TextColor="{StaticResource LightRedColor}" HorizontalOptions="FillAndExpand" />
<Button ImageSource="bank.png" Text="Disabled" TextColor="{StaticResource LightRedColor}" IsEnabled="false" HorizontalOptions="FillAndExpand" />
</StackLayout>
<Label Text="Custom Background &amp; Border" Margin="0,0,0,-10" />

Просмотреть файл

@ -382,9 +382,6 @@
<DependentUpon>Issue4992.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Issue4915.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Issue5131.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue5376.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla60787.xaml.cs">
@ -740,7 +737,6 @@
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla60774_2.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ButtonBackgroundColorTest.cs" />
<Compile Include="$(MSBuildThisFileDirectory)CarouselAsync.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla34561.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla34727.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ComplexListView.cs" />
<Compile Include="$(MSBuildThisFileDirectory)CustomImageRendererErrorHandling.cs" />
@ -1002,7 +998,6 @@
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla60382.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla60524.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla59925.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla60691.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue1326.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue1436.cs" />
<Compile Include="$(MSBuildThisFileDirectory)GitHub1567.cs" />
@ -1225,7 +1220,6 @@
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla27779.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla27698.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla29247.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla27318.xaml.cs">
<DependentUpon>Bugzilla27318.xaml</DependentUpon>
</Compile>
@ -1935,7 +1929,6 @@
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Issue9906.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Issue8958.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
@ -2296,12 +2289,6 @@
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Issue4915.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Issue5949_1.xaml">
<SubType>Designer</SubType>

Просмотреть файл

@ -41,9 +41,7 @@ namespace Xamarin.Forms.Controls
Text = "BorderRadius",
BackgroundColor = Color.Transparent,
BorderColor = Color.Red,
#pragma warning disable 0618
BorderRadius = 20,
#pragma warning restore
CornerRadius = 20,
BorderWidth = 1,
}
);

Просмотреть файл

@ -18,37 +18,21 @@ namespace Xamarin.Forms.Controls
{
base.Build(stackLayout);
#pragma warning disable 618
var namedSizeMediumBoldContainer = new ViewContainer<Label>(Test.Label.FontAttibutesBold, new Label { Text = "Medium Bold Font", Font = Font.SystemFontOfSize(NamedSize.Medium, FontAttributes.Bold) });
#pragma warning restore 618
var namedSizeMediumBoldContainer = new ViewContainer<Label>(Test.Label.FontAttibutesBold, new Label { Text = "Medium Bold Font", FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), FontAttributes = FontAttributes.Bold });
#pragma warning disable 618
var namedSizeMediumItalicContainer = new ViewContainer<Label>(Test.Label.FontAttributesItalic, new Label { Text = "Medium Italic Font", Font = Font.SystemFontOfSize(NamedSize.Medium, FontAttributes.Italic) });
#pragma warning restore 618
var namedSizeMediumItalicContainer = new ViewContainer<Label>(Test.Label.FontAttributesItalic, new Label { Text = "Medium Italic Font", FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), FontAttributes = FontAttributes.Italic });
#pragma warning disable 618
var namedSizeMediumUnderlineContainer = new ViewContainer<Label>(Test.Label.TextDecorationUnderline, new Label { Text = "Medium Underlined Font", Font = Font.SystemFontOfSize(NamedSize.Medium), TextDecorations = TextDecorations.Underline });
#pragma warning restore 618
var namedSizeMediumUnderlineContainer = new ViewContainer<Label>(Test.Label.TextDecorationUnderline, new Label { Text = "Medium Underlined Font", FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), TextDecorations = TextDecorations.Underline });
#pragma warning disable 618
var namedSizeMediumStrikeContainer = new ViewContainer<Label>(Test.Label.TextDecorationStrike, new Label { Text = "Medium StrikeThrough Font", Font = Font.SystemFontOfSize(NamedSize.Medium), TextDecorations = TextDecorations.Strikethrough });
#pragma warning restore 618
var namedSizeMediumStrikeContainer = new ViewContainer<Label>(Test.Label.TextDecorationStrike, new Label { Text = "Medium StrikeThrough Font", FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), TextDecorations = TextDecorations.Strikethrough });
#pragma warning disable 618
var namedSizeLargeContainer = new ViewContainer<Label>(Test.Label.FontNamedSizeLarge, new Label { Text = "Large Font", Font = Font.SystemFontOfSize(NamedSize.Large) });
#pragma warning restore 618
var namedSizeLargeContainer = new ViewContainer<Label>(Test.Label.FontNamedSizeLarge, new Label { Text = "Large Font", FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)) });
#pragma warning disable 618
var namedSizeMediumContainer = new ViewContainer<Label>(Test.Label.FontNamedSizeMedium, new Label { Text = "Medium Font", Font = Font.SystemFontOfSize(NamedSize.Medium) });
#pragma warning restore 618
var namedSizeMediumContainer = new ViewContainer<Label>(Test.Label.FontNamedSizeMedium, new Label { Text = "Medium Font", FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) });
#pragma warning disable 618
var namedSizeMicroContainer = new ViewContainer<Label>(Test.Label.FontNamedSizeMicro, new Label { Text = "Micro Font", Font = Font.SystemFontOfSize(NamedSize.Micro) });
#pragma warning restore 618
var namedSizeMicroContainer = new ViewContainer<Label>(Test.Label.FontNamedSizeMicro, new Label { Text = "Micro Font", FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) });
#pragma warning disable 618
var namedSizeSmallContainer = new ViewContainer<Label>(Test.Label.FontNamedSizeSmall, new Label { Text = "Small Font", Font = Font.SystemFontOfSize(NamedSize.Small) });
#pragma warning restore 618
var namedSizeSmallContainer = new ViewContainer<Label>(Test.Label.FontNamedSizeSmall, new Label { Text = "Small Font", FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)) });
var formattedString = new FormattedString();
formattedString.Spans.Add(new Span { BackgroundColor = Color.Red, TextColor = Color.Olive, Text = "Span 1 " });

Просмотреть файл

@ -20,7 +20,7 @@
</DataTemplate>
<DataTemplate x:Key="EmptyTemplate">
<Frame Padding="10" HasShadow="False"
BackgroundColor="Fuschia">
BackgroundColor="Fuchsia">
<Label Text="No items here" />
</Frame>
</DataTemplate>

Просмотреть файл

@ -31,7 +31,7 @@
<Button Text="Transparent" BackgroundColor="Transparent" />
<Button Text="Red" BackgroundColor="Red" />
<Button Text="Black" BackgroundColor="Black" />
<Button Text="Red, Image" BackgroundColor="Red" Image="bank.png" />
<Button Text="Red, Image" BackgroundColor="Red" ImageSource="bank.png" />
</StackLayout>
<Label Text="Corners: (various corner radii)" Margin="0,0,0,-5" />
@ -39,7 +39,7 @@
<Button Text="Radius: 0" CornerRadius="0" />
<Button Text="Radius: 5" CornerRadius="5" />
<Button Text="Radius: 15" CornerRadius="15" />
<Button Text="Radius: 15, Image" CornerRadius="15" Image="bank.png" />
<Button Text="Radius: 15, Image" CornerRadius="15" ImageSource="bank.png" />
<Button Text="Radius: 15, Width: 5" CornerRadius="15" BorderWidth="5" BorderColor="Red" />
</StackLayout>
@ -49,7 +49,7 @@
<Button Text="Width: 0" BorderWidth="0" BorderColor="Red" />
<Button Text="Width: 1" BorderWidth="1" BorderColor="Red" />
<Button Text="Width: 15" BorderWidth="15" BorderColor="Red" />
<Button Text="Width: 15, Image" BorderWidth="15" BorderColor="Red" Image="bank.png" />
<Button Text="Width: 15, Image" BorderWidth="15" BorderColor="Red" ImageSource="bank.png" />
</StackLayout>
<Label Text="Border Colors: (various border colors, width 5)" Margin="0,0,0,-5" />
@ -58,7 +58,7 @@
<Button Text="Transparent" BorderColor="Transparent" BorderWidth="5" />
<Button Text="Red" BorderColor="Red" BorderWidth="5" />
<Button Text="Black" BorderColor="Black" BorderWidth="5" />
<Button Text="Red, Image" BorderColor="Red" BorderWidth="5" Image="bank.png" />
<Button Text="Red, Image" BorderColor="Red" BorderWidth="5" ImageSource="bank.png" />
</StackLayout>
<Label Text="Circles:" Margin="0,5,0,0" FontAttributes="Bold" />
@ -74,8 +74,8 @@
<Button Text="Red Circle" BackgroundColor="Red" CornerRadius="50" WidthRequest="100" HeightRequest="100" />
</StackLayout>
<StackLayout Padding="0" Spacing="5" Orientation="Horizontal">
<Button Text="Image Square" BackgroundColor="Red" Image="bank.png" WidthRequest="100" HeightRequest="100" />
<Button Text="Image Circle" BackgroundColor="Red" CornerRadius="50" Image="bank.png" WidthRequest="100" HeightRequest="100" />
<Button Text="Image Square" BackgroundColor="Red" ImageSource="bank.png" WidthRequest="100" HeightRequest="100" />
<Button Text="Image Circle" BackgroundColor="Red" CornerRadius="50" ImageSource="bank.png" WidthRequest="100" HeightRequest="100" />
</StackLayout>
</StackLayout>
@ -90,8 +90,8 @@
<Button Text="Red Circle" BackgroundColor="Red" CornerRadius="50" WidthRequest="100" HeightRequest="100" android:Button.UseDefaultPadding="true" android:Button.UseDefaultShadow="true" />
</StackLayout>
<StackLayout Padding="0" Spacing="5" Orientation="Horizontal">
<Button Text="Image Square" BackgroundColor="Red" Image="bank.png" WidthRequest="100" HeightRequest="100" android:Button.UseDefaultPadding="true" android:Button.UseDefaultShadow="true" />
<Button Text="Image Circle" BackgroundColor="Red" CornerRadius="50" Image="bank.png" WidthRequest="100" HeightRequest="100" android:Button.UseDefaultPadding="true" android:Button.UseDefaultShadow="true" />
<Button Text="Image Square" BackgroundColor="Red" ImageSource="bank.png" WidthRequest="100" HeightRequest="100" android:Button.UseDefaultPadding="true" android:Button.UseDefaultShadow="true" />
<Button Text="Image Circle" BackgroundColor="Red" CornerRadius="50" ImageSource="bank.png" WidthRequest="100" HeightRequest="100" android:Button.UseDefaultPadding="true" android:Button.UseDefaultShadow="true" />
</StackLayout>
</StackLayout>

Просмотреть файл

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Xamarin.Forms.Controls
{
@ -66,9 +62,7 @@ namespace Xamarin.Forms.Controls
BorderColor = Color.Black,
BackgroundColor = Color.Purple,
BorderWidth = 5,
#pragma warning disable 0618
BorderRadius = 5
#pragma warning restore
CornerRadius = 5
};
var timer = new Button { Text = "Timer" };
var busy = new Button { Text = "Toggle Busy" };

Просмотреть файл

@ -22,17 +22,17 @@
<StackLayout Orientation="Vertical" Padding="0" Spacing="5">
<Button />
<Button Text="Some Text" />
<Button Image="bank.png" />
<Button Text="Some Text" Image="bank.png" />
<Button Text="Some Text" Image="bank.png" ContentLayout="Top, 8" />
<Button Text="Some Text" Image="bank.png" ContentLayout="Right, 8" />
<Button Text="Some Text" Image="bank.png" ContentLayout="Bottom, 8" />
<Button Text="Some Text" Image="bank.png" ContentLayout="Left, 8" />
<Button ImageSource="bank.png" />
<Button Text="Some Text" ImageSource="bank.png" />
<Button Text="Some Text" ImageSource="bank.png" ContentLayout="Top, 8" />
<Button Text="Some Text" ImageSource="bank.png" ContentLayout="Right, 8" />
<Button Text="Some Text" ImageSource="bank.png" ContentLayout="Bottom, 8" />
<Button Text="Some Text" ImageSource="bank.png" ContentLayout="Left, 8" />
</StackLayout>
<Label Text="Autosized:" Margin="0,0,0,-5" />
<StackLayout Orientation="Horizontal" Padding="0" Spacing="5">
<Button x:Name="autosizedButton" Text="{Binding ButtonText}" Image="{Binding ButtonImage}" ContentLayout="{Binding ButtonImageLayout}" FontSize="{Binding ButtonFontSize}" />
<Button x:Name="autosizedButton" Text="{Binding ButtonText}" ImageSource="{Binding ButtonImage}" ContentLayout="{Binding ButtonImageLayout}" FontSize="{Binding ButtonFontSize}" />
</StackLayout>
<Label Text="Explicit Size:" Margin="0,0,0,-5" />
@ -47,19 +47,19 @@
</Grid.ColumnDefinitions>
<Button
x:Name="explicitButton" Text="{Binding ButtonText}" Image="{Binding ButtonImage}" ContentLayout="{Binding ButtonImageLayout}" FontSize="{Binding ButtonFontSize}"
x:Name="explicitButton" Text="{Binding ButtonText}" ImageSource="{Binding ButtonImage}" ContentLayout="{Binding ButtonImageLayout}" FontSize="{Binding ButtonFontSize}"
WidthRequest="120" HeightRequest="60" HorizontalOptions="Start" VerticalOptions="Start" />
<Button
x:Name="explicitWidthButton" Text="{Binding ButtonText}" Image="{Binding ButtonImage}" ContentLayout="{Binding ButtonImageLayout}" FontSize="{Binding ButtonFontSize}"
x:Name="explicitWidthButton" Text="{Binding ButtonText}" ImageSource="{Binding ButtonImage}" ContentLayout="{Binding ButtonImageLayout}" FontSize="{Binding ButtonFontSize}"
Grid.Column="1" Grid.RowSpan="2" WidthRequest="120" HorizontalOptions="Start" VerticalOptions="Start" />
<Button
x:Name="explicitHeightButton" Text="{Binding ButtonText}" Image="{Binding ButtonImage}" ContentLayout="{Binding ButtonImageLayout}" FontSize="{Binding ButtonFontSize}"
x:Name="explicitHeightButton" Text="{Binding ButtonText}" ImageSource="{Binding ButtonImage}" ContentLayout="{Binding ButtonImageLayout}" FontSize="{Binding ButtonFontSize}"
Grid.Row="1" Grid.ColumnSpan="2" HeightRequest="60" HorizontalOptions="Start" VerticalOptions="Start" />
</Grid>
<Label Text="Stretched:" Margin="0,0,0,-5" />
<StackLayout Orientation="Vertical" Padding="0" Spacing="5">
<Button x:Name="stretchedButton" Text="{Binding ButtonText}" Image="{Binding ButtonImage}" ContentLayout="{Binding ButtonImageLayout}" FontSize="{Binding ButtonFontSize}" />
<Button x:Name="stretchedButton" Text="{Binding ButtonText}" ImageSource="{Binding ButtonImage}" ContentLayout="{Binding ButtonImageLayout}" FontSize="{Binding ButtonFontSize}" />
</StackLayout>
<Label Text="Options:" Margin="0,5,0,0" FontAttributes="Bold" />

Просмотреть файл

@ -44,9 +44,7 @@ namespace Xamarin.Forms.Controls
Label name = new Label();
name.SetBinding(Label.TextProperty, "FullName");
#pragma warning disable 618
Label title = new Label { Font = Font.SystemFontOfSize(NamedSize.Micro) };
#pragma warning restore 618
Label title = new Label { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) };
title.SetBinding(Label.TextProperty, "Title");
return new ViewCell

Просмотреть файл

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Xamarin.Forms.Controls
namespace Xamarin.Forms.Controls
{
public class LabelGallery : ContentPage
{
@ -52,10 +46,8 @@ namespace Xamarin.Forms.Controls
{
FormattedText = new FormattedString
{
Spans = {
#pragma warning disable 618
new Span {Text="FormattedStrings ", TextColor=Color.Blue, BackgroundColor = Color.Yellow, Font = Font.BoldSystemFontOfSize (NamedSize.Large)},
#pragma warning restore 618
Spans = {
new Span {Text="FormattedStrings ", TextColor=Color.Blue, BackgroundColor = Color.Yellow, FontAttributes = FontAttributes.Bold, FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label))},
}
}
};
@ -66,33 +58,23 @@ namespace Xamarin.Forms.Controls
var missingfont = new Label { Text = "Missing font: use default" };
#pragma warning disable 618
micro.Font = Font.SystemFontOfSize(NamedSize.Micro);
#pragma warning restore 618
micro.FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label));
#pragma warning disable 618
small.Font = Font.SystemFontOfSize(NamedSize.Small);
#pragma warning restore 618
small.FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label));
#pragma warning disable 618
medium.Font = Font.SystemFontOfSize(NamedSize.Medium);
#pragma warning restore 618
medium.FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label));
#pragma warning disable 618
large.Font = Font.SystemFontOfSize(NamedSize.Large);
#pragma warning restore 618
large.FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label));
#pragma warning disable 618
bold.Font = Font.SystemFontOfSize(NamedSize.Medium, FontAttributes.Bold);
#pragma warning restore 618
bold.FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label));
bold.FontAttributes = FontAttributes.Bold;
#pragma warning disable 618
italic.Font = Font.SystemFontOfSize(NamedSize.Medium, FontAttributes.Italic);
#pragma warning restore 618
italic.FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label));
italic.FontAttributes = FontAttributes.Italic;
bolditalic.FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label));
bolditalic.FontAttributes = FontAttributes.Bold | FontAttributes.Italic;
#pragma warning disable 618
bolditalic.Font = Font.SystemFontOfSize(NamedSize.Medium, FontAttributes.Bold | FontAttributes.Italic);
#pragma warning restore 618
string fontName;
switch (Device.RuntimePlatform)
{
@ -107,30 +89,35 @@ namespace Xamarin.Forms.Controls
fontName = "Comic Sans MS";
break;
}
var font = Font.OfSize(fontName, NamedSize.Medium);
#pragma warning disable 618
customFont.Font = font;
#pragma warning restore 618
#pragma warning disable 618
italicfont.Font = font.WithAttributes(FontAttributes.Italic);
#pragma warning restore 618
customFont.FontFamily = fontName;
customFont.FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label));
#pragma warning disable 618
boldfont.Font = font.WithAttributes(FontAttributes.Bold);
#pragma warning restore 618
italicfont.FontFamily = fontName;
italicfont.FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label));
italicfont.FontAttributes = FontAttributes.Italic;
#pragma warning disable 618
bolditalicfont.Font = font.WithAttributes(FontAttributes.Bold | FontAttributes.Italic);
#pragma warning restore 618
boldfont.FontFamily = fontName;
boldfont.FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label));
boldfont.FontAttributes = FontAttributes.Bold;
#pragma warning disable 618
customFont.GestureRecognizers.Add(new TapGestureRecognizer { Command = new Command(o => customFont.Font = Font.Default) });
#pragma warning restore 618
bolditalicfont.FontFamily = fontName;
bolditalicfont.FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label));
bolditalicfont.FontAttributes = FontAttributes.Bold | FontAttributes.Italic;
customFont.GestureRecognizers.Add(new TapGestureRecognizer
{
Command = new Command(o =>
{
customFont.FontAttributes = FontAttributes.None;
customFont.FontFamily = null;
customFont.FontSize = 0;
})
});
missingfont.FontFamily = "FooBar";
missingfont.FontSize = 20;
#pragma warning disable 618
missingfont.Font = Font.OfSize("FooBar", 20);
#pragma warning restore 618
center.HorizontalTextAlignment = TextAlignment.Center;
right.HorizontalTextAlignment = TextAlignment.End;
int i = 1;

Просмотреть файл

@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace Xamarin.Forms.Controls
{
@ -149,9 +148,8 @@ namespace Xamarin.Forms.Controls
Label header = new Label
{
Text = "ListView",
#pragma warning disable 618
Font = Font.BoldSystemFontOfSize(50),
#pragma warning restore 618
FontAttributes = FontAttributes.Bold,
FontSize = 50,
HorizontalOptions = LayoutOptions.Center
};
@ -162,7 +160,7 @@ namespace Xamarin.Forms.Controls
new Person("Bob", new DateTime(1976, 2, 20), Color.Black),
new Person("Cathy", new DateTime(1977, 3, 10), Color.Blue),
#pragma warning disable 618
new Person("David", new DateTime(1978, 4, 25), Color.Fuschia),
new Person("David", new DateTime(1978, 4, 25), Color.Fuchsia),
#pragma warning restore 618
new Person("Eugenie", new DateTime(1979, 5, 5), Color.Gray),
new Person("Freddie", new DateTime(1980, 6, 30), Color.Green),
@ -179,7 +177,7 @@ namespace Xamarin.Forms.Controls
new Person("Queenie", new DateTime(1979, 5, 15), Color.Aqua),
new Person("Rob", new DateTime(1980, 6, 30), Color.Blue),
#pragma warning disable 618
new Person("Sally", new DateTime(1981, 7, 5), Color.Fuschia),
new Person("Sally", new DateTime(1981, 7, 5), Color.Fuchsia),
#pragma warning restore 618
new Person("Timothy", new DateTime(1982, 8, 30), Color.Green),
new Person("Uma", new DateTime(1983, 9, 10), Color.Lime),
@ -195,7 +193,7 @@ namespace Xamarin.Forms.Controls
new Person("Bob", new DateTime(1976, 2, 20), Color.Black),
new Person("Cathy", new DateTime(1977, 3, 10), Color.Blue),
#pragma warning disable 618
new Person("David", new DateTime(1978, 4, 25), Color.Fuschia),
new Person("David", new DateTime(1978, 4, 25), Color.Fuchsia),
#pragma warning restore 618
new Person("Eugenie", new DateTime(1979, 5, 5), Color.Gray),
new Person("Freddie", new DateTime(1980, 6, 30), Color.Green),
@ -212,7 +210,7 @@ namespace Xamarin.Forms.Controls
new Person("Queenie", new DateTime(1979, 5, 15), Color.Aqua),
new Person("Rob", new DateTime(1980, 6, 30), Color.Blue),
#pragma warning disable 618
new Person("Sally", new DateTime(1981, 7, 5), Color.Fuschia),
new Person("Sally", new DateTime(1981, 7, 5), Color.Fuchsia),
#pragma warning restore 618
new Person("Timothy", new DateTime(1982, 8, 30), Color.Green),
new Person("Uma", new DateTime(1983, 9, 10), Color.Lime),

Просмотреть файл

@ -92,14 +92,6 @@ namespace Xamarin.Forms.Controls
rootNavPage.BarBackgroundColor = Color.Default;
})
},
new Button {
Text = "Make sure Tint still works",
Command = new Command (() => {
#pragma warning disable 618
rootNavPage.Tint = Color.Red;
#pragma warning restore 618
})
},
new Button {
Text = "Black background, white text",
Command = new Command (() => {

Просмотреть файл

@ -28,14 +28,14 @@
</VisualStateManager.VisualStateGroups>
</Label>
<Button x:Name="AButton" Text="Button" ContentLayout="Left" HorizontalOptions="Start" Image="coffee.png" TextColor="Blue">
<Button x:Name="AButton" Text="Button" ContentLayout="Left" HorizontalOptions="Start" ImageSource="coffee.png" TextColor="Blue">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="ColorStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Invalid">
<VisualState.Setters>
<Setter Property="TextColor" Value="DarkRed"/>
<Setter Property="Image" Value="toolbar_close.png"/>
<Setter Property="ImageSource" Value="toolbar_close.png"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>

Просмотреть файл

@ -13,16 +13,16 @@
<Image Source="{Binding Image}" VerticalOptions="Center">
<Image.WidthRequest>
<OnPlatform x:TypeArguments="x:Double">
<OnPlatform.iOS>55</OnPlatform.iOS>
<OnPlatform.Android>55 </OnPlatform.Android>
<OnPlatform.WinPhone>75</OnPlatform.WinPhone>
<On Platform="iOS">55</On>
<On Platform="Android">55 </On>
<On Platform="UWP">75</On>
</OnPlatform>
</Image.WidthRequest>
<Image.HeightRequest>
<OnPlatform x:TypeArguments="x:Double">
<OnPlatform.iOS>55</OnPlatform.iOS>
<OnPlatform.Android>55</OnPlatform.Android>
<OnPlatform.WinPhone>75</OnPlatform.WinPhone>
<On Platform="iOS">55</On>
<On Platform="Android">55 </On>
<On Platform="UWP">75</On>
</OnPlatform>
</Image.HeightRequest>
</Image>

Просмотреть файл

@ -24,9 +24,9 @@
<Image x:Name="completedimg" HorizontalOptions="Start" VerticalOptions="Center" Grid.Row="0" Grid.Column="0" IsVisible="true"/>
<Label Text="{Binding CallOut}" TextColor="Yellow" FontSize="17" FontFamily="Roboto" XAlign="Start" HorizontalOptions="Start" VerticalOptions="Center" Grid.Row="0" Grid.Column="1" />
<Label Text="{Binding CallOut}" TextColor="Yellow" FontSize="17" FontFamily="Roboto" HorizontalTextAlignment="Start" HorizontalOptions="Start" VerticalOptions="Center" Grid.Row="0" Grid.Column="1" />
<Label Text="........................................................................................................................................................................." LineBreakMode ="NoWrap" TextColor="Yellow" HorizontalOptions="FillAndExpand" VerticalOptions="Center" Grid.Row="0" Grid.Column="2" />
<Label Text="{Binding Action}" FontSize="17" TextColor="Yellow" FontFamily="Roboto" XAlign="End" HorizontalOptions="End" VerticalOptions="Center" Grid.Row="0" Grid.Column="3" />
<Label Text="{Binding Action}" FontSize="17" TextColor="Yellow" FontFamily="Roboto" HorizontalTextAlignment="End" HorizontalOptions="End" VerticalOptions="Center" Grid.Row="0" Grid.Column="3" />
</Grid>

Просмотреть файл

@ -6,7 +6,7 @@
Shell.TabBarIsVisible="false"
x:Class="Xamarin.Forms.Controls.ShellContentTest">
<Page.ToolbarItems>
<ToolbarItem Text="Search" Icon="bank.png" />
<ToolbarItem Text="Search" IconImageSource="bank.png" />
</Page.ToolbarItems>
<!--<Shell.SearchHandler>
<SearchHandler Placeholder="My Placeholder!" />

Просмотреть файл

@ -24,9 +24,7 @@ namespace Xamarin.Forms.Controls.Tests
{
Text = header,
TextColor = Color.Red,
#pragma warning disable 618
XAlign = TextAlignment.Center
#pragma warning restore 618
HorizontalTextAlignment = TextAlignment.Center
};
listview.Header = null;

Просмотреть файл

@ -87,25 +87,25 @@
<ShellContent Route="movies" Style="{StaticResource MoviesShell}" Title="Movies &amp; TV"
Icon="film.png" FlyoutIcon="filmflyout.png" ContentTemplate="{DataTemplate local:MoviesPage}">
<ShellContent.MenuItems>
<MenuItem Icon="film.png" Text="Open Movies App" />
<MenuItem IconImageSource="film.png" Text="Open Movies App" />
</ShellContent.MenuItems>
</ShellContent>
<ShellContent Route="books" Style="{StaticResource BooksShell}" Title="Books"
Icon="books.png" FlyoutIcon="booksflyout.png" ContentTemplate="{DataTemplate local:BooksPage}">
<ShellContent.MenuItems>
<MenuItem Icon="books.png" Text="Open Reader" />
<MenuItem IconImageSource="books.png" Text="Open Reader" />
</ShellContent.MenuItems>
</ShellContent>
<ShellContent Route="music" Style="{StaticResource MusicShell}" Title="Music"
Icon="headphone.png" FlyoutIcon="headphoneflyout.png" ContentTemplate="{DataTemplate local:MusicPage}">
<ShellContent.MenuItems>
<MenuItem Icon="headphone.png" Text="Open Music App" />
<MenuItem IconImageSource="headphone.png" Text="Open Music App" />
</ShellContent.MenuItems>
</ShellContent>
<ShellContent Route="news" Style="{StaticResource NewsShell}" Title="Newsstand"
Icon="newspaper.png" FlyoutIcon="newspaperflyout.png" ContentTemplate="{DataTemplate local:NewsPage}">
<ShellContent.MenuItems>
<MenuItem Icon="newspaper.png" Text="Open News App" />
<MenuItem IconImageSource="newspaper.png" Text="Open News App" />
</ShellContent.MenuItems>
</ShellContent>
</ShellItem>
@ -122,7 +122,7 @@
<ShellContent Route="wishlist" Title="Wishlist" Icon="star.png" ContentTemplate="{DataTemplate local:WishlistPage}" />
<MenuItem Shell.MenuItemTemplate="{StaticResource MenuItemTemplate}" Text="Xam Protect" Icon="jet.png" />
<MenuItem Shell.MenuItemTemplate="{StaticResource MenuItemTemplate}" Text="Xam Protect" IconImageSource="jet.png" />
<ShellContent Route="settings" Title="Settings" Icon="gear.png" ContentTemplate="{DataTemplate local:SettingsPage}" />

Просмотреть файл

@ -17,7 +17,9 @@
<x:Double x:Key="mediumTextSize">20</x:Double>
<x:Double x:Key="smallTextSize">14</x:Double>
<x:Double x:Key="standardPadding">10</x:Double>
<OnPlatform x:Key="IconButtonWidth" x:TypeArguments="x:Double" Default="-1" Android="40" />
<OnPlatform x:Key="IconButtonWidth" x:TypeArguments="x:Double" Default="-1">
<On Platform="Android" Value="30"/>
</OnPlatform>
<Style x:Key="NakedButton" TargetType="Button">
<Setter Property="BackgroundColor" Value="Transparent" />
<Setter Property="TextColor" Value="{StaticResource accentColor}" />

Просмотреть файл

@ -35,15 +35,15 @@
StyleClass="MainTab"
HorizontalOptions="FillAndExpand"
VerticalOptions="Fill"
Image="icon_bookmark.png"
ImageSource="icon_bookmark.png"
Command="{Binding ToggleCommand}"
CommandParameter="bookmarked">
<Button.Triggers>
<DataTrigger TargetType="Button" Binding="{Binding IsFullTabSelected}" Value="true">
<Setter Property="Image" Value="icon_bookmark.png" />
<Setter Property="ImageSource" Value="icon_bookmark.png" />
</DataTrigger>
<DataTrigger TargetType="Button" Binding="{Binding IsFullTabSelected}" Value="false">
<Setter Property="Image" Value="icon_bookmark_selected.png" />
<Setter Property="ImageSource" Value="icon_bookmark_selected.png" />
</DataTrigger>
</Button.Triggers>
</Button>
@ -127,7 +127,7 @@
Constant=-80}"
Command="{Binding NavToAddCommand}"
StyleClass="AddButton"
Image="button_add.png"/>
ImageSource="button_add.png"/>
</RelativeLayout>
</ContentPage.Content>
</ContentPage>

Просмотреть файл

@ -13,20 +13,12 @@ namespace Xamarin
{
public static bool IsInitialized { get; private set; }
[Obsolete("Context is obsolete as of version 2.5. Please use a local context instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public static Context Context { get; private set; }
public static void Init(Activity activity, Bundle bundle)
{
if (IsInitialized)
return;
IsInitialized = true;
#pragma warning disable 618 // Setting this to support custom code which may still depend on it
Context = activity;
#pragma warning restore 618
MapRenderer.Bundle = bundle;
#pragma warning disable 618

Просмотреть файл

@ -42,13 +42,6 @@ namespace Xamarin.Forms.Maps.Android
AutoPackage = false;
}
[Obsolete("This constructor is obsolete as of version 2.5. Please use MapRenderer(Context) instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public MapRenderer()
{
AutoPackage = false;
}
protected Map Map => Element;
protected GoogleMap NativeMap;
@ -368,9 +361,7 @@ namespace Xamarin.Forms.Maps.Android
return;
}
#pragma warning disable CS0618
pin.SendTap();
#pragma warning restore CS0618
pin.SendMarkerClick();
// SendInfoWindowClick() returns the value of PinClickedEventArgs.HideInfoWindow
bool hideInfoWindow = pin.SendInfoWindowClick();

Просмотреть файл

@ -420,9 +420,7 @@ namespace Xamarin.Forms.Maps.GTK
if (pin.Position.Latitude == marker.Position.Lat &&
pin.Position.Longitude == marker.Position.Lng)
{
#pragma warning disable CS0618
pin.SendTap();
#pragma warning restore CS0618
pin.SendMarkerClick();
break;
}
}

Просмотреть файл

@ -6,7 +6,6 @@ using System.Collections.Specialized;
using System.ComponentModel;
using Tizen.Location;
using Tizen.Maps;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Tizen;
using TPin = Tizen.Maps.Pin;
@ -213,9 +212,7 @@ namespace Xamarin.Forms.Maps.Tizen
pin.MarkerId = nativePin;
nativePin.Clicked += (s, e) =>
{
#pragma warning disable CS0618
pin.SendTap();
#pragma warning restore CS0618
pin.SendMarkerClick();
};
Control.Add(nativePin);
_pins.Add(pin);

Просмотреть файл

@ -46,9 +46,6 @@
// void PushPinTapped(object sender, TappedRoutedEventArgs e)
// {
//#pragma warning disable CS0618
// _pin.SendTap();
//#pragma warning restore CS0618
// _pin.SendMarkerClick();
// }

Просмотреть файл

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
using System.Windows.Input;
using Microsoft.Maps.MapControl.WPF;
@ -36,9 +31,7 @@ namespace Xamarin.Forms.Maps.WPF
void FormsPushPin_MouseDown(object sender, MouseButtonEventArgs e)
{
#pragma warning disable CS0618
Pin.SendTap();
#pragma warning restore CS0618
Pin.SendMarkerClick();
}
void PinPropertyChanged(object sender, PropertyChangedEventArgs e)

Просмотреть файл

@ -73,7 +73,7 @@ namespace Xamarin.Forms.Maps.MacOS
mkMapView.DidSelectAnnotationView -= MkMapViewOnAnnotationViewSelected;
mkMapView.RegionChanged -= MkMapViewOnRegionChanged;
mkMapView.GetViewForAnnotation = null;
mkMapView.OverlayRenderer = null;
mkMapView.OverlayRenderer = null;
if (mkMapView.Delegate != null)
{
mkMapView.Delegate.Dispose();
@ -194,7 +194,7 @@ namespace Xamarin.Forms.Maps.MacOS
else if (e.PropertyName == Map.TrafficEnabledProperty.PropertyName)
UpdateTrafficEnabled();
else if (e.PropertyName == VisualElement.HeightProperty.PropertyName && ((Map)Element).LastMoveToRegion != null)
_shouldUpdateRegion = ((Map)Element).MoveToLastRegionOnLayoutChange;
_shouldUpdateRegion = ((Map)Element).MoveToLastRegionOnLayoutChange;
}
#if __MOBILE__
@ -320,9 +320,7 @@ namespace Xamarin.Forms.Maps.MacOS
if (_lastTouchedView is MKAnnotationView)
return;
#pragma warning disable CS0618
targetPin.SendTap();
#pragma warning restore CS0618
targetPin.SendMarkerClick();
// SendInfoWindowClick() returns the value of PinClickedEventArgs.HideInfoWindow
// Hide the info window by deselecting the annotation

Просмотреть файл

@ -39,20 +39,6 @@ namespace Xamarin.Forms.Maps
set { SetValue(TypeProperty, value); }
}
// introduced to store the unique id for Android markers
[Obsolete("This property is obsolete as of 4.0.0. Please use MarkerId instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public new object Id
{
get => _id;
set
{
_id = value;
_markerId = value;
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
public object MarkerId
{
@ -65,9 +51,6 @@ namespace Xamarin.Forms.Maps
}
}
[Obsolete("This event is obsolete as of 4.3.0. Please use MarkerClicked and/or InfoWindowClicked instead.")]
public event EventHandler Clicked;
public event EventHandler<PinClickedEventArgs> MarkerClicked;
public event EventHandler<PinClickedEventArgs> InfoWindowClicked;
@ -105,18 +88,6 @@ namespace Xamarin.Forms.Maps
return !Equals(left, right);
}
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("This method is obsolete as of 4.3.0.")]
public bool SendTap()
{
EventHandler handler = Clicked;
if (handler == null)
return false;
handler(this, EventArgs.Empty);
return true;
}
[EditorBrowsable(EditorBrowsableState.Never)]
public bool SendMarkerClick()
{

Просмотреть файл

@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:58823/",
"sslPort": 44373
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Sample.Server.WebAuthenticator": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000"
}
}
}

Просмотреть файл

@ -60,7 +60,7 @@ namespace Tests
[Theory]
[InlineData("#FF0000", "#00FFFF")] // Red & Cyan
[InlineData("#00FF00", "#FF00FF")] // Green & Fuschia
[InlineData("#00FF00", "#FF00FF")] // Green & Fuchsia
[InlineData("#0000FF", "#FFFF00")] // Blue & Yellow
[InlineData("#0AF56C", "#F50A93")] // Lime green & bright purple (but with no limit values)
public void GetComplementary(string original, string expected)

Просмотреть файл

@ -73,9 +73,6 @@ namespace Xamarin.Forms
child.PropertyChanged += ChildOnPropertyChanged;
}
[Obsolete("OnChildRemoved(Element) is obsolete as of version 4.8.0. Please use OnChildRemoved(Element, int) instead.")]
protected override void OnChildRemoved(Element child) => OnChildRemoved(child, -1);
protected override void OnChildRemoved(Element child, int oldLogicalIndex)
{
child.PropertyChanged -= ChildOnPropertyChanged;

Просмотреть файл

@ -22,9 +22,6 @@ namespace Xamarin.Forms
static readonly SemaphoreSlim SaveSemaphore = new SemaphoreSlim(1, 1);
[Obsolete("Assign the LogWarningsListener")]
public static bool LogWarningsToApplicationOutput { get; set; }
public Application()
{
SetCurrentApplication(this);

Просмотреть файл

@ -167,14 +167,6 @@ namespace Xamarin.Forms
return resultArray;
}
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("GetValues is obsolete as of 4.0.0. Please use GetValue instead.")]
public object[] GetValues(BindableProperty property0, BindableProperty property1) => new object[] { GetValue(property0), GetValue(property1) };
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("GetValues is obsolete as of 4.0.0. Please use GetValue instead.")]
public object[] GetValues(BindableProperty property0, BindableProperty property1, BindableProperty property2) => new object[] { GetValue(property0), GetValue(property1), GetValue(property2) };
public bool IsSet(BindableProperty targetProperty)
{
var bpcontext = GetContext(targetProperty ?? throw new ArgumentNullException(nameof(targetProperty)));

Просмотреть файл

@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq.Expressions;
namespace Xamarin.Forms
{
@ -41,22 +39,6 @@ namespace Xamarin.Forms
self.SetBinding(targetProperty, binding);
}
[Obsolete]
[EditorBrowsable(EditorBrowsableState.Never)]
public static void SetBinding<TSource>(this BindableObject self, BindableProperty targetProperty, Expression<Func<TSource, object>> sourceProperty, BindingMode mode = BindingMode.Default,
IValueConverter converter = null, string stringFormat = null)
{
if (self == null)
throw new ArgumentNullException(nameof(self));
if (targetProperty == null)
throw new ArgumentNullException(nameof(targetProperty));
if (sourceProperty == null)
throw new ArgumentNullException(nameof(sourceProperty));
Binding binding = Binding.Create(sourceProperty, mode, converter, stringFormat: stringFormat);
self.SetBinding(targetProperty, binding);
}
public static T GetPropertyIfSet<T>(this BindableObject bindableObject, BindableProperty bindableProperty, T returnIfNotSet)
{
if (bindableObject == null)

Просмотреть файл

@ -129,16 +129,6 @@ namespace Xamarin.Forms
internal ValidateValueDelegate ValidateValue { get; private set; }
[Obsolete("Create<> (generic) is obsolete as of version 2.1.0 and is no longer supported.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public static BindableProperty Create<TDeclarer, TPropertyType>(Expression<Func<TDeclarer, TPropertyType>> getter, TPropertyType defaultValue, BindingMode defaultBindingMode = BindingMode.OneWay,
ValidateValueDelegate<TPropertyType> validateValue = null, BindingPropertyChangedDelegate<TPropertyType> propertyChanged = null,
BindingPropertyChangingDelegate<TPropertyType> propertyChanging = null, CoerceValueDelegate<TPropertyType> coerceValue = null,
CreateDefaultValueDelegate<TDeclarer, TPropertyType> defaultValueCreator = null) where TDeclarer : BindableObject
{
return Create(getter, defaultValue, defaultBindingMode, validateValue, propertyChanged, propertyChanging, coerceValue, null, defaultValueCreator: defaultValueCreator);
}
public static BindableProperty Create(string propertyName, Type returnType, Type declaringType, object defaultValue = null, BindingMode defaultBindingMode = BindingMode.OneWay,
ValidateValueDelegate validateValue = null, BindingPropertyChangedDelegate propertyChanged = null, BindingPropertyChangingDelegate propertyChanging = null,
CoerceValueDelegate coerceValue = null, CreateDefaultValueDelegate defaultValueCreator = null)
@ -147,17 +137,6 @@ namespace Xamarin.Forms
defaultValueCreator: defaultValueCreator);
}
[Obsolete("CreateAttached<> (generic) is obsolete as of version 2.1.0 and is no longer supported.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public static BindableProperty CreateAttached<TDeclarer, TPropertyType>(Expression<Func<BindableObject, TPropertyType>> staticgetter, TPropertyType defaultValue,
BindingMode defaultBindingMode = BindingMode.OneWay, ValidateValueDelegate<TPropertyType> validateValue = null, BindingPropertyChangedDelegate<TPropertyType> propertyChanged = null,
BindingPropertyChangingDelegate<TPropertyType> propertyChanging = null, CoerceValueDelegate<TPropertyType> coerceValue = null,
CreateDefaultValueDelegate<BindableObject, TPropertyType> defaultValueCreator = null)
{
return CreateAttached<TDeclarer, TPropertyType>(staticgetter, defaultValue, defaultBindingMode, validateValue, propertyChanged, propertyChanging, coerceValue, null,
defaultValueCreator: defaultValueCreator);
}
public static BindableProperty CreateAttached(string propertyName, Type returnType, Type declaringType, object defaultValue, BindingMode defaultBindingMode = BindingMode.OneWay,
ValidateValueDelegate validateValue = null, BindingPropertyChangedDelegate propertyChanged = null, BindingPropertyChangingDelegate propertyChanging = null,
CoerceValueDelegate coerceValue = null, CreateDefaultValueDelegate defaultValueCreator = null)
@ -165,19 +144,6 @@ namespace Xamarin.Forms
return CreateAttached(propertyName, returnType, declaringType, defaultValue, defaultBindingMode, validateValue, propertyChanged, propertyChanging, coerceValue, null, false, defaultValueCreator);
}
[Obsolete("CreateAttachedReadOnly<> (generic) is obsolete as of version 2.1.0 and is no longer supported.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public static BindablePropertyKey CreateAttachedReadOnly<TDeclarer, TPropertyType>(Expression<Func<BindableObject, TPropertyType>> staticgetter, TPropertyType defaultValue,
BindingMode defaultBindingMode = BindingMode.OneWayToSource, ValidateValueDelegate<TPropertyType> validateValue = null,
BindingPropertyChangedDelegate<TPropertyType> propertyChanged = null, BindingPropertyChangingDelegate<TPropertyType> propertyChanging = null,
CoerceValueDelegate<TPropertyType> coerceValue = null, CreateDefaultValueDelegate<BindableObject, TPropertyType> defaultValueCreator = null)
{
return
new BindablePropertyKey(CreateAttached<TDeclarer, TPropertyType>(staticgetter, defaultValue, defaultBindingMode, validateValue, propertyChanged, propertyChanging, coerceValue, null, true,
defaultValueCreator));
}
public static BindablePropertyKey CreateAttachedReadOnly(string propertyName, Type returnType, Type declaringType, object defaultValue, BindingMode defaultBindingMode = BindingMode.OneWayToSource,
ValidateValueDelegate validateValue = null, BindingPropertyChangedDelegate propertyChanged = null, BindingPropertyChangingDelegate propertyChanging = null,
CoerceValueDelegate coerceValue = null, CreateDefaultValueDelegate defaultValueCreator = null)
@ -187,16 +153,6 @@ namespace Xamarin.Forms
defaultValueCreator));
}
[Obsolete("CreateReadOnly<> (generic) is obsolete as of version 2.1.0 and is no longer supported.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public static BindablePropertyKey CreateReadOnly<TDeclarer, TPropertyType>(Expression<Func<TDeclarer, TPropertyType>> getter, TPropertyType defaultValue,
BindingMode defaultBindingMode = BindingMode.OneWayToSource, ValidateValueDelegate<TPropertyType> validateValue = null,
BindingPropertyChangedDelegate<TPropertyType> propertyChanged = null, BindingPropertyChangingDelegate<TPropertyType> propertyChanging = null,
CoerceValueDelegate<TPropertyType> coerceValue = null, CreateDefaultValueDelegate<TDeclarer, TPropertyType> defaultValueCreator = null) where TDeclarer : BindableObject
{
return new BindablePropertyKey(Create(getter, defaultValue, defaultBindingMode, validateValue, propertyChanged, propertyChanging, coerceValue, null, true, defaultValueCreator));
}
public static BindablePropertyKey CreateReadOnly(string propertyName, Type returnType, Type declaringType, object defaultValue, BindingMode defaultBindingMode = BindingMode.OneWayToSource,
ValidateValueDelegate validateValue = null, BindingPropertyChangedDelegate propertyChanged = null, BindingPropertyChangingDelegate propertyChanging = null,
CoerceValueDelegate coerceValue = null, CreateDefaultValueDelegate defaultValueCreator = null)
@ -206,48 +162,6 @@ namespace Xamarin.Forms
isReadOnly: true, defaultValueCreator: defaultValueCreator));
}
[Obsolete("Create<> (generic) is obsolete as of version 2.1.0 and is no longer supported.")]
[EditorBrowsable(EditorBrowsableState.Never)]
internal static BindableProperty Create<TDeclarer, TPropertyType>(Expression<Func<TDeclarer, TPropertyType>> getter, TPropertyType defaultValue, BindingMode defaultBindingMode,
ValidateValueDelegate<TPropertyType> validateValue, BindingPropertyChangedDelegate<TPropertyType> propertyChanged, BindingPropertyChangingDelegate<TPropertyType> propertyChanging,
CoerceValueDelegate<TPropertyType> coerceValue, BindablePropertyBindingChanging bindingChanging, bool isReadOnly = false,
CreateDefaultValueDelegate<TDeclarer, TPropertyType> defaultValueCreator = null) where TDeclarer : BindableObject
{
if (getter == null)
throw new ArgumentNullException("getter");
Expression expr = getter.Body;
var unary = expr as UnaryExpression;
if (unary != null)
expr = unary.Operand;
var member = expr as MemberExpression;
if (member == null)
throw new ArgumentException("getter must be a MemberExpression", "getter");
var property = (PropertyInfo)member.Member;
ValidateValueDelegate untypedValidateValue = null;
BindingPropertyChangedDelegate untypedBindingPropertyChanged = null;
BindingPropertyChangingDelegate untypedBindingPropertyChanging = null;
CoerceValueDelegate untypedCoerceValue = null;
CreateDefaultValueDelegate untypedDefaultValueCreator = null;
if (validateValue != null)
untypedValidateValue = (bindable, value) => validateValue(bindable, (TPropertyType)value);
if (propertyChanged != null)
untypedBindingPropertyChanged = (bindable, oldValue, newValue) => propertyChanged(bindable, (TPropertyType)oldValue, (TPropertyType)newValue);
if (propertyChanging != null)
untypedBindingPropertyChanging = (bindable, oldValue, newValue) => propertyChanging(bindable, (TPropertyType)oldValue, (TPropertyType)newValue);
if (coerceValue != null)
untypedCoerceValue = (bindable, value) => coerceValue(bindable, (TPropertyType)value);
if (defaultValueCreator != null)
untypedDefaultValueCreator = o => defaultValueCreator((TDeclarer)o);
return new BindableProperty(property.Name, property.PropertyType, typeof(TDeclarer), defaultValue, defaultBindingMode, untypedValidateValue, untypedBindingPropertyChanged,
untypedBindingPropertyChanging, untypedCoerceValue, bindingChanging, isReadOnly, untypedDefaultValueCreator);
}
internal static BindableProperty Create(string propertyName, Type returnType, Type declaringType, object defaultValue, BindingMode defaultBindingMode, ValidateValueDelegate validateValue,
BindingPropertyChangedDelegate propertyChanged, BindingPropertyChangingDelegate propertyChanging, CoerceValueDelegate coerceValue, BindablePropertyBindingChanging bindingChanging,
CreateDefaultValueDelegate defaultValueCreator = null)
@ -256,52 +170,6 @@ namespace Xamarin.Forms
defaultValueCreator: defaultValueCreator);
}
[Obsolete("CreateAttached<> (generic) is obsolete as of version 2.1.0 and is no longer supported.")]
[EditorBrowsable(EditorBrowsableState.Never)]
internal static BindableProperty CreateAttached<TDeclarer, TPropertyType>(Expression<Func<BindableObject, TPropertyType>> staticgetter, TPropertyType defaultValue, BindingMode defaultBindingMode,
ValidateValueDelegate<TPropertyType> validateValue, BindingPropertyChangedDelegate<TPropertyType> propertyChanged, BindingPropertyChangingDelegate<TPropertyType> propertyChanging,
CoerceValueDelegate<TPropertyType> coerceValue, BindablePropertyBindingChanging bindingChanging, bool isReadOnly = false,
CreateDefaultValueDelegate<BindableObject, TPropertyType> defaultValueCreator = null)
{
if (staticgetter == null)
throw new ArgumentNullException("staticgetter");
Expression expr = staticgetter.Body;
var unary = expr as UnaryExpression;
if (unary != null)
expr = unary.Operand;
var methodcall = expr as MethodCallExpression;
if (methodcall == null)
throw new ArgumentException("staticgetter must be a MethodCallExpression", "staticgetter");
MethodInfo method = methodcall.Method;
if (!method.Name.StartsWith("Get", StringComparison.Ordinal))
throw new ArgumentException("staticgetter name must start with Get", "staticgetter");
string propertyname = method.Name.Substring(3);
ValidateValueDelegate untypedValidateValue = null;
BindingPropertyChangedDelegate untypedBindingPropertyChanged = null;
BindingPropertyChangingDelegate untypedBindingPropertyChanging = null;
CoerceValueDelegate untypedCoerceValue = null;
CreateDefaultValueDelegate untypedDefaultValueCreator = null;
if (validateValue != null)
untypedValidateValue = (bindable, value) => validateValue(bindable, (TPropertyType)value);
if (propertyChanged != null)
untypedBindingPropertyChanged = (bindable, oldValue, newValue) => propertyChanged(bindable, (TPropertyType)oldValue, (TPropertyType)newValue);
if (propertyChanging != null)
untypedBindingPropertyChanging = (bindable, oldValue, newValue) => propertyChanging(bindable, (TPropertyType)oldValue, (TPropertyType)newValue);
if (coerceValue != null)
untypedCoerceValue = (bindable, value) => coerceValue(bindable, (TPropertyType)value);
if (defaultValueCreator != null)
untypedDefaultValueCreator = o => defaultValueCreator(o);
return new BindableProperty(propertyname, method.ReturnType, typeof(TDeclarer), defaultValue, defaultBindingMode, untypedValidateValue, untypedBindingPropertyChanged, untypedBindingPropertyChanging,
untypedCoerceValue, bindingChanging, isReadOnly, untypedDefaultValueCreator);
}
internal static BindableProperty CreateAttached(string propertyName, Type returnType, Type declaringType, object defaultValue, BindingMode defaultBindingMode, ValidateValueDelegate validateValue,
BindingPropertyChangedDelegate propertyChanged, BindingPropertyChangingDelegate propertyChanging, CoerceValueDelegate coerceValue, BindablePropertyBindingChanging bindingChanging,
bool isReadOnly, CreateDefaultValueDelegate defaultValueCreator = null)

Просмотреть файл

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Xml;
@ -14,11 +11,6 @@ namespace Xamarin.Forms
[Xaml.TypeConversion(typeof(BindableProperty))]
public sealed class BindablePropertyConverter : TypeConverter, IExtendedTypeConverter
{
object IExtendedTypeConverter.ConvertFrom(CultureInfo culture, object value, IServiceProvider serviceProvider)
{
return ((IExtendedTypeConverter)this).ConvertFromInvariantString(value as string, serviceProvider);
}
object IExtendedTypeConverter.ConvertFromInvariantString(string value, IServiceProvider serviceProvider)
{
if (string.IsNullOrWhiteSpace(value))
@ -51,7 +43,7 @@ namespace Xamarin.Forms
}
else if (parentValuesProvider.TargetObject is Trigger)
type = (parentValuesProvider.TargetObject as Trigger).TargetType;
else if (parentValuesProvider.TargetObject is PropertyCondition && (parent as TriggerBase) != null)
else if (parentValuesProvider.TargetObject is PropertyCondition && parent is TriggerBase)
type = (parent as TriggerBase).TargetType;
if (type == null)

Просмотреть файл

@ -1,13 +1,8 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using Xamarin.Forms.Internals;
namespace Xamarin.Forms
{
@ -100,17 +95,6 @@ namespace Xamarin.Forms
}
}
[Obsolete]
[EditorBrowsable(EditorBrowsableState.Never)]
public static Binding Create<TSource>(Expression<Func<TSource, object>> propertyGetter, BindingMode mode = BindingMode.Default, IValueConverter converter = null, object converterParameter = null,
string stringFormat = null)
{
if (propertyGetter == null)
throw new ArgumentNullException(nameof(propertyGetter));
return new Binding(GetBindingPath(propertyGetter), mode, converter, converterParameter, stringFormat);
}
internal override void Apply(bool fromTarget)
{
base.Apply(fromTarget);
@ -326,95 +310,5 @@ namespace Xamarin.Forms
if (_expression != null)
_expression.Unapply();
}
[Obsolete]
[EditorBrowsable(EditorBrowsableState.Never)]
static string GetBindingPath<TSource>(Expression<Func<TSource, object>> propertyGetter)
{
Expression expr = propertyGetter.Body;
var unary = expr as UnaryExpression;
if (unary != null)
expr = unary.Operand;
var builder = new StringBuilder();
var indexed = false;
var member = expr as MemberExpression;
if (member == null)
{
var methodCall = expr as MethodCallExpression;
if (methodCall != null)
{
if (methodCall.Arguments.Count == 0)
throw new ArgumentException("Method calls are not allowed in binding expression");
var arguments = new List<string>(methodCall.Arguments.Count);
foreach (Expression arg in methodCall.Arguments)
{
if (arg.NodeType != ExpressionType.Constant)
throw new ArgumentException("Only constants can be used as indexer arguments");
object value = ((ConstantExpression)arg).Value;
arguments.Add(value != null ? value.ToString() : "null");
}
Type declarerType = methodCall.Method.DeclaringType;
DefaultMemberAttribute defaultMember = declarerType.GetTypeInfo().GetCustomAttributes(typeof(DefaultMemberAttribute), true).OfType<DefaultMemberAttribute>().FirstOrDefault();
string indexerName = defaultMember != null ? defaultMember.MemberName : "Item";
MethodInfo getterInfo =
declarerType.GetProperties().Where(pi => pi.Name == indexerName && pi.CanRead && pi.GetMethod.IsPublic && !pi.GetMethod.IsStatic).Select(pi => pi.GetMethod).FirstOrDefault();
if (getterInfo != null)
{
if (getterInfo == methodCall.Method)
{
indexed = true;
builder.Append("[");
var first = true;
foreach (string argument in arguments)
{
if (!first)
builder.Append(",");
builder.Append(argument);
first = false;
}
builder.Append("]");
member = methodCall.Object as MemberExpression;
}
else
throw new ArgumentException("Method calls are not allowed in binding expressions");
}
else
throw new ArgumentException("Public indexer not found");
}
else
throw new ArgumentException("Invalid expression type");
}
while (member != null)
{
var property = (PropertyInfo)member.Member;
if (builder.Length != 0)
{
if (!indexed)
builder.Insert(0, ".");
else
indexed = false;
}
builder.Insert(0, property.Name);
// member = member.Expression as MemberExpression ?? (member.Expression as UnaryExpression)?.Operand as MemberExpression;
member = member.Expression as MemberExpression ?? (member.Expression is UnaryExpression ? (member.Expression as UnaryExpression).Operand as MemberExpression : null);
}
return builder.ToString();
}
}
}

Просмотреть файл

@ -1,13 +0,0 @@
using System;
namespace Xamarin.Forms
{
[Xaml.TypeConversion(typeof(Binding))]
[Obsolete("Obsolete since XF 5.0.0")] //not used anywhere
public sealed class BindingTypeConverter : TypeConverter
{
public override object ConvertFromInvariantString(string value) => new Binding(value);
public override string ConvertToInvariantString(object value) => throw new NotImplementedException();
}
}

Просмотреть файл

@ -1,7 +1,6 @@
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Windows.Input;
using Xamarin.Forms.Internals;
@ -41,19 +40,10 @@ namespace Xamarin.Forms
public static readonly BindableProperty BorderColorProperty = BorderElement.BorderColorProperty;
[Obsolete("BorderRadiusProperty is obsolete as of 2.5.0. Please use CornerRadius instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public static readonly BindableProperty BorderRadiusProperty = BindableProperty.Create("BorderRadius", typeof(int), typeof(Button), defaultValue: DefaultBorderRadius,
propertyChanged: BorderRadiusPropertyChanged);
public static readonly BindableProperty CornerRadiusProperty = BindableProperty.Create("CornerRadius", typeof(int), typeof(Button), defaultValue: BorderElement.DefaultCornerRadius,
propertyChanged: CornerRadiusPropertyChanged);
public static readonly BindableProperty ImageSourceProperty = ImageElement.ImageProperty;
[Obsolete("ImageProperty is obsolete as of 4.0.0. Please use ImageSourceProperty instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public static readonly BindableProperty ImageProperty = ImageElement.ImageProperty;
public static readonly BindableProperty ImageSourceProperty = ImageElement.ImageSourceProperty;
public static readonly BindableProperty PaddingProperty = PaddingElement.PaddingProperty;
@ -95,14 +85,6 @@ namespace Xamarin.Forms
set { SetValue(BorderElement.BorderColorProperty, value); }
}
[Obsolete("BorderRadius is obsolete as of 2.5.0. Please use CornerRadius instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public int BorderRadius
{
get { return (int)GetValue(BorderRadiusProperty); }
set { SetValue(BorderRadiusProperty, value); }
}
public int CornerRadius
{
get { return (int)GetValue(CornerRadiusProperty); }
@ -145,14 +127,6 @@ namespace Xamarin.Forms
set { SetValue(ImageSourceProperty, value); }
}
[Obsolete("Image is obsolete as of 4.0.0. Please use ImageSource instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public FileImageSource Image
{
get { return GetValue(ImageProperty) as FileImageSource; }
set { SetValue(ImageProperty, value); }
}
public string Text
{
get { return (string)GetValue(TextProperty); }
@ -326,19 +300,6 @@ namespace Xamarin.Forms
var val = (int)newvalue;
if (val == BorderElement.DefaultCornerRadius && !button.cornerOrBorderRadiusSetting)
val = DefaultBorderRadius;
#pragma warning disable 0618 // retain until BorderRadiusProperty removed
var oldVal = (int)bindable.GetValue(Button.BorderRadiusProperty);
#pragma warning restore
if (oldVal == val)
return;
#pragma warning disable 0618 // retain until BorderRadiusProperty removed
button.cornerOrBorderRadiusSetting = true;
bindable.SetValue(Button.BorderRadiusProperty, val);
button.cornerOrBorderRadiusSetting = false;
#pragma warning restore
}
void ITextElement.OnTextColorPropertyChanged(Color oldValue, Color newValue)

Просмотреть файл

@ -19,10 +19,6 @@ namespace Xamarin.Forms
public static readonly BindableProperty VerticalTextAlignmentProperty = TextAlignmentElement.VerticalTextAlignmentProperty;
[Obsolete("XAlignProperty is obsolete as of version 2.0.0. Please use HorizontalTextAlignmentProperty instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public static readonly BindableProperty XAlignProperty = HorizontalTextAlignmentProperty;
public TextAlignment HorizontalTextAlignment
{
get { return (TextAlignment)GetValue(TextAlignmentElement.HorizontalTextAlignmentProperty); }
@ -65,14 +61,6 @@ namespace Xamarin.Forms
set { SetValue(TextProperty, value); }
}
[Obsolete("XAlign is obsolete as of version 2.0.0. Please use HorizontalTextAlignment instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public TextAlignment XAlign
{
get { return (TextAlignment)GetValue(XAlignProperty); }
set { SetValue(XAlignProperty, value); }
}
public event EventHandler Completed;
[EditorBrowsable(EditorBrowsableState.Never)]
@ -81,9 +69,6 @@ namespace Xamarin.Forms
void ITextAlignmentElement.OnHorizontalTextAlignmentPropertyChanged(TextAlignment oldValue, TextAlignment newValue)
{
#pragma warning disable 0618 // retain until XAlign removed
OnPropertyChanged(nameof(XAlign));
#pragma warning restore
}
}
}

Просмотреть файл

@ -32,28 +32,6 @@ namespace Xamarin.Forms
[EditorBrowsable(EditorBrowsableState.Never)]
public static void SetTargetIdiom(TargetIdiom value) => Idiom = value;
[Obsolete("TargetPlatform is obsolete as of version 2.3.4. Please use RuntimePlatform instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
#pragma warning disable 0618
public static TargetPlatform OS
{
get
{
TargetPlatform platform;
if (Enum.TryParse(RuntimePlatform, out platform))
return platform;
// In the old TargetPlatform, there was no distinction between WinRT/UWP
if (RuntimePlatform == UWP)
{
return TargetPlatform.Windows;
}
return TargetPlatform.Other;
}
}
#pragma warning restore 0618
public static string RuntimePlatform => PlatformServices.RuntimePlatform;
[EditorBrowsable(EditorBrowsableState.Never)]
@ -178,62 +156,6 @@ namespace Xamarin.Forms
return GetNamedSize(size, targetElementType, false);
}
[Obsolete("OnPlatform is obsolete as of version 2.3.4. Please use 'switch (Device.RuntimePlatform)' instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public static void OnPlatform(Action iOS = null, Action Android = null, Action WinPhone = null, Action Default = null)
{
switch (OS)
{
case TargetPlatform.iOS:
if (iOS != null)
iOS();
else if (Default != null)
Default();
break;
case TargetPlatform.Android:
if (Android != null)
Android();
else if (Default != null)
Default();
break;
case TargetPlatform.Windows:
case TargetPlatform.WinPhone:
if (WinPhone != null)
WinPhone();
else if (Default != null)
Default();
break;
case TargetPlatform.Other:
if (Default != null)
Default();
break;
}
}
[Obsolete("OnPlatform<> (generic) is obsolete as of version 2.3.4. Please use 'switch (Device.RuntimePlatform)' instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public static T OnPlatform<T>(T iOS, T Android, T WinPhone)
{
switch (OS)
{
case TargetPlatform.iOS:
return iOS;
case TargetPlatform.Android:
return Android;
case TargetPlatform.Windows:
case TargetPlatform.WinPhone:
return WinPhone;
}
return iOS;
}
[Obsolete("OpenUri is obsolete as of version 4.3.0. Use Launcher.OpenAsync (or CanOpenAsync, or TryOpenAsync) from Xamarin.Essentials instead.")]
public static void OpenUri(Uri uri)
{
PlatformServices.OpenUriAction(uri);
}
public static void StartTimer(TimeSpan interval, Func<bool> callback)
{
PlatformServices.StartTimer(interval, callback);

Просмотреть файл

@ -334,9 +334,6 @@ namespace Xamarin.Forms
OnDescendantAdded(element);
}
[Obsolete("OnChildRemoved(Element) is obsolete as of version 4.8.0. Please use OnChildRemoved(Element, int) instead.")]
protected virtual void OnChildRemoved(Element child) => OnChildRemoved(child, -1);
protected virtual void OnChildRemoved(Element child, int oldLogicalIndex)
{
child.Parent = null;
@ -598,41 +595,5 @@ namespace Xamarin.Forms
{
SetValueCore(property, value, SetValueFlags.ClearOneWayBindings | SetValueFlags.ClearTwoWayBindings);
}
#region Obsolete IPlatform Stuff
#pragma warning disable CS0618 // Type or member is obsolete
private IPlatform _platform;
#pragma warning restore CS0618 // Type or member is obsolete
// Platform isn't needed anymore, but the Previewer will still try to set it via reflection
// and throw an NRE if it's not available
// So even if this property eventually gets removed, we still need to keep something settable on
// Page called Platform
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("IPlatform is obsolete as of 3.5.0. Do not use this property.")]
public IPlatform Platform
{
get => _platform;
set
{
if (_platform == value)
return;
_platform = value;
PlatformSet?.Invoke(this, EventArgs.Empty);
foreach (Element descendant in Descendants())
{
descendant._platform = _platform;
descendant.PlatformSet?.Invoke(this, EventArgs.Empty);
}
}
}
[Obsolete("PlatformSet is obsolete as of 3.5.0. Do not use this event.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public event EventHandler PlatformSet;
#endregion
}
}

Просмотреть файл

@ -1,5 +1,4 @@
using System;
using System.ComponentModel;
using System.Globalization;
using Xamarin.Forms.Xaml;
@ -8,11 +7,6 @@ namespace Xamarin.Forms
[TypeConversion(typeof(double))]
public class FontSizeConverter : TypeConverter, IExtendedTypeConverter
{
[Obsolete("IExtendedTypeConverter.ConvertFrom is obsolete as of version 2.2.0. Please use ConvertFromInvariantString (string, IServiceProvider) instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
object IExtendedTypeConverter.ConvertFrom(CultureInfo culture, object value, IServiceProvider serviceProvider)
=> ((IExtendedTypeConverter)this).ConvertFromInvariantString(value as string, serviceProvider);
object IExtendedTypeConverter.ConvertFromInvariantString(string value, IServiceProvider serviceProvider)
{
if (value != null)

Просмотреть файл

@ -12,7 +12,7 @@ namespace Xamarin.Forms
// And other scenarios
public static void InitHandlers()
{
Platform.Registrar.Handlers.Register(typeof(Label), typeof(LabelHandler));
//Xamarin.Platform.Registrar.Handlers.Register<Label, LabelHandler>();
Xamarin.Platform.Registrar.Handlers.Register<VerticalStackLayout, LayoutHandler>();
Xamarin.Platform.Registrar.Handlers.Register<HorizontalStackLayout, LayoutHandler>();
}

Просмотреть файл

@ -1,15 +1,10 @@
using System;
using System.ComponentModel;
namespace Xamarin.Forms
{
[ContentProperty("Content")]
public class Frame : ContentView, IElementConfiguration<Frame>, IPaddingElement, IBorderElement
{
[Obsolete("OutlineColorProperty is obsolete as of version 3.0.0. Please use BorderColorProperty instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public static readonly BindableProperty OutlineColorProperty = BorderElement.BorderColorProperty;
public static readonly BindableProperty BorderColorProperty = BorderElement.BorderColorProperty;
public static readonly BindableProperty HasShadowProperty = BindableProperty.Create("HasShadow", typeof(bool), typeof(Frame), true);
@ -35,14 +30,6 @@ namespace Xamarin.Forms
set { SetValue(HasShadowProperty, value); }
}
[Obsolete("OutlineColor is obsolete as of version 3.0.0. Please use BorderColor instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public Color OutlineColor
{
get { return (Color)GetValue(OutlineColorProperty); }
set { SetValue(OutlineColorProperty, value); }
}
public Color BorderColor
{
get { return (Color)GetValue(BorderElement.BorderColorProperty); }
@ -73,9 +60,6 @@ namespace Xamarin.Forms
void IBorderElement.OnBorderColorPropertyChanged(Color oldValue, Color newValue)
{
#pragma warning disable 0618 // retain until OutlineColor removed
OnPropertyChanged(nameof(OutlineColor));
#pragma warning restore
}
bool IBorderElement.IsCornerRadiusSet() => IsSet(CornerRadiusProperty);

Просмотреть файл

@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using Xamarin.Forms.Internals;
namespace Xamarin.Forms
{
@ -17,13 +14,5 @@ namespace Xamarin.Forms
ReadOnlyCollection<Element> LogicalChildren { get; }
Element RealParent { get; }
IEnumerable<Element> Descendants();
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("IPlatform is obsolete as of 3.5.0. Do not use this property.")]
IPlatform Platform { get; set; }
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("PlatformSet is obsolete as of 3.5.0. Do not use this event.")]
event EventHandler PlatformSet;
}
}

Просмотреть файл

@ -1,15 +1,9 @@
using System;
using System.ComponentModel;
using System.Globalization;
namespace Xamarin.Forms
{
public interface IExtendedTypeConverter
{
[Obsolete("IExtendedTypeConverter.ConvertFrom is obsolete as of version 2.2.0. Please use ConvertFromInvariantString (string, IServiceProvider) instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
object ConvertFrom(CultureInfo culture, object value, IServiceProvider serviceProvider);
object ConvertFromInvariantString(string value, IServiceProvider serviceProvider);
}
}

Просмотреть файл

@ -1,4 +1,3 @@
using System;
using System.ComponentModel;
namespace Xamarin.Forms
@ -8,8 +7,5 @@ namespace Xamarin.Forms
{
bool IsEnabled { get; set; }
void Activate();
[Obsolete("This property is obsolete as of 3.5.0. Please use MenuItem.IsEnabledProperty.PropertyName instead.")]
string IsEnabledPropertyName { get; }
}
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше