* 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 public class _51173CustomImageRenderer : ImageRenderer
#pragma warning restore 618 #pragma warning restore 618
{ {
public _51173CustomImageRenderer(Context context) : base(context)
{
}
protected override async Task TryUpdateBitmap(Image previous = null) protected override async Task TryUpdateBitmap(Image previous = null)
{ {
try try

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

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

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

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

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

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

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

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

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

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

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

@ -5,13 +5,13 @@
<StackLayout Spacing="10"> <StackLayout Spacing="10">
<Button BackgroundColor="Color.Gray" Text="Click Me"></Button> <Button BackgroundColor="Color.Gray" Text="Click Me"></Button>
<Button BackgroundColor="Color.Gray" Image="coffee.png"></Button> <Button BackgroundColor="Color.Gray" ImageSource="coffee.png"></Button>
<Button BackgroundColor="Color.Gray" Image="coffee.png" Text="Click Me"></Button> <Button BackgroundColor="Color.Gray" ImageSource="coffee.png" Text="Click Me"></Button>
<Button BackgroundColor="Color.Gray" Image="coffee.png" Text="Click Me" ContentLayout="Top,10"></Button> <Button BackgroundColor="Color.Gray" ImageSource="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" ImageSource="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" 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> </StackLayout>
</ContentPage> </ContentPage>

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

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

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

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

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

@ -38,9 +38,7 @@ namespace Xamarin.Forms.Controls.Issues
Text = "Add pins", Text = "Add pins",
Command = new Command (() => { Command = new Command (() => {
foreach (var pin in map.Pins) { foreach (var pin in map.Pins) {
#pragma warning disable CS0618 pin.MarkerClicked -= PinClicked;
pin.Clicked -= PinClicked;
#pragma warning restore CS0618
} }
map.Pins.Clear (); map.Pins.Clear ();
@ -61,9 +59,9 @@ namespace Xamarin.Forms.Controls.Issues
Type = PinType.Place, Type = PinType.Place,
Position = new Position (map.VisibleRegion.Center.Latitude + lat, map.VisibleRegion.Center.Longitude + lng) Position = new Position (map.VisibleRegion.Center.Latitude + lat, map.VisibleRegion.Center.Longitude + lng)
}; };
#pragma warning disable CS0618
pin.Clicked += PinClicked; pin.MarkerClicked += PinClicked;
#pragma warning restore CS0618
map.Pins.Add (pin); 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 = { Children = {
new Label { new Label {
#pragma warning disable 618 HorizontalTextAlignment = TextAlignment.Center,
XAlign = TextAlignment.Center,
#pragma warning restore 618
Text = "Page 1" Text = "Page 1"
} }
} }
@ -36,9 +34,7 @@ namespace Xamarin.Forms.Controls.Issues
{ {
Children = { Children = {
new Label { new Label {
#pragma warning disable 618 HorizontalTextAlignment = TextAlignment.Center,
XAlign = TextAlignment.Center,
#pragma warning restore 618
Text = "Page 2" Text = "Page 2"
} }
} }

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

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

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

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

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

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

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

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

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

@ -21,9 +21,7 @@ namespace Xamarin.Forms.Controls.Issues
protected override void Init() protected override void Init()
{ {
#pragma warning disable 618 var label = new Label() { HorizontalTextAlignment = TextAlignment.Center };
var label = new Label() { XAlign = TextAlignment.Center };
#pragma warning restore 618
var image = new Image(); var image = new Image();
image.PropertyChanged += (sender, e) => 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 Label header = new Label
{ {
Text = "Should not see blue", Text = "Should not see blue",
#pragma warning disable 618 FontSize = 40,
Font = Font.BoldSystemFontOfSize(40), FontAttributes = FontAttributes.Bold,
#pragma warning restore 618
HorizontalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center,
TextColor = Color.Black TextColor = Color.Black
}; };

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

@ -8,10 +8,11 @@
<OnPlatform <OnPlatform
x:Key="SizeMedium" x:Key="SizeMedium"
x:TypeArguments="x:Double" x:TypeArguments="x:Double">
iOS="40" <On Platform="iOS" Value="40"/>
Android="30" <On Platform="Android" Value="30"/>
WinPhone="60" /> <On Platform="UWP" Value="60"/>
</OnPlatform>
<x:Double x:Key="SizeLarge">80</x:Double> <x:Double x:Key="SizeLarge">80</x:Double>
@ -25,10 +26,11 @@
<BoxView HorizontalOptions="Center" VerticalOptions="Center" BackgroundColor="Blue" WidthRequest="{StaticResource SizeMedium}"> <BoxView HorizontalOptions="Center" VerticalOptions="Center" BackgroundColor="Blue" WidthRequest="{StaticResource SizeMedium}">
<BoxView.HeightRequest> <BoxView.HeightRequest>
<OnPlatform <OnPlatform
x:TypeArguments="x:Double" x:TypeArguments="x:Double">
iOS="40" <On Platform="iOS" Value="40"/>
Android="30" <On Platform="Android" Value="30"/>
WinPhone="60" /> <On Platform="UWP" Value="60"/>
</OnPlatform>
</BoxView.HeightRequest> </BoxView.HeightRequest>
</BoxView> </BoxView>
<BoxView HorizontalOptions="Center" VerticalOptions="Center" BackgroundColor="Red" WidthRequest="{StaticResource SizeLarge}"> <BoxView HorizontalOptions="Center" VerticalOptions="Center" BackgroundColor="Red" WidthRequest="{StaticResource SizeLarge}">

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -8,7 +8,7 @@
<Label Text="HEADER" Font="40" /> <Label Text="HEADER" Font="40" />
</StackLayout> </StackLayout>
<StackLayout Padding="22,0,22,22"> <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"> <StackLayout IsClippedToBounds="true">
<ScrollView HeightRequest="980" BackgroundColor="Aqua" IsClippedToBounds="true"> <ScrollView HeightRequest="980" BackgroundColor="Aqua" IsClippedToBounds="true">
<StackLayout x:Name="addonGroupStack" Spacing="1" ></StackLayout> <StackLayout x:Name="addonGroupStack" Spacing="1" ></StackLayout>

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

@ -8,7 +8,7 @@
<Label Text="HEADER" Font="40" /> <Label Text="HEADER" Font="40" />
</StackLayout> </StackLayout>
<StackLayout Padding="22,0,22,22"> <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"> <ScrollView HeightRequest="980" BackgroundColor="Aqua" IsClippedToBounds="true">
<StackLayout x:Name="addonGroupStack" Spacing="1" ></StackLayout> <StackLayout x:Name="addonGroupStack" Spacing="1" ></StackLayout>
</ScrollView> </ScrollView>

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

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

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

@ -116,10 +116,8 @@ namespace Xamarin.Forms.Controls.Issues
tabbedPage.Children.Add(Issue1898PageOne); tabbedPage.Children.Add(Issue1898PageOne);
tabbedPage.Children.Add(Issue1898PageTwo); tabbedPage.Children.Add(Issue1898PageTwo);
#pragma warning disable CS0618 // Type or member is obsolete tabbedPage.On<Android>().Element.UnselectedTabColor =Color.Blue;
tabbedPage.On<Android>().SetBarItemColor(Color.Blue); tabbedPage.On<Android>().Element.SelectedTabColor = Color.Green;
tabbedPage.On<Android>().SetBarSelectedItemColor(Color.Green);
#pragma warning restore CS0618 // Type or member is obsolete
tabbedPage.On<Android>().SetToolbarPlacement(placement); tabbedPage.On<Android>().SetToolbarPlacement(placement);
tabbedPage.On<WindowsOS>().SetHeaderIconsEnabled(true); 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 ("Bob", new DateTime (1976, 2, 20), Color.Black),
new Person ("Cathy", new DateTime (1977, 3, 10), Color.Blue), new Person ("Cathy", new DateTime (1977, 3, 10), Color.Blue),
#pragma warning disable 618 #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 #pragma warning restore 618
}; };

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -34,7 +34,7 @@ namespace Xamarin.Forms.Controls.Issues
var layout = new StackLayout { Padding = new Thickness(5, 10) }; var layout = new StackLayout { Padding = new Thickness(5, 10) };
var formattedString = new FormattedString(); 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 });
formattedString.Spans.Add(new Span { Text = Environment.NewLine }); formattedString.Spans.Add(new Span { Text = Environment.NewLine });
var span = new Span { Text = "Clickable, " }; 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 Spacing="0">
<StackLayout Orientation="Horizontal" Margin="0, 5, 0, 20"> <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> <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>
<StackLayout Orientation="Horizontal" Margin="0, 5, 0, 5"> <StackLayout Orientation="Horizontal" Margin="0, 5, 0, 5">
<Label class="RadioText" FontAttributes="Bold" VerticalTextAlignment="Center">I agree</Label> <Label class="RadioText" FontAttributes="Bold" VerticalTextAlignment="Center">I agree</Label>
<Switch x:Name="rbTerms" HorizontalOptions="StartAndExpand" /> <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>
</StackLayout> </StackLayout>
</Frame> </Frame>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -18,37 +18,21 @@ namespace Xamarin.Forms.Controls
{ {
base.Build(stackLayout); base.Build(stackLayout);
#pragma warning disable 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 });
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
#pragma warning disable 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 });
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
#pragma warning disable 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 });
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
#pragma warning disable 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 });
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
#pragma warning disable 618 var namedSizeLargeContainer = new ViewContainer<Label>(Test.Label.FontNamedSizeLarge, new Label { Text = "Large Font", FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)) });
var namedSizeLargeContainer = new ViewContainer<Label>(Test.Label.FontNamedSizeLarge, new Label { Text = "Large Font", Font = Font.SystemFontOfSize(NamedSize.Large) });
#pragma warning restore 618
#pragma warning disable 618 var namedSizeMediumContainer = new ViewContainer<Label>(Test.Label.FontNamedSizeMedium, new Label { Text = "Medium Font", FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) });
var namedSizeMediumContainer = new ViewContainer<Label>(Test.Label.FontNamedSizeMedium, new Label { Text = "Medium Font", Font = Font.SystemFontOfSize(NamedSize.Medium) });
#pragma warning restore 618
#pragma warning disable 618 var namedSizeMicroContainer = new ViewContainer<Label>(Test.Label.FontNamedSizeMicro, new Label { Text = "Micro Font", FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) });
var namedSizeMicroContainer = new ViewContainer<Label>(Test.Label.FontNamedSizeMicro, new Label { Text = "Micro Font", Font = Font.SystemFontOfSize(NamedSize.Micro) });
#pragma warning restore 618
#pragma warning disable 618 var namedSizeSmallContainer = new ViewContainer<Label>(Test.Label.FontNamedSizeSmall, new Label { Text = "Small Font", FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)) });
var namedSizeSmallContainer = new ViewContainer<Label>(Test.Label.FontNamedSizeSmall, new Label { Text = "Small Font", Font = Font.SystemFontOfSize(NamedSize.Small) });
#pragma warning restore 618
var formattedString = new FormattedString(); var formattedString = new FormattedString();
formattedString.Spans.Add(new Span { BackgroundColor = Color.Red, TextColor = Color.Olive, Text = "Span 1 " }); formattedString.Spans.Add(new Span { BackgroundColor = Color.Red, TextColor = Color.Olive, Text = "Span 1 " });

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

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

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

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

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

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

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

@ -22,17 +22,17 @@
<StackLayout Orientation="Vertical" Padding="0" Spacing="5"> <StackLayout Orientation="Vertical" Padding="0" Spacing="5">
<Button /> <Button />
<Button Text="Some Text" /> <Button Text="Some Text" />
<Button Image="bank.png" /> <Button ImageSource="bank.png" />
<Button Text="Some Text" Image="bank.png" /> <Button Text="Some Text" ImageSource="bank.png" />
<Button Text="Some Text" Image="bank.png" ContentLayout="Top, 8" /> <Button Text="Some Text" ImageSource="bank.png" ContentLayout="Top, 8" />
<Button Text="Some Text" Image="bank.png" ContentLayout="Right, 8" /> <Button Text="Some Text" ImageSource="bank.png" ContentLayout="Right, 8" />
<Button Text="Some Text" Image="bank.png" ContentLayout="Bottom, 8" /> <Button Text="Some Text" ImageSource="bank.png" ContentLayout="Bottom, 8" />
<Button Text="Some Text" Image="bank.png" ContentLayout="Left, 8" /> <Button Text="Some Text" ImageSource="bank.png" ContentLayout="Left, 8" />
</StackLayout> </StackLayout>
<Label Text="Autosized:" Margin="0,0,0,-5" /> <Label Text="Autosized:" Margin="0,0,0,-5" />
<StackLayout Orientation="Horizontal" Padding="0" Spacing="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> </StackLayout>
<Label Text="Explicit Size:" Margin="0,0,0,-5" /> <Label Text="Explicit Size:" Margin="0,0,0,-5" />
@ -47,19 +47,19 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Button <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" /> WidthRequest="120" HeightRequest="60" HorizontalOptions="Start" VerticalOptions="Start" />
<Button <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" /> Grid.Column="1" Grid.RowSpan="2" WidthRequest="120" HorizontalOptions="Start" VerticalOptions="Start" />
<Button <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.Row="1" Grid.ColumnSpan="2" HeightRequest="60" HorizontalOptions="Start" VerticalOptions="Start" />
</Grid> </Grid>
<Label Text="Stretched:" Margin="0,0,0,-5" /> <Label Text="Stretched:" Margin="0,0,0,-5" />
<StackLayout Orientation="Vertical" Padding="0" Spacing="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> </StackLayout>
<Label Text="Options:" Margin="0,5,0,0" FontAttributes="Bold" /> <Label Text="Options:" Margin="0,5,0,0" FontAttributes="Bold" />

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

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

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

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

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

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

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

@ -92,14 +92,6 @@ namespace Xamarin.Forms.Controls
rootNavPage.BarBackgroundColor = Color.Default; 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 { new Button {
Text = "Black background, white text", Text = "Black background, white text",
Command = new Command (() => { Command = new Command (() => {

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

@ -28,14 +28,14 @@
</VisualStateManager.VisualStateGroups> </VisualStateManager.VisualStateGroups>
</Label> </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> <VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="ColorStates"> <VisualStateGroup x:Name="ColorStates">
<VisualState x:Name="Normal" /> <VisualState x:Name="Normal" />
<VisualState x:Name="Invalid"> <VisualState x:Name="Invalid">
<VisualState.Setters> <VisualState.Setters>
<Setter Property="TextColor" Value="DarkRed"/> <Setter Property="TextColor" Value="DarkRed"/>
<Setter Property="Image" Value="toolbar_close.png"/> <Setter Property="ImageSource" Value="toolbar_close.png"/>
</VisualState.Setters> </VisualState.Setters>
</VisualState> </VisualState>
</VisualStateGroup> </VisualStateGroup>

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

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

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

@ -24,9 +24,9 @@
<Image x:Name="completedimg" HorizontalOptions="Start" VerticalOptions="Center" Grid.Row="0" Grid.Column="0" IsVisible="true"/> <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="........................................................................................................................................................................." 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> </Grid>

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

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

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

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

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

@ -87,25 +87,25 @@
<ShellContent Route="movies" Style="{StaticResource MoviesShell}" Title="Movies &amp; TV" <ShellContent Route="movies" Style="{StaticResource MoviesShell}" Title="Movies &amp; TV"
Icon="film.png" FlyoutIcon="filmflyout.png" ContentTemplate="{DataTemplate local:MoviesPage}"> Icon="film.png" FlyoutIcon="filmflyout.png" ContentTemplate="{DataTemplate local:MoviesPage}">
<ShellContent.MenuItems> <ShellContent.MenuItems>
<MenuItem Icon="film.png" Text="Open Movies App" /> <MenuItem IconImageSource="film.png" Text="Open Movies App" />
</ShellContent.MenuItems> </ShellContent.MenuItems>
</ShellContent> </ShellContent>
<ShellContent Route="books" Style="{StaticResource BooksShell}" Title="Books" <ShellContent Route="books" Style="{StaticResource BooksShell}" Title="Books"
Icon="books.png" FlyoutIcon="booksflyout.png" ContentTemplate="{DataTemplate local:BooksPage}"> Icon="books.png" FlyoutIcon="booksflyout.png" ContentTemplate="{DataTemplate local:BooksPage}">
<ShellContent.MenuItems> <ShellContent.MenuItems>
<MenuItem Icon="books.png" Text="Open Reader" /> <MenuItem IconImageSource="books.png" Text="Open Reader" />
</ShellContent.MenuItems> </ShellContent.MenuItems>
</ShellContent> </ShellContent>
<ShellContent Route="music" Style="{StaticResource MusicShell}" Title="Music" <ShellContent Route="music" Style="{StaticResource MusicShell}" Title="Music"
Icon="headphone.png" FlyoutIcon="headphoneflyout.png" ContentTemplate="{DataTemplate local:MusicPage}"> Icon="headphone.png" FlyoutIcon="headphoneflyout.png" ContentTemplate="{DataTemplate local:MusicPage}">
<ShellContent.MenuItems> <ShellContent.MenuItems>
<MenuItem Icon="headphone.png" Text="Open Music App" /> <MenuItem IconImageSource="headphone.png" Text="Open Music App" />
</ShellContent.MenuItems> </ShellContent.MenuItems>
</ShellContent> </ShellContent>
<ShellContent Route="news" Style="{StaticResource NewsShell}" Title="Newsstand" <ShellContent Route="news" Style="{StaticResource NewsShell}" Title="Newsstand"
Icon="newspaper.png" FlyoutIcon="newspaperflyout.png" ContentTemplate="{DataTemplate local:NewsPage}"> Icon="newspaper.png" FlyoutIcon="newspaperflyout.png" ContentTemplate="{DataTemplate local:NewsPage}">
<ShellContent.MenuItems> <ShellContent.MenuItems>
<MenuItem Icon="newspaper.png" Text="Open News App" /> <MenuItem IconImageSource="newspaper.png" Text="Open News App" />
</ShellContent.MenuItems> </ShellContent.MenuItems>
</ShellContent> </ShellContent>
</ShellItem> </ShellItem>
@ -122,7 +122,7 @@
<ShellContent Route="wishlist" Title="Wishlist" Icon="star.png" ContentTemplate="{DataTemplate local:WishlistPage}" /> <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}" /> <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="mediumTextSize">20</x:Double>
<x:Double x:Key="smallTextSize">14</x:Double> <x:Double x:Key="smallTextSize">14</x:Double>
<x:Double x:Key="standardPadding">10</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"> <Style x:Key="NakedButton" TargetType="Button">
<Setter Property="BackgroundColor" Value="Transparent" /> <Setter Property="BackgroundColor" Value="Transparent" />
<Setter Property="TextColor" Value="{StaticResource accentColor}" /> <Setter Property="TextColor" Value="{StaticResource accentColor}" />

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

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

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

@ -13,20 +13,12 @@ namespace Xamarin
{ {
public static bool IsInitialized { get; private set; } 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) public static void Init(Activity activity, Bundle bundle)
{ {
if (IsInitialized) if (IsInitialized)
return; return;
IsInitialized = true; 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; MapRenderer.Bundle = bundle;
#pragma warning disable 618 #pragma warning disable 618

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

@ -42,13 +42,6 @@ namespace Xamarin.Forms.Maps.Android
AutoPackage = false; 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 Map Map => Element;
protected GoogleMap NativeMap; protected GoogleMap NativeMap;
@ -368,9 +361,7 @@ namespace Xamarin.Forms.Maps.Android
return; return;
} }
#pragma warning disable CS0618 pin.SendMarkerClick();
pin.SendTap();
#pragma warning restore CS0618
// SendInfoWindowClick() returns the value of PinClickedEventArgs.HideInfoWindow // SendInfoWindowClick() returns the value of PinClickedEventArgs.HideInfoWindow
bool hideInfoWindow = pin.SendInfoWindowClick(); bool hideInfoWindow = pin.SendInfoWindowClick();

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

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

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

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

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

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

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

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

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

@ -320,9 +320,7 @@ namespace Xamarin.Forms.Maps.MacOS
if (_lastTouchedView is MKAnnotationView) if (_lastTouchedView is MKAnnotationView)
return; return;
#pragma warning disable CS0618 targetPin.SendMarkerClick();
targetPin.SendTap();
#pragma warning restore CS0618
// SendInfoWindowClick() returns the value of PinClickedEventArgs.HideInfoWindow // SendInfoWindowClick() returns the value of PinClickedEventArgs.HideInfoWindow
// Hide the info window by deselecting the annotation // Hide the info window by deselecting the annotation

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

@ -39,20 +39,6 @@ namespace Xamarin.Forms.Maps
set { SetValue(TypeProperty, value); } 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)] [EditorBrowsable(EditorBrowsableState.Never)]
public object MarkerId 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> MarkerClicked;
public event EventHandler<PinClickedEventArgs> InfoWindowClicked; public event EventHandler<PinClickedEventArgs> InfoWindowClicked;
@ -105,18 +88,6 @@ namespace Xamarin.Forms.Maps
return !Equals(left, right); 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)] [EditorBrowsable(EditorBrowsableState.Never)]
public bool SendMarkerClick() 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] [Theory]
[InlineData("#FF0000", "#00FFFF")] // Red & Cyan [InlineData("#FF0000", "#00FFFF")] // Red & Cyan
[InlineData("#00FF00", "#FF00FF")] // Green & Fuschia [InlineData("#00FF00", "#FF00FF")] // Green & Fuchsia
[InlineData("#0000FF", "#FFFF00")] // Blue & Yellow [InlineData("#0000FF", "#FFFF00")] // Blue & Yellow
[InlineData("#0AF56C", "#F50A93")] // Lime green & bright purple (but with no limit values) [InlineData("#0AF56C", "#F50A93")] // Lime green & bright purple (but with no limit values)
public void GetComplementary(string original, string expected) public void GetComplementary(string original, string expected)

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

@ -73,9 +73,6 @@ namespace Xamarin.Forms
child.PropertyChanged += ChildOnPropertyChanged; 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) protected override void OnChildRemoved(Element child, int oldLogicalIndex)
{ {
child.PropertyChanged -= ChildOnPropertyChanged; child.PropertyChanged -= ChildOnPropertyChanged;

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

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

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

@ -167,14 +167,6 @@ namespace Xamarin.Forms
return resultArray; 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) public bool IsSet(BindableProperty targetProperty)
{ {
var bpcontext = GetContext(targetProperty ?? throw new ArgumentNullException(nameof(targetProperty))); var bpcontext = GetContext(targetProperty ?? throw new ArgumentNullException(nameof(targetProperty)));

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

@ -1,7 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Linq.Expressions;
namespace Xamarin.Forms namespace Xamarin.Forms
{ {
@ -41,22 +39,6 @@ namespace Xamarin.Forms
self.SetBinding(targetProperty, binding); 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) public static T GetPropertyIfSet<T>(this BindableObject bindableObject, BindableProperty bindableProperty, T returnIfNotSet)
{ {
if (bindableObject == null) if (bindableObject == null)

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

@ -129,16 +129,6 @@ namespace Xamarin.Forms
internal ValidateValueDelegate ValidateValue { get; private set; } 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, 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, ValidateValueDelegate validateValue = null, BindingPropertyChangedDelegate propertyChanged = null, BindingPropertyChangingDelegate propertyChanging = null,
CoerceValueDelegate coerceValue = null, CreateDefaultValueDelegate defaultValueCreator = null) CoerceValueDelegate coerceValue = null, CreateDefaultValueDelegate defaultValueCreator = null)
@ -147,17 +137,6 @@ namespace Xamarin.Forms
defaultValueCreator: defaultValueCreator); 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, 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, ValidateValueDelegate validateValue = null, BindingPropertyChangedDelegate propertyChanged = null, BindingPropertyChangingDelegate propertyChanging = null,
CoerceValueDelegate coerceValue = null, CreateDefaultValueDelegate defaultValueCreator = 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); 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, 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, ValidateValueDelegate validateValue = null, BindingPropertyChangedDelegate propertyChanged = null, BindingPropertyChangingDelegate propertyChanging = null,
CoerceValueDelegate coerceValue = null, CreateDefaultValueDelegate defaultValueCreator = null) CoerceValueDelegate coerceValue = null, CreateDefaultValueDelegate defaultValueCreator = null)
@ -187,16 +153,6 @@ namespace Xamarin.Forms
defaultValueCreator)); 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, 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, ValidateValueDelegate validateValue = null, BindingPropertyChangedDelegate propertyChanged = null, BindingPropertyChangingDelegate propertyChanging = null,
CoerceValueDelegate coerceValue = null, CreateDefaultValueDelegate defaultValueCreator = null) CoerceValueDelegate coerceValue = null, CreateDefaultValueDelegate defaultValueCreator = null)
@ -206,48 +162,6 @@ namespace Xamarin.Forms
isReadOnly: true, defaultValueCreator: defaultValueCreator)); 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, internal static BindableProperty Create(string propertyName, Type returnType, Type declaringType, object defaultValue, BindingMode defaultBindingMode, ValidateValueDelegate validateValue,
BindingPropertyChangedDelegate propertyChanged, BindingPropertyChangingDelegate propertyChanging, CoerceValueDelegate coerceValue, BindablePropertyBindingChanging bindingChanging, BindingPropertyChangedDelegate propertyChanged, BindingPropertyChangingDelegate propertyChanging, CoerceValueDelegate coerceValue, BindablePropertyBindingChanging bindingChanging,
CreateDefaultValueDelegate defaultValueCreator = null) CreateDefaultValueDelegate defaultValueCreator = null)
@ -256,52 +170,6 @@ namespace Xamarin.Forms
defaultValueCreator: defaultValueCreator); 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, internal static BindableProperty CreateAttached(string propertyName, Type returnType, Type declaringType, object defaultValue, BindingMode defaultBindingMode, ValidateValueDelegate validateValue,
BindingPropertyChangedDelegate propertyChanged, BindingPropertyChangingDelegate propertyChanging, CoerceValueDelegate coerceValue, BindablePropertyBindingChanging bindingChanging, BindingPropertyChangedDelegate propertyChanged, BindingPropertyChangingDelegate propertyChanging, CoerceValueDelegate coerceValue, BindablePropertyBindingChanging bindingChanging,
bool isReadOnly, CreateDefaultValueDelegate defaultValueCreator = null) bool isReadOnly, CreateDefaultValueDelegate defaultValueCreator = null)

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

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

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

