XamarinForms | Xamarin.forms学习项目,包含一个示例新闻、商城,IM;一个教程。
kandi X-RAY | XamarinForms Summary
kandi X-RAY | XamarinForms Summary
Xamarin.forms学习项目,包含一个示例新闻、商城,IM;一个教程。
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of XamarinForms
XamarinForms Key Features
XamarinForms Examples and Code Snippets
Community Discussions
Trending Discussions on XamarinForms
QUESTION
My MainPage.xaml
page is bound to ClientsViewModel.cs
. This page has a ListView
bound to an ObservableCollection
property.
The NewClient.xaml
page and entry fields are also bound to the ClientsViewModel.cs
.
When I save a new client using the NewClient.xaml
form and navigate back to MainPage.xaml
(using the navigation back arrow) I expect to see the newly added client in the MainPage.xaml
ListView
however I do not see this change.
How come the ListView
in MainPage.xaml
isn't showing the newly updated record? Where am I going wrong?
It may be worthwhile mentioning that my actual project will be using SQLite, so the ObseravbleCollection
will eventually be obtaining records directly from an SQLite database, so any help or advice around this would be greatly appreciated also.
Refer below code, or clone from my GitHub repository https://github.com/minlopalis/XamarinForms-ListView-DataBinding.git
(Model) Client.cs
...ANSWER
Answered 2021-Apr-06 at 12:52I've downloaded your code from the repo and I think there is one big flaw in it causing this. You're setting your BindingContext
in XAML on both pages. If you set a breakpoint in the constructor of the ClientViewModel
, you will notice it gets called twice: once when the app boots, once when you click "Add Client".
This means you are looking at two separate instances of this class so your Client
is in the wrong instance. You want to make sure that you are looking at the same view model.
Even more so, you might even want to make the separation of concerns even better by creating an extra, i.e.: CreateClientViewModel
which is only responsible for creating the client and returning that object to the ClientViewModel
which then in its turn adds that to the collection.
Hope this helps!
QUESTION
I am developing a Xamarin.Forms app for Android that stores data at google-firebase.
I have a dotNet standard library for data access and a XamarinForms Shared library.
I have implemented models in both libraries, the data access models are responsible for uploading and downloading data from google-firebase, and the shared library models are for data binding.
While I am fetching data by data access models, I can't put them in shared library models to bind to UI. It shows error Cannot implicitly convert type 'DataAccess.Models.Child' to 'VaxinApp.Models.Child' - CS0029
Note
I know why the error occurs but don't know how to handle it. I used explicit casting, but it doesn't help.
Update
I might be violating design patterns or principles like SOLID
, DRY
while implementing the access layer point me them as well.
ANSWER
Answered 2021-Apr-30 at 10:58Due to Wendy's comment, we can't cast reference types, but we can do using a method in the model or doing its properties one by one, Like in the code snippet below.
QUESTION
I've been working for about a year now on a Xamarin.forms app for my job. I took over from the previous guy with little to no knowledge of the xamarin.forms framework.
I've had a few hiccups, but I generaly manage to get by.
But here I got stuck on something that should be basic. The app is in two part, one being mostly for starting up things (never touched it, since it doesn't really change the function of the app) while the other is the nitty gritty of if.
Well now I'm trying to ge in app update from app center. And to be able to have user download in app I need to make a custom update message. Fine, I thought but here's the issue: I can't manage to get it to use the displayalert function.
Here's the part where I'm working on:
...ANSWER
Answered 2021-Apr-12 at 14:35DisplayAlert
is Page
method so it only works in context of a XF Page
. You are trying to execute it from the Android MainActivity
. You can try to tie into App.Current.MainPage
to get the correct context
QUESTION
I have an app created with : xamarinforms -prism - materialDesign I wold like to change the default the inner textbox's fontsize of the DatePicker, TimePicker controls, because it is to big, I 'd like a smaller text, my code is:
...ANSWER
Answered 2021-Mar-18 at 03:17You could use CustomRender to achieve this:
For Android:
QUESTION
My xamarin.forms app is breaking when it hits the _connection.CreateTableAsync()
line. I tried installing the earlier version of SQLite-net-pcl nuget package but it is still breaking. If I look in the Application Output window there are these errors -
2021-02-03 14:32:20.172608-0500 Excercise.iOS[17306:776656] *** Assertion failure in -[UIApplication _runWithMainScene:transitionContext:completion:], UIApplication.m:4191 2021-02-03 14:32:20.198946-0500 Excercise.iOS[17306:776816] [unspecified] container_system_group_path_for_identifier: error = ((container_error_t)98) NOT_CODESIGNED 2021-02-03 14:32:20.199159-0500 Excercise.iOS[17306:776816] [MC] Error getting system group container for systemgroup.com.apple.configurationprofiles: 98 2021-02-03 14:32:20.199394-0500 Excercise.iOS[17306:776816] [MC] Failed to get profile system group container path. Overriding with expected path: /Users/xamarinforms/Library/Developer/CoreSimulator/Devices/CF07B70A-5AEC-4307-AB50-864317F14B69/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
I can't understand if this has something to do with Sqlite. Are the above errors related to bundle singing by any chance? My apple id and account that I used to signin to Visual studio are different.
My Sqlite ios implementation
...ANSWER
Answered 2021-Feb-04 at 02:13You should not have the RootViewController
code in your appdelegate:
QUESTION
I'm trying to follow a video made by my teacher on how to display certain data in your CollectionView, XamarinForms Application. Yet, while following everything step by step - with the only difference being using another API - the names of my structures aren't showing in the ItemsSource.
I'm certainly doing something wrong, but I just can't seem to figure out what. My goal is to display all the structures names in the CollectionView.
My ContentPage:
...ANSWER
Answered 2021-Jan-31 at 14:04ItemsSource
must be an IEnumerable
(ie, a collection or array of data) and yours is not
QUESTION
I have a xamarin.forms app that needs to use push notifications. I implemented it using this tutorial and sample: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/data-cloud/azure-services/azure-notification-hub#add-apns-notifications-to-xamarinforms-ui. I understand how this is done at installation time. But my app is assigned a group (subscription tag) only upon sign in, which happens after the installation. So at installation time the sign in information is not available. For Android, how can I access current FirebaseService object to call SendRegistrationToServer()?
I tried to call the following method after signing in:
...ANSWER
Answered 2020-Dec-24 at 02:27Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference
From the error and shared code as follows:
QUESTION
I am working on a Xamarin.Forms application for iOS and Android (cross-platform)
I am working with a tabbed page which has 5 tabs at the bottom (custom render from the tabbed page)
My problem is, when I push another page on top of a tab page, the tabs at the bottom disappears.
Is there any way to keep the tabs visible when pushing new pages?
Below xaml code and photos:
...ANSWER
Answered 2020-Dec-19 at 00:411.You should warp your ContentPage
with a NavigationPage
like:
QUESTION
I have made a home page that contains 2 labels and 2 imagebuttons and the 2 imagebuttons is visible on my mobile and is not visible on Samsung galaxy s9 or there is something wrong I don't know what is the problem here is the images to explain more
and here is my code at XAML
...ANSWER
Answered 2020-Dec-15 at 03:30Problem Solved Guys The problem Was In Imagebutton Source Its Not Declared On All Platforms So I Decided To Put It in folder I named it imgs and made the build action of images EmbeddedResource and used it as FileResource
QUESTION
I wanted to know if there is no way other than custom rendering to arrange the ends of the texts in xamarinforms?
Because the modification does not support Android 7 and below.
Thanks to those who respond!
This code is related to my CustomRendering , which in Android 7, my app crashes:
...ANSWER
Answered 2020-Dec-06 at 22:37In general you may use Effects, but that won't make any significant difference.
The code above is not Xamarin.Forms, but rather Xamarin.Android. As such to code it well you must learn Android as Xamarin.Android is just mapped general Android Java APIs to .NET APIs.
Speaking of your problem you need to check for the version of Android before executing the code that is problematic. But your general problem is that you don't know Android, so you'll have many problems like this unless you learn it.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install XamarinForms
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page