xamarin.forms

App.Current.MainPage NullReferenceException in Constructor of MainPageModel

空扰寡人 提交于 2021-01-29 02:30:01
问题 On the loading of MainPage , I am pushing another page from Constructor of MainPageModel . It throws NullReferenceException in MainPageModel . This is my code MainPage constructor public MainPage() { InitializeComponent(); Title = "MainPage"; BindingContext = new MainPageViewModel(); } MainPageModel constructor public MainPageViewModel() { App.Current.MainPage.Navigation.PushAsync(new HomePage()); //Exception //CommandMenu1 = new Command(async () => await NavigateNext()); } How can I solve

App.Current.MainPage NullReferenceException in Constructor of MainPageModel

给你一囗甜甜゛ 提交于 2021-01-29 02:23:54
问题 On the loading of MainPage , I am pushing another page from Constructor of MainPageModel . It throws NullReferenceException in MainPageModel . This is my code MainPage constructor public MainPage() { InitializeComponent(); Title = "MainPage"; BindingContext = new MainPageViewModel(); } MainPageModel constructor public MainPageViewModel() { App.Current.MainPage.Navigation.PushAsync(new HomePage()); //Exception //CommandMenu1 = new Command(async () => await NavigateNext()); } How can I solve

Make my xamarin forms app able to open specific file types?

百般思念 提交于 2021-01-29 02:02:00
问题 I am building my first app with Xamarin forms, an EPUB reader. The core app is now working well and able to render documents. The question I am trying to answer is how I can register for my app as a handler for the EPUB document type so that if the file is opened from an email app my reader app will be available as a reader? Ideally this should be a cross platform solution. Thanks! 回答1: Ideally this should be a cross platform solution. Unfortunately, there is no cross platform solution that

Make my xamarin forms app able to open specific file types?

丶灬走出姿态 提交于 2021-01-29 02:00:36
问题 I am building my first app with Xamarin forms, an EPUB reader. The core app is now working well and able to render documents. The question I am trying to answer is how I can register for my app as a handler for the EPUB document type so that if the file is opened from an email app my reader app will be available as a reader? Ideally this should be a cross platform solution. Thanks! 回答1: Ideally this should be a cross platform solution. Unfortunately, there is no cross platform solution that

How to create relationships with SQLite (Foreign key)

吃可爱长大的小学妹 提交于 2021-01-29 01:36:25
问题 I'm trying to create relationships with my tables in SQLite (I'm currently working with Xamarin.Forms), but I'm not getting the expected result, adding the Data Annotations [ForeignKey(typeof(UserLocal))] But I'm not creating the relationship in my BD, what's going on? my BD is only doing the indexed relationships, but it is not relating them to foreign keys Browser SQLite For the connection to my database, I created an interface which gets the route in Android and iOS, and then to manage my

Border being ignored on Android - Xamarin.Forms

ぃ、小莉子 提交于 2021-01-28 22:20:48
问题 I am attempting to build a circular button with a green border using Xamarin.Forms, using a method that I have used on previous projects by adding a BorderRadius, BorderColour etc values to the Button element. Please consider the following code: Button goButton = new Button { Text = "GO!", TextColor = Color.White, FontSize = 75, HeightRequest = 200, WidthRequest = 200, BorderRadius = 100, BorderWidth = 10, BorderColor = Color.Green, BackgroundColor = Color.Red }; The above code gives me the

The application cannot access the iOS keychain in Xamarin.Forms but works in Android

自闭症网瘾萝莉.ら 提交于 2021-01-28 21:56:59
问题 Hello I am learning using MSAL but met a wired issue. I totally followed the tutorial, and I am using the sample code. But I still got this exception building the client in App.xaml.cs : microsoft.identity.client.msalclientexception: the application cannot access the ios keychain for the application publisher (the team id is null). this is needed to enable single sign on between applications of the same publisher. this is an ios configuration issue. see https://aka.ms/msal-net-enable-keychain

How to use Mapsui 2.0.1 with Xamarin.Forms?

妖精的绣舞 提交于 2021-01-28 20:41:37
问题 As far as I understand we could use Mapsui in Xamarin.Forms starting from Mapsui 2.0 version. Currently, the Mapsui version is 2.0.1, and Xamarin.Forms is 4.6. I was looking for a simple example or tutorial that could guide me on how to add a Mapsui map to my Xamarin.Forms. All the examples I found are using the old Mapsui 1.4 version with Xamarin PCL projects. Could anyone give me some direction on how to start with Mapsui 2.0.1 and Xamarin.Form 4.6? 回答1: The docs were recently updated. See

How do i get values from Json object in Xamarin Form

时光总嘲笑我的痴心妄想 提交于 2021-01-28 20:00:14
问题 Please i need help, i need to get values for UserID and UserID from the json Object below {"data":{"UserID":"MS100000041","RoleID":5}} This is my code: public class UserDetails { public string UserID { get; set; } public int RoleID { get; set; } } public async Task Login(string url) { try { var uri = new Uri(url); HttpClient myClient = new HttpClient(); var response = await myClient.GetAsync(uri); if (response.IsSuccessStatusCode) { var content = await response.Content.ReadAsStringAsync();

Custom Renderer for Picker in Xamarin.Forms

馋奶兔 提交于 2021-01-28 19:07:11
问题 I want to customize my picker. I created a custom renderer for my picker but I dont know how the customization settings. How can I change the font style and size of the item? and How can I remove the two lines? public class CustomPickerRenderer : PickerRenderer { public CustomPickerRenderer(Context context) : base(context) { AutoPackage = false; } protected override void OnElementChanged(ElementChangedEventArgs<Picker> e) { base.OnElementChanged(e); if (e.OldElement == null) { Control