@ -1,13 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection; using System.Reflection;
using System.Text;
using Xamarin.Forms.Internals;
namespace Xamarin.Forms 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) internal override void Apply(bool fromTarget)
{ {
base.Apply(fromTarget); base.Apply(fromTarget);
@ -326,95 +310,5 @@ namespace Xamarin.Forms
if (_expression != null) if (_expression != null)
_expression.Unapply(); _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;
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics; using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Windows.Input; using System.Windows.Input;
using Xamarin.Forms.Internals; using Xamarin.Forms.Internals;
@ -41,19 +40,10 @@ namespace Xamarin.Forms
public static readonly BindableProperty BorderColorProperty = BorderElement.BorderColorProperty; 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, public static readonly BindableProperty CornerRadiusProperty = BindableProperty.Create("CornerRadius", typeof(int), typeof(Button), defaultValue: BorderElement.DefaultCornerRadius,
propertyChanged: CornerRadiusPropertyChanged); propertyChanged: CornerRadiusPropertyChanged);
public static readonly BindableProperty ImageSourceProperty = ImageElement.ImageProperty; public static readonly BindableProperty ImageSourceProperty = ImageElement.ImageSourceProperty;
[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 PaddingProperty = PaddingElement.PaddingProperty; public static readonly BindableProperty PaddingProperty = PaddingElement.PaddingProperty;
@ -95,14 +85,6 @@ namespace Xamarin.Forms
set { SetValue(BorderElement.BorderColorProperty, value); } 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 public int CornerRadius
{ {
get { return (int)GetValue(CornerRadiusProperty); } get { return (int)GetValue(CornerRadiusProperty); }
@ -145,14 +127,6 @@ namespace Xamarin.Forms
set { SetValue(ImageSourceProperty, value); } 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 public string Text
{ {
get { return (string)GetValue(TextProperty); } get { return (string)GetValue(TextProperty); }
@ -326,19 +300,6 @@ namespace Xamarin.Forms
var val = (int)newvalue; var val = (int)newvalue;
if (val == BorderElement.DefaultCornerRadius && !button.cornerOrBorderRadiusSetting) if (val == BorderElement.DefaultCornerRadius && !button.cornerOrBorderRadiusSetting)
val = DefaultBorderRadius; 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) void ITextElement.OnTextColorPropertyChanged(Color oldValue, Color newValue)

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

@ -19,10 +19,6 @@ namespace Xamarin.Forms
public static readonly BindableProperty VerticalTextAlignmentProperty = TextAlignmentElement.VerticalTextAlignmentProperty; 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 public TextAlignment HorizontalTextAlignment
{ {
get { return (TextAlignment)GetValue(TextAlignmentElement.HorizontalTextAlignmentProperty); } get { return (TextAlignment)GetValue(TextAlignmentElement.HorizontalTextAlignmentProperty); }
@ -65,14 +61,6 @@ namespace Xamarin.Forms
set { SetValue(TextProperty, value); } 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; public event EventHandler Completed;
[EditorBrowsable(EditorBrowsableState.Never)] [EditorBrowsable(EditorBrowsableState.Never)]
@ -81,9 +69,6 @@ namespace Xamarin.Forms
void ITextAlignmentElement.OnHorizontalTextAlignmentPropertyChanged(TextAlignment oldValue, TextAlignment newValue) 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)] [EditorBrowsable(EditorBrowsableState.Never)]
public static void SetTargetIdiom(TargetIdiom value) => Idiom = value; 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; public static string RuntimePlatform => PlatformServices.RuntimePlatform;
[EditorBrowsable(EditorBrowsableState.Never)] [EditorBrowsable(EditorBrowsableState.Never)]
@ -178,62 +156,6 @@ namespace Xamarin.Forms
return GetNamedSize(size, targetElementType, false); 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) public static void StartTimer(TimeSpan interval, Func<bool> callback)
{ {
PlatformServices.StartTimer(interval, callback); PlatformServices.StartTimer(interval, callback);

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

@ -334,9 +334,6 @@ namespace Xamarin.Forms
OnDescendantAdded(element); 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) protected virtual void OnChildRemoved(Element child, int oldLogicalIndex)
{ {
child.Parent = null; child.Parent = null;
@ -598,41 +595,5 @@ namespace Xamarin.Forms
{ {
SetValueCore(property, value, SetValueFlags.ClearOneWayBindings | SetValueFlags.ClearTwoWayBindings); 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;
using System.ComponentModel;
using System.Globalization; using System.Globalization;
using Xamarin.Forms.Xaml; using Xamarin.Forms.Xaml;
@ -8,11 +7,6 @@ namespace Xamarin.Forms
[TypeConversion(typeof(double))] [TypeConversion(typeof(double))]
public class FontSizeConverter : TypeConverter, IExtendedTypeConverter 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) object IExtendedTypeConverter.ConvertFromInvariantString(string value, IServiceProvider serviceProvider)
{ {
if (value != null) if (value != null)

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

@ -12,7 +12,7 @@ namespace Xamarin.Forms
// And other scenarios // And other scenarios
public static void InitHandlers() 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<VerticalStackLayout, LayoutHandler>();
Xamarin.Platform.Registrar.Handlers.Register<HorizontalStackLayout, LayoutHandler>(); Xamarin.Platform.Registrar.Handlers.Register<HorizontalStackLayout, LayoutHandler>();
} }

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

@ -1,15 +1,10 @@
using System; using System;
using System.ComponentModel;
namespace Xamarin.Forms namespace Xamarin.Forms
{ {
[ContentProperty("Content")] [ContentProperty("Content")]
public class Frame : ContentView, IElementConfiguration<Frame>, IPaddingElement, IBorderElement 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 BorderColorProperty = BorderElement.BorderColorProperty;
public static readonly BindableProperty HasShadowProperty = BindableProperty.Create("HasShadow", typeof(bool), typeof(Frame), true); public static readonly BindableProperty HasShadowProperty = BindableProperty.Create("HasShadow", typeof(bool), typeof(Frame), true);
@ -35,14 +30,6 @@ namespace Xamarin.Forms
set { SetValue(HasShadowProperty, value); } 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 public Color BorderColor
{ {
get { return (Color)GetValue(BorderElement.BorderColorProperty); } get { return (Color)GetValue(BorderElement.BorderColorProperty); }
@ -73,9 +60,6 @@ namespace Xamarin.Forms
void IBorderElement.OnBorderColorPropertyChanged(Color oldValue, Color newValue) 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); bool IBorderElement.IsCornerRadiusSet() => IsSet(CornerRadiusProperty);

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

@ -1,8 +1,5 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel;
using Xamarin.Forms.Internals;
namespace Xamarin.Forms namespace Xamarin.Forms
{ {
@ -17,13 +14,5 @@ namespace Xamarin.Forms
ReadOnlyCollection<Element> LogicalChildren { get; } ReadOnlyCollection<Element> LogicalChildren { get; }
Element RealParent { get; } Element RealParent { get; }
IEnumerable<Element> Descendants(); 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;
using System.ComponentModel;
using System.Globalization;
namespace Xamarin.Forms namespace Xamarin.Forms
{ {
public interface IExtendedTypeConverter 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); object ConvertFromInvariantString(string value, IServiceProvider serviceProvider);
} }
} }

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

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

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